Skip to content

Commit

Permalink
Fix the empty_project_output for macos
Browse files Browse the repository at this point in the history
The empty_project_output test doesn't have the same traversing/logging
order on macos as it does on whatever os/machine it was written for.
This commit tries to improve the situation somewhat by making the test
runnable on macos as well, while sacrificing readability and test accuracy.

An alternative fix would be to not use regex for the test at all.
  • Loading branch information
bes committed Jan 28, 2023
1 parent 84fc0f9 commit 603d59c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ fn empty_project_output() -> TestResult {

let output = std::str::from_utf8(&assert.get_output().stdout).unwrap();

// Please note: The output from the sweep command is platform dependent. The regular
// expression tries to take that into account by letting the file output order vary,
// but since the regex crate doesn't have support for lookaround the check isn't as
// exact as it could be - the regex below can't check that there is _exactly one_
// invocation of each file pattern, it can only check that any of the patterns in
// any combination is invoked exactly four times.
let pattern = unindent(
r#"\[DEBUG\] cleaning: ".+" with remove_older_until_fits
\[DEBUG\] size_to_remove: .+
Expand All @@ -250,10 +256,7 @@ fn empty_project_output() -> TestResult {
\),
\]
\[DEBUG\] cleaning: ".+debug" with remove_not_built_with_in_a_profile
\[DEBUG\] Successfully removed: ".+libsample_project-.+\.rlib"
\[DEBUG\] Successfully removed: ".+libsample_project-.+\.rmeta"
\[DEBUG\] Successfully removed: ".+sample_project-.+\.d"
\[DEBUG\] Successfully removed: ".+.fingerprint.+sample-project-.+"
(\[DEBUG\] Successfully removed: (".+libsample_project-.+\.rlib"|".+libsample_project-.+\.rmeta"|".+sample_project-.+\.d"|".+.fingerprint.+sample-project-.+")\n{0,1}){4}
\[INFO\] Cleaned .+ from ".+""#,
);

Expand Down

0 comments on commit 603d59c

Please sign in to comment.