Skip to content

Commit 6c59bf2

Browse files
authored
test: Handle non-deterministic compilation order (#17347)
### What does this PR try to resolve? Hit this with #17346 ``` thread 'build_script::cfg_override_test' (71300) panicked at tests/testsuite/build_script.rs:3634:10: ---- expected: tests/testsuite/build_script.rs:3601:27 ++++ actual: stderr 1 1 | [COMPILING] foo v0.0.1 ([ROOT]/foo) 2 2 | [RUNNING] `rustc --crate-name foo[..]` 3 - [RUNNING] `rustc --crate-name foo[..]` 4 - [RUNNING] `rustc --crate-name test[..]` 3 + [RUNNING] `rustc --crate-name test --edition=2015 tests/test.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=400 --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --allow=unexpected_cfgs --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=7e98bdc87b54be1e -C extra-filename=-46d1fa8b5db2bd02 --out-dir [ROOT]/foo/target/debug/deps -L dependency=[ROOT]/foo/target/debug/deps --extern foo=[ROOT]/foo/target/debug/deps/libfoo-[HASH].rlib --cfg foo` 4 + [RUNNING] `rustc --crate-name foo --edition=2015 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=400 --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --allow=unexpected_cfgs --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=e83780a000df3302 -C extra-filename=-e1364ce7fb0b5fef --out-dir [ROOT]/foo/target/debug/deps -L dependency=[ROOT]/foo/target/debug/deps --cfg foo` 5 5 | [FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s 6 6 | [RUNNING] `[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]` 7 7 | [RUNNING] `[ROOT]/foo/target/debug/deps/test-[HASH][EXE]` 8 8 | [DOCTEST] foo 9 9 | [RUNNING] `rustdoc [..] --cfg foo[..]` ``` ### How to test and review this PR?
2 parents b3c8bf8 + 316eb5c commit 6c59bf2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/testsuite/build_script.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,7 +3598,8 @@ fn cfg_override_test() {
35983598
.file("tests/test.rs", "#[cfg(foo)] #[test] fn test_bar() {}")
35993599
.build();
36003600
p.cargo("test -v")
3601-
.with_stderr_data(str![[r#"
3601+
.with_stderr_data(
3602+
str![[r#"
36023603
[COMPILING] foo v0.0.1 ([ROOT]/foo)
36033604
[RUNNING] `rustc --crate-name foo[..]`
36043605
[RUNNING] `rustc --crate-name foo[..]`
@@ -3609,7 +3610,9 @@ fn cfg_override_test() {
36093610
[DOCTEST] foo
36103611
[RUNNING] `rustdoc [..] --cfg foo[..]`
36113612
3612-
"#]])
3613+
"#]]
3614+
.unordered(),
3615+
)
36133616
.with_stdout_data(str![[r#"
36143617
36153618
running 1 test

0 commit comments

Comments
 (0)