Skip to content

Commit 0afd943

Browse files
committed
Fix some test output validation.
1 parent 6658e1a commit 0afd943

17 files changed

+206
-66
lines changed

Diff for: tests/testsuite/artifact_dep.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2167,8 +2167,11 @@ fn doc_lib_true() {
21672167

21682168
p.cargo("doc -Z bindeps")
21692169
.masquerade_as_nightly_cargo(&["bindeps"])
2170-
.env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint")
2171-
.with_stdout("")
2170+
.with_stderr(
2171+
"\
2172+
[FINISHED] [..]
2173+
[GENERATED] [CWD]/target/doc/foo/index.html",
2174+
)
21722175
.run();
21732176

21742177
assert!(p.root().join("target/doc").is_dir());

Diff for: tests/testsuite/build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2959,12 +2959,12 @@ fn freshness_ignores_excluded() {
29592959

29602960
// Smoke test to make sure it doesn't compile again
29612961
println!("first pass");
2962-
foo.cargo("build").with_stdout("").run();
2962+
foo.cargo("build").with_stderr("[FINISHED] [..]").run();
29632963

29642964
// Modify an ignored file and make sure we don't rebuild
29652965
println!("second pass");
29662966
foo.change_file("src/bar.rs", "");
2967-
foo.cargo("build").with_stdout("").run();
2967+
foo.cargo("build").with_stderr("[FINISHED] [..]").run();
29682968
}
29692969

29702970
#[cargo_test]
@@ -3064,7 +3064,7 @@ fn recompile_space_in_name() {
30643064
.build();
30653065
foo.cargo("build").run();
30663066
foo.root().move_into_the_past();
3067-
foo.cargo("build").with_stdout("").run();
3067+
foo.cargo("build").with_stderr("[FINISHED] [..]").run();
30683068
}
30693069

30703070
#[cfg(unix)]

Diff for: tests/testsuite/build_script.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3245,7 +3245,6 @@ fn fresh_builds_possible_with_multiple_metadata_overrides() {
32453245
.run();
32463246

32473247
p.cargo("build -v")
3248-
.env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint=info")
32493248
.with_stderr(
32503249
"\
32513250
[FRESH] foo v0.5.0 ([..])

Diff for: tests/testsuite/clean.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ fn different_dir() {
3434
p.cargo("build").run();
3535
assert!(p.build_dir().is_dir());
3636

37-
p.cargo("clean").cwd("src").with_stdout("").run();
37+
p.cargo("clean")
38+
.cwd("src")
39+
.with_stderr("[REMOVED] [..]")
40+
.run();
3841
assert!(!p.build_dir().is_dir());
3942
}
4043

@@ -82,7 +85,7 @@ fn clean_multiple_packages() {
8285

8386
p.cargo("clean -p d1 -p d2")
8487
.cwd("src")
85-
.with_stdout("")
88+
.with_stderr("[REMOVED] [..]")
8689
.run();
8790
assert!(p.bin("foo").is_file());
8891
assert!(!d1_path.is_file());
@@ -227,7 +230,9 @@ fn clean_release() {
227230
p.cargo("build --release").run();
228231

229232
p.cargo("clean -p foo").run();
230-
p.cargo("build --release").with_stdout("").run();
233+
p.cargo("build --release")
234+
.with_stderr("[FINISHED] [..]")
235+
.run();
231236

232237
p.cargo("clean -p foo --release").run();
233238
p.cargo("build --release")
@@ -355,7 +360,7 @@ fn clean_git() {
355360
.build();
356361

357362
p.cargo("build").run();
358-
p.cargo("clean -p dep").with_stdout("").run();
363+
p.cargo("clean -p dep").with_stderr("[REMOVED] [..]").run();
359364
p.cargo("build").run();
360365
}
361366

@@ -380,7 +385,7 @@ fn registry() {
380385
Package::new("bar", "0.1.0").publish();
381386

382387
p.cargo("build").run();
383-
p.cargo("clean -p bar").with_stdout("").run();
388+
p.cargo("clean -p bar").with_stderr("[REMOVED] [..]").run();
384389
p.cargo("build").run();
385390
}
386391

Diff for: tests/testsuite/doc.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,14 @@ fn doc_twice() {
7575
)
7676
.run();
7777

78-
p.cargo("doc").with_stdout("").run();
78+
p.cargo("doc")
79+
.with_stderr(
80+
"\
81+
[FINISHED] [..]
82+
[GENERATED] [CWD]/target/doc/foo/index.html
83+
",
84+
)
85+
.run();
7986
}
8087

8188
#[cargo_test]
@@ -118,9 +125,14 @@ fn doc_deps() {
118125
assert_eq!(p.glob("target/debug/**/*.rlib").count(), 0);
119126
assert_eq!(p.glob("target/debug/deps/libbar-*.rmeta").count(), 1);
120127

128+
// Make sure it doesn't recompile.
121129
p.cargo("doc")
122-
.env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint")
123-
.with_stdout("")
130+
.with_stderr(
131+
"\
132+
[FINISHED] [..]
133+
[GENERATED] [CWD]/target/doc/foo/index.html
134+
",
135+
)
124136
.run();
125137

126138
assert!(p.root().join("target/doc").is_dir());

Diff for: tests/testsuite/features.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,14 @@ fn cyclic_feature2() {
627627
.file("src/main.rs", "fn main() {}")
628628
.build();
629629

630-
p.cargo("check").with_stdout("").run();
630+
p.cargo("check")
631+
.with_stderr(
632+
"\
633+
[CHECKING] foo [..]
634+
[FINISHED] [..]
635+
",
636+
)
637+
.run();
631638
}
632639

633640
#[cargo_test]
@@ -1047,8 +1054,8 @@ fn no_rebuild_when_frobbing_default_feature() {
10471054
.build();
10481055

10491056
p.cargo("check").run();
1050-
p.cargo("check").with_stdout("").run();
1051-
p.cargo("check").with_stdout("").run();
1057+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
1058+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
10521059
}
10531060

10541061
#[cargo_test]
@@ -1098,8 +1105,8 @@ fn unions_work_with_no_default_features() {
10981105
.build();
10991106

11001107
p.cargo("check").run();
1101-
p.cargo("check").with_stdout("").run();
1102-
p.cargo("check").with_stdout("").run();
1108+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
1109+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
11031110
}
11041111

11051112
#[cargo_test]

Diff for: tests/testsuite/fetch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn no_deps() {
1111
.file("src/a.rs", "")
1212
.build();
1313

14-
p.cargo("fetch").with_stdout("").run();
14+
p.cargo("fetch").with_stderr("").run();
1515
}
1616

1717
#[cargo_test]

Diff for: tests/testsuite/freshness.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn modifying_and_moving() {
3434
)
3535
.run();
3636

37-
p.cargo("build").with_stdout("").run();
37+
p.cargo("build").with_stderr("[FINISHED] [..]").run();
3838
p.root().move_into_the_past();
3939
p.root().join("target").move_into_the_past();
4040

@@ -223,7 +223,7 @@ fn changing_lib_features_caches_targets() {
223223
.with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
224224
.run();
225225

226-
p.cargo("build").with_stdout("").run();
226+
p.cargo("build").with_stderr("[FINISHED] [..]").run();
227227

228228
p.cargo("build --features foo")
229229
.with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
@@ -666,7 +666,7 @@ fn rerun_if_changed_in_dep() {
666666
.build();
667667

668668
p.cargo("build").run();
669-
p.cargo("build").with_stdout("").run();
669+
p.cargo("build").with_stderr("[FINISHED] [..]").run();
670670
}
671671

672672
#[cargo_test]

Diff for: tests/testsuite/generate_lockfile.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ fn cargo_update_generate_lockfile() {
161161

162162
let lockfile = p.root().join("Cargo.lock");
163163
assert!(!lockfile.is_file());
164-
p.cargo("update").with_stdout("").run();
164+
p.cargo("update").with_stderr("").run();
165165
assert!(lockfile.is_file());
166166

167167
fs::remove_file(p.root().join("Cargo.lock")).unwrap();
168168

169169
assert!(!lockfile.is_file());
170-
p.cargo("update").with_stdout("").run();
170+
p.cargo("update").with_stderr("").run();
171171
assert!(lockfile.is_file());
172172
}
173173

Diff for: tests/testsuite/git.rs

+19-12
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,12 @@ fn recompilation() {
591591
.run();
592592

593593
// Don't recompile the second time
594-
p.cargo("check").with_stdout("").run();
594+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
595595

596596
// Modify a file manually, shouldn't trigger a recompile
597597
git_project.change_file("src/bar.rs", r#"pub fn bar() { println!("hello!"); }"#);
598598

599-
p.cargo("check").with_stdout("").run();
599+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
600600

601601
p.cargo("update")
602602
.with_stderr(&format!(
@@ -605,7 +605,7 @@ fn recompilation() {
605605
))
606606
.run();
607607

608-
p.cargo("check").with_stdout("").run();
608+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
609609

610610
// Commit the changes and make sure we don't trigger a recompile because the
611611
// lock file says not to change
@@ -614,7 +614,7 @@ fn recompilation() {
614614
git::commit(&repo);
615615

616616
println!("compile after commit");
617-
p.cargo("check").with_stdout("").run();
617+
p.cargo("check").with_stderr("[FINISHED] [..]").run();
618618
p.root().move_into_the_past();
619619

620620
// Update the dependency and carry on!
@@ -638,7 +638,7 @@ fn recompilation() {
638638
.run();
639639

640640
// Make sure clean only cleans one dep
641-
p.cargo("clean -p foo").with_stdout("").run();
641+
p.cargo("clean -p foo").with_stderr("[REMOVED] [..]").run();
642642
p.cargo("check")
643643
.with_stderr(
644644
"[CHECKING] foo v0.5.0 ([CWD])\n\
@@ -742,7 +742,14 @@ fn update_with_shared_deps() {
742742

743743
// By default, not transitive updates
744744
println!("dep1 update");
745-
p.cargo("update dep1").with_stdout("").run();
745+
p.cargo("update dep1")
746+
.with_stderr(
747+
"\
748+
[UPDATING] git repository [..]
749+
[UPDATING] bar v0.5.0 [..]
750+
",
751+
)
752+
.run();
746753

747754
// Don't do anything bad on a weird --precise argument
748755
println!("bar bad precise update");
@@ -766,7 +773,7 @@ Caused by:
766773
println!("bar precise update");
767774
p.cargo("update bar --precise")
768775
.arg(&old_head.to_string())
769-
.with_stdout("")
776+
.with_stderr("[UPDATING] bar v0.5.0 [..]")
770777
.run();
771778

772779
// Updating recursively should, however, update the repo.
@@ -1496,12 +1503,12 @@ fn git_build_cmd_freshness() {
14961503

14971504
// Smoke test to make sure it doesn't compile again
14981505
println!("first pass");
1499-
foo.cargo("check").with_stdout("").run();
1506+
foo.cargo("check").with_stderr("[FINISHED] [..]").run();
15001507

15011508
// Modify an ignored file and make sure we don't rebuild
15021509
println!("second pass");
15031510
foo.change_file("src/bar.rs", "");
1504-
foo.cargo("check").with_stdout("").run();
1511+
foo.cargo("check").with_stderr("[FINISHED] [..]").run();
15051512
}
15061513

15071514
#[cargo_test]
@@ -1636,7 +1643,7 @@ fn git_repo_changing_no_rebuild() {
16361643

16371644
// And now for the real test! Make sure that p1 doesn't get rebuilt
16381645
// even though the git repo has changed.
1639-
p1.cargo("check").with_stdout("").run();
1646+
p1.cargo("check").with_stderr("[FINISHED] [..]").run();
16401647
}
16411648

16421649
#[cargo_test]
@@ -1741,7 +1748,7 @@ fn fetch_downloads() {
17411748
))
17421749
.run();
17431750

1744-
p.cargo("fetch").with_stdout("").run();
1751+
p.cargo("fetch").with_stderr("").run();
17451752
}
17461753

17471754
#[cargo_test]
@@ -1786,7 +1793,7 @@ fn fetch_downloads_with_git2_first_then_with_gitoxide_and_vice_versa() {
17861793
.run();
17871794

17881795
Package::new("bar", "1.0.0").publish(); // trigger a crates-index change.
1789-
p.cargo("fetch").with_stdout("").run();
1796+
p.cargo("fetch").with_stderr("").run();
17901797
}
17911798

17921799
#[cargo_test]

0 commit comments

Comments
 (0)