Skip to content

Commit e366421

Browse files
committed
Auto merge of #5763 - ehuss:pkg-modify-mac, r=alexcrichton
Fix flakey test on MacOS. `do_not_package_if_src_was_modified` can fail if the test runs too quickly due to mac's filesystem time resolution.
2 parents fc577df + f41ee89 commit e366421

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/testsuite/package.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::io::prelude::*;
44
use std::path::{Path, PathBuf};
55

66
use git2;
7-
use cargotest::{cargo_process, process, ChannelChanger};
7+
use cargotest::{cargo_process, process, sleep_ms, ChannelChanger};
88
use cargotest::support::{cargo_exe, execs, git, paths, project, registry, path2url};
99
use cargotest::support::registry::Package;
1010
use flate2::read::GzDecoder;
@@ -1440,6 +1440,13 @@ fn do_not_package_if_src_was_modified() {
14401440
"#)
14411441
.build();
14421442

1443+
if cfg!(target_os = "macos") {
1444+
// MacOS has 1s resolution filesystem.
1445+
// If src/main.rs is created within 1s of src/generated.txt, then it
1446+
// won't trigger the modification check.
1447+
sleep_ms(1000);
1448+
}
1449+
14431450
assert_that(
14441451
p.cargo("package"),
14451452
execs().with_status(101)

0 commit comments

Comments
 (0)