Some test cleanup for profiles.
authorEric Huss <eric@huss.org>
Sat, 21 Apr 2018 17:41:05 +0000 (10:41 -0700)
committerEric Huss <eric@huss.org>
Fri, 27 Apr 2018 20:42:30 +0000 (13:42 -0700)
tests/testsuite/check.rs
tests/testsuite/freshness.rs
tests/testsuite/profiles.rs
tests/testsuite/test.rs

index d9ecfb5c8e9ecf824ad4b3f70990f0ce93c3f2f1..f4e49e711d4c81777e47e4e5c8ed5390212ebd95 100644 (file)
@@ -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[..]")
index 3b94f5f05d6cfc469f5160e498b6efcc225f703c..9ff31d66afea41f40bb85aab1069ddce7622189a 100644 (file)
@@ -268,9 +268,6 @@ fn changing_profiles_caches_targets() {
 
             [profile.dev]
             panic = "abort"
-
-            [profile.test]
-            panic = "unwind"
         "#,
         )
         .file("src/lib.rs", "")
index c53354075aa6d578c03aa59643c1b1d9ca8d9ce6..00f1340ee1a87beefe08d6b723961f754f969d1a 100644 (file)
@@ -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 [..]",
+        ),
     );
 }
 
index 19afe54cc8ca51c793daf2a0a2543937d34d2ede..925aa3b55aaefeefbb44cfcc14983e6919b2d12c 100644 (file)
@@ -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!(