diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index c177f4da304..58246eb04f4 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1769,15 +1769,8 @@ test!(transitive_dependencies_not_available { assert_that(p.cargo_process("build").arg("-v"), execs().with_status(101) - .with_stderr("\ + .with_stderr_contains("\ [..] can't find crate for `bbbbb`[..] -[..] extern crate bbbbb; [..] -[..] -error: aborting due to previous error -[ERROR] Could not compile `foo`. - -Caused by: - [..] ")); }); diff --git a/tests/test_cargo_compile_path_deps.rs b/tests/test_cargo_compile_path_deps.rs index 896ed56caaa..d411aa18126 100644 --- a/tests/test_cargo_compile_path_deps.rs +++ b/tests/test_cargo_compile_path_deps.rs @@ -476,7 +476,7 @@ test!(nested_deps_recompile { [COMPILING] foo v0.5.0 ({})\n", bar, p.url()))); - p.root().move_into_the_past().unwrap(); + ::sleep_ms(1000); File::create(&p.root().join("src/foo.rs")).unwrap().write_all(br#" fn main() {} diff --git a/tests/test_cargo_cross_compile.rs b/tests/test_cargo_cross_compile.rs index 2138bc84e97..da4397e9ced 100644 --- a/tests/test_cargo_cross_compile.rs +++ b/tests/test_cargo_cross_compile.rs @@ -347,7 +347,7 @@ test!(linker_and_ar { assert_that(p.cargo_process("build").arg("--target").arg(&target) .arg("-v"), execs().with_status(101) - .with_stderr(&format!("\ + .with_stderr_contains(&format!("\ [COMPILING] foo v0.5.0 ({url}) [RUNNING] `rustc src[..]foo.rs --crate-name foo --crate-type bin -g \ --out-dir {dir}[..]target[..]{target}[..]debug \ @@ -499,41 +499,28 @@ test!(no_cross_doctests { let host_output = format!("\ [COMPILING] foo v0.0.0 ({foo}) [RUNNING] target[..]foo-[..] - -running 0 tests - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured - [DOCTEST] foo - -running 1 test -test _0 ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured - ", foo = p.url()); + println!("a"); assert_that(p.cargo_process("test"), execs().with_status(0) - .with_stdout(&host_output)); + .with_stderr(&host_output)); + println!("b"); let target = host(); assert_that(p.cargo_process("test").arg("--target").arg(&target), execs().with_status(0) - .with_stdout(&host_output)); + .with_stderr(&host_output)); + println!("c"); let target = alternate(); assert_that(p.cargo_process("test").arg("--target").arg(&target), execs().with_status(0) .with_stderr(&format!("\ [COMPILING] foo v0.0.0 ({foo}) -[RUNNING] target[..]{triple}[..]foo-[..]", foo = p.url(), triple = target)) - .with_stdout(" -running 0 tests - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured - -")); +[RUNNING] target[..]{triple}[..]foo-[..] +", foo = p.url(), triple = target))); }); test!(simple_cargo_run { @@ -888,16 +875,8 @@ test!(platform_specific_dependencies_do_not_leak { assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target), execs().with_status(101) - .with_stderr("\ -[..] error: can't find crate for `d2`[..] -[..] extern crate d2; -[..] -error: aborting due to previous error -[ERROR] Could not compile `d1`. - -Caused by: - [..] -")); + .with_stderr_contains("\ +[..] error: can't find crate for `d2`[..]")); }); test!(platform_specific_variables_reflected_in_build_scripts { diff --git a/tests/test_cargo_rustc.rs b/tests/test_cargo_rustc.rs index 7301d6a5289..3d76f22a6f8 100644 --- a/tests/test_cargo_rustc.rs +++ b/tests/test_cargo_rustc.rs @@ -38,7 +38,7 @@ test!(build_lib_for_foo { dir = p.root().display(), url = p.url()))); }); -test!(build_lib_and_allow_unstable_options { +test!(lib { let p = project("foo") .file("Cargo.toml", r#" [package] @@ -52,13 +52,13 @@ test!(build_lib_and_allow_unstable_options { .file("src/lib.rs", r#" "#); assert_that(p.cargo_process("rustc").arg("--lib").arg("-v") - .arg("--").arg("-Z").arg("unstable-options"), + .arg("--").arg("-C").arg("debug-assertions=off"), execs() .with_status(0) .with_stderr(format!("\ [COMPILING] foo v0.0.1 ({url}) [RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ - -Z unstable-options \ + -C debug-assertions=off \ --out-dir {dir}{sep}target{sep}debug \ --emit=dep-info,link \ -L dependency={dir}{sep}target{sep}debug \ @@ -81,7 +81,7 @@ test!(build_main_and_allow_unstable_options { .file("src/lib.rs", r#" "#); assert_that(p.cargo_process("rustc").arg("-v").arg("--bin").arg("foo") - .arg("--").arg("-Z").arg("unstable-options"), + .arg("--").arg("-C").arg("debug-assertions"), execs() .with_status(0) .with_stderr(&format!("\ @@ -92,7 +92,7 @@ test!(build_main_and_allow_unstable_options { -L dependency={dir}{sep}target{sep}debug \ -L dependency={dir}{sep}target{sep}debug{sep}deps` [RUNNING] `rustc src{sep}main.rs --crate-name {name} --crate-type bin -g \ - -Z unstable-options \ + -C debug-assertions \ --out-dir {dir}{sep}target{sep}debug \ --emit=dep-info,link \ -L dependency={dir}{sep}target{sep}debug \ @@ -117,7 +117,7 @@ test!(fails_when_trying_to_build_main_and_lib_with_args { .file("src/lib.rs", r#" "#); assert_that(p.cargo_process("rustc").arg("-v") - .arg("--").arg("-Z").arg("unstable-options"), + .arg("--").arg("-C").arg("debug-assertions"), execs() .with_status(101) .with_stderr(CARGO_RUSTC_ERROR)); @@ -143,7 +143,7 @@ test!(build_with_args_to_one_of_multiple_binaries { .file("src/lib.rs", r#" "#); assert_that(p.cargo_process("rustc").arg("-v").arg("--bin").arg("bar") - .arg("--").arg("-Z").arg("unstable-options"), + .arg("--").arg("-C").arg("debug-assertions"), execs() .with_status(0) .with_stderr(format!("\ @@ -151,7 +151,7 @@ test!(build_with_args_to_one_of_multiple_binaries { [RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ --out-dir {dir}{sep}target{sep}debug [..]` [RUNNING] `rustc src{sep}bin{sep}bar.rs --crate-name bar --crate-type bin -g \ - -Z unstable-options [..]` + -C debug-assertions [..]` ", sep = SEP, dir = p.root().display(), url = p.url()))); }); @@ -176,7 +176,7 @@ test!(fails_with_args_to_all_binaries { .file("src/lib.rs", r#" "#); assert_that(p.cargo_process("rustc").arg("-v") - .arg("--").arg("-Z").arg("unstable-options"), + .arg("--").arg("-C").arg("debug-assertions"), execs() .with_status(101) .with_stderr(CARGO_RUSTC_ERROR)); @@ -196,7 +196,7 @@ test!(build_with_args_to_one_of_multiple_tests { .file("src/lib.rs", r#" "#); assert_that(p.cargo_process("rustc").arg("-v").arg("--test").arg("bar") - .arg("--").arg("-Z").arg("unstable-options"), + .arg("--").arg("-C").arg("debug-assertions"), execs() .with_status(0) .with_stderr(format!("\ @@ -204,7 +204,7 @@ test!(build_with_args_to_one_of_multiple_tests { [RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ --out-dir {dir}{sep}target{sep}debug [..]` [RUNNING] `rustc tests{sep}bar.rs --crate-name bar --crate-type bin -g \ - -Z unstable-options [..]--test[..]` + -C debug-assertions [..]--test[..]` ", sep = SEP, dir = p.root().display(), url = p.url()))); }); @@ -238,14 +238,14 @@ test!(build_foo_with_bar_dependency { "#); bar.build(); - assert_that(foo.cargo_process("rustc").arg("-v").arg("--").arg("-Z").arg("unstable-options"), + assert_that(foo.cargo_process("rustc").arg("-v").arg("--").arg("-C").arg("debug-assertions"), execs() .with_status(0) .with_stderr(format!("\ [COMPILING] bar v0.1.0 ([..]) [RUNNING] `[..] -g -C [..]` [COMPILING] foo v0.0.1 ({url}) -[RUNNING] `[..] -g -Z unstable-options [..]` +[RUNNING] `[..] -g -C debug-assertions [..]` ", url = foo.url()))); }); @@ -280,12 +280,12 @@ test!(build_only_bar_dependency { bar.build(); assert_that(foo.cargo_process("rustc").arg("-v").arg("-p").arg("bar") - .arg("--").arg("-Z").arg("unstable-options"), + .arg("--").arg("-C").arg("debug-assertions"), execs() .with_status(0) .with_stderr("\ [COMPILING] bar v0.1.0 ([..]) -[RUNNING] `[..]--crate-name bar --crate-type lib [..] -Z unstable-options [..]` +[RUNNING] `[..]--crate-name bar --crate-type lib [..] -C debug-assertions [..]` ")); });