Skip to content

Commit 895aacb

Browse files
authored
Merge branch 'main' into renovate/major-github-artifact-actions
2 parents cd62b8c + 125fc29 commit 895aacb

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "diffutils"
3-
version = "0.4.2"
3+
version = "0.5.0"
44
edition = "2021"
55
description = "A CLI app for generating diff files"
66
license = "MIT OR Apache-2.0"

tests/integration.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,9 +825,24 @@ mod cmp {
825825
.spawn()
826826
.unwrap();
827827

828-
std::thread::sleep(std::time::Duration::from_millis(100));
829-
830-
assert_eq!(child.try_wait().unwrap().unwrap().code(), Some(1));
828+
// Bound the runtime to a very short time that still allows for some resource
829+
// constraint to slow it down while also allowing very fast systems to exit as
830+
// early as possible.
831+
const MAX_TRIES: u8 = 50;
832+
for tries in 0..=MAX_TRIES {
833+
if tries == MAX_TRIES {
834+
panic!("cmp took too long to run, /dev/null optimization probably not working")
835+
}
836+
match child.try_wait() {
837+
Ok(Some(status)) => {
838+
assert_eq!(status.code(), Some(1));
839+
break;
840+
}
841+
Ok(None) => (),
842+
Err(e) => panic!("{e:#?}"),
843+
}
844+
std::thread::sleep(std::time::Duration::from_millis(10));
845+
}
831846

832847
// Two stdins should be equal
833848
let mut cmd = cargo_bin_cmd!("diffutils");
@@ -864,6 +879,7 @@ mod cmp {
864879
let mut cmd = cargo_bin_cmd!("diffutils");
865880
cmd.arg("cmp");
866881
cmd.arg(&a_path).arg(&b_path);
882+
cmd.env("LC_ALL", "en_US");
867883
cmd.assert()
868884
.code(predicate::eq(1))
869885
.failure()

0 commit comments

Comments
 (0)