Skip to content

Commit

Permalink
fix: assure archives are unique if their generator-scripts are called…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
Byron committed Jul 4, 2024
1 parent e2e8cf9 commit 1917771
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Binary file not shown.
Binary file not shown.
16 changes: 11 additions & 5 deletions tests/tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,17 @@ fn scripted_fixture_read_only_with_args_inner(

let script_basename = script_location.file_stem().unwrap_or(script_location.as_os_str());
let archive_file_path = fixture_path_inner(
Path::new("generated-archives").join(format!(
"{}.tar{}",
script_basename.to_str().expect("valid UTF-8"),
if cfg!(feature = "xz") { ".xz" } else { "" }
)),
{
let mut suffix = args.join("_");
if !suffix.is_empty() {
suffix.insert(0, '_');
}
Path::new("generated-archives").join(format!(
"{}{suffix}.tar{}",
script_basename.to_str().expect("valid UTF-8"),
if cfg!(feature = "xz") { ".xz" } else { "" }
))
},
root,
);
let (force_run, script_result_directory) = destination_dir.map_or_else(
Expand Down

0 comments on commit 1917771

Please sign in to comment.