Skip to content

Commit 1917771

Browse files
committed
fix: assure archives are unique if their generator-scripts are called with arguments. (#1440)
Previously there was a race condition that would cause archives to be created either with or without arguments, depending on which test was run first. After its creation, they wouldn't be looked at again as on disk they would already be available in their usable form.
1 parent e2e8cf9 commit 1917771

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed
Binary file not shown.
Binary file not shown.

tests/tools/src/lib.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,17 @@ fn scripted_fixture_read_only_with_args_inner(
414414

415415
let script_basename = script_location.file_stem().unwrap_or(script_location.as_os_str());
416416
let archive_file_path = fixture_path_inner(
417-
Path::new("generated-archives").join(format!(
418-
"{}.tar{}",
419-
script_basename.to_str().expect("valid UTF-8"),
420-
if cfg!(feature = "xz") { ".xz" } else { "" }
421-
)),
417+
{
418+
let mut suffix = args.join("_");
419+
if !suffix.is_empty() {
420+
suffix.insert(0, '_');
421+
}
422+
Path::new("generated-archives").join(format!(
423+
"{}{suffix}.tar{}",
424+
script_basename.to_str().expect("valid UTF-8"),
425+
if cfg!(feature = "xz") { ".xz" } else { "" }
426+
))
427+
},
422428
root,
423429
);
424430
let (force_run, script_result_directory) = destination_dir.map_or_else(

0 commit comments

Comments
 (0)