diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-12-03 12:05:22 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-12-17 12:00:22 +0100 |
| commit | 1d97df0cd553526659369474113a860e84472136 (patch) | |
| tree | 44b5641f758aa185d920144c28da19c2908c2c6e /test | |
| parent | 39c441691548bac23c044bd3451167a821508084 (diff) | |
| download | mullvadvpn-1d97df0cd553526659369474113a860e84472136.tar.xz mullvadvpn-1d97df0cd553526659369474113a860e84472136.zip | |
Attach target arch to VM config
Diffstat (limited to 'test')
| -rw-r--r-- | test/test-manager/docs/config.md | 2 | ||||
| -rw-r--r-- | test/test-manager/src/config.rs | 8 | ||||
| -rw-r--r-- | test/test-manager/src/package.rs | 10 |
3 files changed, 11 insertions, 9 deletions
diff --git a/test/test-manager/docs/config.md b/test/test-manager/docs/config.md index f86315241d..8c4db7fce4 100644 --- a/test/test-manager/docs/config.md +++ b/test/test-manager/docs/config.md @@ -57,7 +57,7 @@ A configuration containing one Debian 12 VM and one Windows 11 VM "image_path": "$VM_IMAGES/windows11.qcow2", "os_type": "windows", "package_type": null, - "architecture": null, + "architecture": "x64", "provisioner": "noop", "ssh_user": null, "ssh_password": null, diff --git a/test/test-manager/src/config.rs b/test/test-manager/src/config.rs index 7379bd5ec6..b261ec30a5 100644 --- a/test/test-manager/src/config.rs +++ b/test/test-manager/src/config.rs @@ -154,8 +154,8 @@ pub struct VmConfig { pub package_type: Option<PackageType>, /// CPU architecture - #[arg(long, required_if_eq("os_type", "linux"))] - pub architecture: Option<Architecture>, + #[arg(long)] + pub architecture: Architecture, /// Tool to use for provisioning #[arg(long, default_value = "noop")] @@ -203,8 +203,8 @@ impl VmConfig { pub fn get_default_runner_dir(&self) -> PathBuf { let target_dir = self.get_target_dir(); let subdir = match self.architecture { - None | Some(Architecture::X64) => self.get_x64_runner_subdir(), - Some(Architecture::Aarch64) => self.get_aarch64_runner_subdir(), + Architecture::X64 => self.get_x64_runner_subdir(), + Architecture::Aarch64 => self.get_aarch64_runner_subdir(), }; target_dir.join(subdir) diff --git a/test/test-manager/src/package.rs b/test/test-manager/src/package.rs index 4791556392..feb66e97e8 100644 --- a/test/test-manager/src/package.rs +++ b/test/test-manager/src/package.rs @@ -86,7 +86,7 @@ pub fn get_version_from_path(app_package_path: &Path) -> Result<String, anyhow:: fn find_app( app: &str, e2e_bin: bool, - package_type: (OsType, Option<PackageType>, Option<Architecture>), + package_type: (OsType, Option<PackageType>, Architecture), package_dir: Option<&PathBuf>, ) -> Result<PathBuf> { // If it's a path, use that path @@ -123,7 +123,7 @@ fn find_app( .filter(|(_path, u8_path)| !e2e_bin || u8_path.contains(get_os_name(package_type))) // Filter out irrelevant platforms .filter(|(_path, u8_path)| { let linux = e2e_bin || package_type.0 == OsType::Linux; - let matching_ident = package_type.2.map(|arch| arch.get_identifiers().iter().any(|id| u8_path.contains(id))).unwrap_or(true); + let matching_ident = package_type.2.get_identifiers().iter().any(|id| u8_path.contains(id)); // Skip for non-Linux, because there's only one package !linux || matching_ident }) // Skip file if it doesn't match the architecture @@ -143,7 +143,8 @@ fn find_app( }) } -fn get_ext(package_type: (OsType, Option<PackageType>, Option<Architecture>)) -> &'static str { +// TODO: Move to [`PackageType`] +fn get_ext(package_type: (OsType, Option<PackageType>, Architecture)) -> &'static str { match package_type.0 { OsType::Windows => "exe", OsType::Macos => "pkg", @@ -154,7 +155,8 @@ fn get_ext(package_type: (OsType, Option<PackageType>, Option<Architecture>)) -> } } -fn get_os_name(package_type: (OsType, Option<PackageType>, Option<Architecture>)) -> &'static str { +// TODO: Move to [`OsType`] +fn get_os_name(package_type: (OsType, Option<PackageType>, Architecture)) -> &'static str { match package_type.0 { OsType::Windows => "windows", OsType::Macos => "apple", |
