Skip to content

Commit e9770a7

Browse files
committed
Update alternative locations integration tests for ARM64
This updates the integration-style tests for Windows-specific `git` executable alternative locations to include `clangarm64/bin` directories when looking under the 64-bit program files directory. (These tests are "integration-style" in the sense that they check the actual value of `ALTERNATIVE_LOCATIONS` against expectations computed from details of the build target and runtime environment.) The tests will now fail until `ALTERNATIVE_LOCATIONS` is fixed for ARM64 Windows. (Because the currently intended approach is to check for both ARM64 and x86_64 installations of Git for Windows on all 64-bit systems where the 64-bit "Program Files" directory location is available -- regardless of whether the system is an x86_64 or ARM64 installation of Windows -- these integration-style tests should currently fail on both x86_64 and ARM64 Windows systems.)
1 parent 8d2c262 commit e9770a7

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

gix-path/src/env/git/tests.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,27 +292,32 @@ mod locations {
292292
#[derive(Clone, Debug)]
293293
struct RelativeGitBinPaths<'a> {
294294
x86: &'a Path,
295-
maybe_64bit: Option<&'a Path>,
295+
maybe_x64: Option<&'a Path>,
296+
maybe_arm64: Option<&'a Path>,
296297
}
297298

298299
impl<'a> RelativeGitBinPaths<'a> {
299300
/// Assert that `locations` has the given path prefixes, and extract the suffixes.
300301
fn assert_from(pf: &'a ProgramFilesPaths, locations: &'static [PathBuf]) -> Self {
301302
match locations {
302-
[primary, secondary] => {
303+
[primary, secondary, tertiary] => {
303304
let prefix_64bit = pf
304305
.maybe_64bit
305306
.as_ref()
306307
.expect("It gives two paths only if one can be 64-bit");
307-
let suffix_64bit = primary
308+
let suffix_arm64 = primary
308309
.strip_prefix(prefix_64bit)
309-
.expect("It gives the 64-bit path and lists it first");
310-
let suffix_x86 = secondary
310+
.expect("It gives the 64-bit ARM64 path and lists it first");
311+
let suffix_x64 = secondary
312+
.strip_prefix(prefix_64bit)
313+
.expect("It gives the 64-bit x86 path and lists it second");
314+
let suffix_x86 = tertiary
311315
.strip_prefix(pf.x86.as_path())
312-
.expect("It gives the 32-bit path and lists it second");
316+
.expect("It gives the 32-bit path and lists it third");
313317
Self {
314318
x86: suffix_x86,
315-
maybe_64bit: Some(suffix_64bit),
319+
maybe_x64: Some(suffix_x64),
320+
maybe_arm64: Some(suffix_arm64),
316321
}
317322
}
318323
[only] => {
@@ -322,23 +327,23 @@ mod locations {
322327
.expect("The one path it gives is the 32-bit path");
323328
Self {
324329
x86: suffix_x86,
325-
maybe_64bit: None,
330+
maybe_x64: None,
331+
maybe_arm64: None,
326332
}
327333
}
328-
other => panic!("{:?} has length {}, expected 1 or 2.", other, other.len()),
334+
other => panic!("{:?} has length {}, expected 1 or 3.", other, other.len()),
329335
}
330336
}
331337

332338
/// Assert that the suffixes (relative subdirectories) are the common per-architecture Git install locations.
333339
fn assert_architectures(&self) {
334340
assert_eq!(self.x86, Path::new("Git/mingw32/bin"));
335341

336-
if let Some(suffix_64bit) = self.maybe_64bit {
337-
// When Git for Windows releases ARM64 builds, there will be another 64-bit suffix,
338-
// likely clangarm64. In that case, this and other assertions will need updating,
339-
// as there will be two separate paths to check under the same 64-bit program files
340-
// directory. (See the definition of ProgramFilesPaths::maybe_64bit for details.)
341-
assert_eq!(suffix_64bit, Path::new("Git/mingw64/bin"));
342+
if let Some(suffix_x64) = self.maybe_x64 {
343+
assert_eq!(suffix_x64, Path::new("Git/mingw64/bin"));
344+
}
345+
if let Some(suffix_arm64) = self.maybe_arm64 {
346+
assert_eq!(suffix_arm64, Path::new("Git/clangarm64/bin"));
342347
}
343348
}
344349
}

0 commit comments

Comments
 (0)