Skip to content

Commit

Permalink
Fix up last few remaining tests status-to-stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed May 20, 2016
1 parent 11b38e0 commit 43234cd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 55 deletions.
9 changes: 1 addition & 8 deletions tests/test_cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
[..]
"));
});

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cargo_compile_path_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
41 changes: 10 additions & 31 deletions tests/test_cargo_cross_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
30 changes: 15 additions & 15 deletions tests/test_cargo_rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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 \
Expand All @@ -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!("\
Expand All @@ -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 \
Expand All @@ -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));
Expand All @@ -143,15 +143,15 @@ 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!("\
[COMPILING] foo v0.0.1 ({url})
[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())));
});
Expand All @@ -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));
Expand All @@ -196,15 +196,15 @@ 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!("\
[COMPILING] foo v0.0.1 ({url})
[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())));
});
Expand Down Expand Up @@ -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())));
});
Expand Down Expand Up @@ -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 [..]`
"));
});

Expand Down

0 comments on commit 43234cd

Please sign in to comment.