Skip to content

Commit 0bc1155

Browse files
committed
Split tests, apparently cargo clean does not work well on windows
1 parent ce26ddf commit 0bc1155

File tree

3 files changed

+68
-26
lines changed

3 files changed

+68
-26
lines changed

tests/testsuite/build.rs

+23-8
Original file line numberDiff line numberDiff line change
@@ -5337,7 +5337,7 @@ fn build_filter_infer_profile() {
53375337
}
53385338

53395339
#[test]
5340-
fn all_targets_with_and_without() {
5340+
fn targets_selected_default() {
53415341
let p = project("foo")
53425342
.file(
53435343
"Cargo.toml",
@@ -5351,35 +5351,50 @@ fn all_targets_with_and_without() {
53515351
.file("src/main.rs", "fn main() {}")
53525352
.build();
53535353
assert_that(
5354-
p.cargo("build").arg("-v").arg("--all-targets"),
5354+
p.cargo("build").arg("-v"),
53555355
execs().with_status(0)
53565356
// bin
53575357
.with_stderr_contains("\
53585358
[RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
53595359
--emit=dep-info,link[..]")
53605360
// bench
5361-
.with_stderr_contains("\
5361+
.with_stderr_does_not_contain("\
53625362
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
53635363
-C opt-level=3 --test [..]")
53645364
// unit test
5365-
.with_stderr_contains("\
5365+
.with_stderr_does_not_contain("\
53665366
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
53675367
-C debuginfo=2 --test [..]"),
53685368
);
5369-
assert_that(p.cargo("clean"), execs().with_status(0));
5369+
}
5370+
5371+
#[test]
5372+
fn targets_selected_all() {
5373+
let p = project("foo")
5374+
.file(
5375+
"Cargo.toml",
5376+
r#"
5377+
[package]
5378+
name = "foo"
5379+
version = "0.1.0"
5380+
authors = []
5381+
"#,
5382+
)
5383+
.file("src/main.rs", "fn main() {}")
5384+
.build();
53705385
assert_that(
5371-
p.cargo("build").arg("-v"),
5386+
p.cargo("build").arg("-v").arg("--all-targets"),
53725387
execs().with_status(0)
53735388
// bin
53745389
.with_stderr_contains("\
53755390
[RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
53765391
--emit=dep-info,link[..]")
53775392
// bench
5378-
.with_stderr_does_not_contain("\
5393+
.with_stderr_contains("\
53795394
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
53805395
-C opt-level=3 --test [..]")
53815396
// unit test
5382-
.with_stderr_does_not_contain("\
5397+
.with_stderr_contains("\
53835398
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
53845399
-C debuginfo=2 --test [..]"),
53855400
);

tests/testsuite/check.rs

+22-10
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ fn check_virtual_all_implied() {
606606
}
607607

608608
#[test]
609-
fn all_targets_with_and_without() {
609+
fn targets_selected_default() {
610610
let foo = project("foo")
611611
.file("Cargo.toml", SIMPLE_MANIFEST)
612612
.file("src/main.rs", "fn main() {}")
@@ -617,25 +617,37 @@ fn all_targets_with_and_without() {
617617
.build();
618618

619619
assert_that(
620-
foo.cargo("check").arg("--all-targets").arg("-v"),
620+
foo.cargo("check").arg("-v"),
621621
execs()
622622
.with_status(0)
623623
.with_stderr_contains("[..] --crate-name foo src[/]lib.rs [..]")
624624
.with_stderr_contains("[..] --crate-name foo src[/]main.rs [..]")
625-
.with_stderr_contains("[..] --crate-name example1 examples[/]example1.rs [..]")
626-
.with_stderr_contains("[..] --crate-name test2 tests[/]test2.rs [..]")
627-
.with_stderr_contains("[..] --crate-name bench3 benches[/]bench3.rs [..]"),
625+
.with_stderr_does_not_contain("[..] --crate-name example1 examples[/]example1.rs [..]")
626+
.with_stderr_does_not_contain("[..] --crate-name test2 tests[/]test2.rs [..]")
627+
.with_stderr_does_not_contain("[..] --crate-name bench3 benches[/]bench3.rs [..]"),
628628
);
629-
assert_that(foo.cargo("clean"), execs().with_status(0));
629+
}
630+
631+
#[test]
632+
fn targets_selected_all() {
633+
let foo = project("foo")
634+
.file("Cargo.toml", SIMPLE_MANIFEST)
635+
.file("src/main.rs", "fn main() {}")
636+
.file("src/lib.rs", "pub fn smth() {}")
637+
.file("examples/example1.rs", "fn main() {}")
638+
.file("tests/test2.rs", "#[test] fn t() {}")
639+
.file("benches/bench3.rs", "")
640+
.build();
641+
630642
assert_that(
631-
foo.cargo("check").arg("-v"),
643+
foo.cargo("check").arg("--all-targets").arg("-v"),
632644
execs()
633645
.with_status(0)
634646
.with_stderr_contains("[..] --crate-name foo src[/]lib.rs [..]")
635647
.with_stderr_contains("[..] --crate-name foo src[/]main.rs [..]")
636-
.with_stderr_does_not_contain("[..] --crate-name example1 examples[/]example1.rs [..]")
637-
.with_stderr_does_not_contain("[..] --crate-name test2 tests[/]test2.rs [..]")
638-
.with_stderr_does_not_contain("[..] --crate-name bench3 benches[/]bench3.rs [..]"),
648+
.with_stderr_contains("[..] --crate-name example1 examples[/]example1.rs [..]")
649+
.with_stderr_contains("[..] --crate-name test2 tests[/]test2.rs [..]")
650+
.with_stderr_contains("[..] --crate-name bench3 benches[/]bench3.rs [..]"),
639651
);
640652
}
641653

tests/testsuite/rustc.rs

+23-8
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ fn build_only_bar_dependency() {
438438
}
439439

440440
#[test]
441-
fn all_targets_with_and_without() {
441+
fn targets_selected_default() {
442442
let p = project("foo")
443443
.file(
444444
"Cargo.toml",
@@ -452,35 +452,50 @@ fn all_targets_with_and_without() {
452452
.file("src/main.rs", "fn main() {}")
453453
.build();
454454
assert_that(
455-
p.cargo("rustc").arg("-v").arg("--all-targets"),
455+
p.cargo("rustc").arg("-v"),
456456
execs().with_status(0)
457457
// bin
458458
.with_stderr_contains("\
459459
[RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
460460
--emit=dep-info,link[..]")
461461
// bench
462-
.with_stderr_contains("\
462+
.with_stderr_does_not_contain("\
463463
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
464464
-C opt-level=3 --test [..]")
465465
// unit test
466-
.with_stderr_contains("\
466+
.with_stderr_does_not_contain("\
467467
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
468468
-C debuginfo=2 --test [..]"),
469469
);
470-
assert_that(p.cargo("clean"), execs().with_status(0));
470+
}
471+
472+
#[test]
473+
fn targets_selected_all() {
474+
let p = project("foo")
475+
.file(
476+
"Cargo.toml",
477+
r#"
478+
[package]
479+
name = "foo"
480+
version = "0.1.0"
481+
authors = []
482+
"#,
483+
)
484+
.file("src/main.rs", "fn main() {}")
485+
.build();
471486
assert_that(
472-
p.cargo("rustc").arg("-v"),
487+
p.cargo("rustc").arg("-v").arg("--all-targets"),
473488
execs().with_status(0)
474489
// bin
475490
.with_stderr_contains("\
476491
[RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
477492
--emit=dep-info,link[..]")
478493
// bench
479-
.with_stderr_does_not_contain("\
494+
.with_stderr_contains("\
480495
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
481496
-C opt-level=3 --test [..]")
482497
// unit test
483-
.with_stderr_does_not_contain("\
498+
.with_stderr_contains("\
484499
[RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
485500
-C debuginfo=2 --test [..]"),
486501
);

0 commit comments

Comments
 (0)