From: Eric Huss Date: Sat, 21 Apr 2018 17:41:05 +0000 (-0700) Subject: Some test cleanup for profiles. X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~41^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ec7be849e3cc7d206a2f511bf1b939f5530b9351;p=cargo.git Some test cleanup for profiles. --- diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs index d9ecfb5c8..f4e49e711 100644 --- a/tests/testsuite/check.rs +++ b/tests/testsuite/check.rs @@ -755,9 +755,8 @@ fn check_filters() { .with_stderr_does_not_contain("[..]unused_normal_ex1[..]") .with_stderr_does_not_contain("[..]unused_unit_ex1[..]") .with_stderr_does_not_contain("[..]unused_normal_b1[..]") - .with_stderr_does_not_contain("[..]unused_unit_b1[..]"), - // with_stderr_does_not_contain --crate-type lib - // with_stderr_does_not_contain --crate-type bin + .with_stderr_does_not_contain("[..]unused_unit_b1[..]") + .with_stderr_does_not_contain("[..]--crate-type bin[..]"), ); p.root().join("target").rm_rf(); assert_that( @@ -765,9 +764,9 @@ fn check_filters() { execs() .with_status(0) .with_stderr_contains("[..]unused_normal_lib[..]") - // .with_stderr_contains("[..]unused_normal_bin[..]") .with_stderr_contains("[..]unused_unit_t1[..]") .with_stderr_does_not_contain("[..]unused_unit_lib[..]") + .with_stderr_does_not_contain("[..]unused_normal_bin[..]") .with_stderr_does_not_contain("[..]unused_unit_bin[..]") .with_stderr_does_not_contain("[..]unused_normal_ex1[..]") .with_stderr_does_not_contain("[..]unused_normal_b1[..]") diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 3b94f5f05..9ff31d66a 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -268,9 +268,6 @@ fn changing_profiles_caches_targets() { [profile.dev] panic = "abort" - - [profile.test] - panic = "unwind" "#, ) .file("src/lib.rs", "") diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index c53354075..00f1340ee 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -421,6 +421,9 @@ fn profile_override_basic() { [dependencies] bar = {path = "bar"} + [profile.dev] + opt-level = 1 + [profile.dev.overrides.bar] opt-level = 3 "#, @@ -433,15 +436,12 @@ fn profile_override_basic() { assert_that( p.cargo("build -v").masquerade_as_nightly_cargo(), execs().with_status(0).with_stderr( -"[COMPILING] bar [..] + "[COMPILING] bar [..] [RUNNING] `rustc --crate-name bar [..] -C opt-level=3 [..]` [COMPILING] foo [..] -[RUNNING] `rustc --crate-name foo [..]` -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", - ) - // TODO: does_not_contain does not support patterns! - // .with_stderr_does_not_contain("\ - // `rustc --crate-name bar[..]-C opt-level=3"), +[RUNNING] `rustc --crate-name foo [..] -C opt-level=1 [..]` +[FINISHED] dev [optimized + debuginfo] target(s) in [..]", + ), ); } diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 19afe54cc..925aa3b55 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -1644,12 +1644,10 @@ fn test_run_implicit_test_target() { .file("benches/mybench.rs", "#[test] fn test_in_bench() { }") .file( "examples/myexm.rs", - "#[test] fn test_in_exm() { } - fn main() { panic!(\"Don't execute me!\"); }", + "fn main() { compile_error!(\"Don't build me!\"); }", ) .build(); - // TODO FIXME: This needs to better verify that examples are not built. assert_that( prj.cargo("test").arg("--tests"), execs() @@ -1691,8 +1689,7 @@ fn test_run_implicit_bench_target() { .file("benches/mybench.rs", "#[test] fn test_in_bench() { }") .file( "examples/myexm.rs", - "#[test] fn test_in_exm() { } - fn main() { panic!(\"Don't execute me!\"); }", + "fn main() { compile_error!(\"Don't build me!\"); }", ) .build(); @@ -1737,12 +1734,11 @@ fn test_run_implicit_example_target() { .file("benches/mybench.rs", "#[test] fn test_in_bench() { }") .file( "examples/myexm.rs", - "#[test] fn test_in_exm() { } - fn main() { panic!(\"Don't execute me!\"); }", + r#"#[test] fn test_in_exm() { panic!("Don't even test me."); } + fn main() { panic!("Don't execute me!"); }"#, ) .build(); - // TODO FIXME - verify example does NOT get run. assert_that( prj.cargo("test").arg("--examples"), execs().with_status(0).with_stderr(format!(