Skip to content

Commit

Permalink
Fix xcompile tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Sep 21, 2019
1 parent da99127 commit 4850f9b
Showing 1 changed file with 25 additions and 43 deletions.
68 changes: 25 additions & 43 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fs::File;
use std::fs::{self, File};
use std::io::prelude::*;

use cargo;
Expand Down Expand Up @@ -3665,6 +3665,7 @@ fn test_dep_with_dev() {
#[cargo_test]
fn cargo_test_doctest_xcompile_ignores() {
if !is_nightly() {
// -Zdoctest-xcompile is unstable
return;
}
let p = project()
Expand All @@ -3686,45 +3687,41 @@ fn cargo_test_doctest_xcompile_ignores() {
#[cfg(not(target_arch = "x86_64"))]
p.cargo("test")
.with_stdout_contains(
"\
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
",
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
)
.run();
#[cfg(target_arch = "x86_64")]
p.cargo("test")
.with_status(101)
.with_stdout_contains(
"\
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out\
",
"test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out",
)
.run();

#[cfg(not(target_arch = "x86_64"))]
p.cargo("test -Zdoctest-xcompile")
.masquerade_as_nightly_cargo()
.with_stdout_contains(
"\
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
",
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
)
.run();

#[cfg(target_arch = "x86_64")]
p.cargo("test -Zdoctest-xcompile")
.masquerade_as_nightly_cargo()
.with_stdout_contains(
"\
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out\
",
"test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out",
)
.run();
}

#[cargo_test]
fn cargo_test_doctest_xcompile() {
if cross_compile::disabled() {
return;
}
if !is_nightly() {
// -Zdoctest-xcompile is unstable
return;
}
let p = project()
Expand All @@ -3745,29 +3742,26 @@ fn cargo_test_doctest_xcompile() {

p.cargo("build").run();
p.cargo(&format!("test --target {}", cross_compile::alternate()))
.with_stdout_contains(
"\
running 0 tests\
",
)
.with_stdout_contains("running 0 tests")
.run();
p.cargo(&format!(
"test --target {} -Zdoctest-xcompile",
cross_compile::alternate()
))
.masquerade_as_nightly_cargo()
.with_stdout_contains(
"\
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
",
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
)
.run();
}

#[cargo_test]
fn cargo_test_doctest_xcompile_runner() {
use std::fs;
if cross_compile::disabled() {
return;
}
if !is_nightly() {
// -Zdoctest-xcompile is unstable
return;
}

Expand Down Expand Up @@ -3824,33 +3818,27 @@ runner = "{}"

p.cargo("build").run();
p.cargo(&format!("test --target {}", cross_compile::alternate()))
.with_stdout_contains(
"\
running 0 tests\
",
)
.with_stdout_contains("running 0 tests")
.run();
p.cargo(&format!(
"test --target {} -Zdoctest-xcompile",
cross_compile::alternate()
))
.masquerade_as_nightly_cargo()
.with_stdout_contains(
"\
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
",
)
.with_stderr_contains(
"\
this is a runner\
",
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
)
.with_stderr_contains("this is a runner")
.run();
}

#[cargo_test]
fn cargo_test_doctest_xcompile_no_runner() {
if cross_compile::disabled() {
return;
}
if !is_nightly() {
// -Zdoctest-xcompile is unstable
return;
}

Expand All @@ -3872,21 +3860,15 @@ fn cargo_test_doctest_xcompile_no_runner() {

p.cargo("build").run();
p.cargo(&format!("test --target {}", cross_compile::alternate()))
.with_stdout_contains(
"\
running 0 tests\
",
)
.with_stdout_contains("running 0 tests")
.run();
p.cargo(&format!(
"test --target {} -Zdoctest-xcompile",
cross_compile::alternate()
))
.masquerade_as_nightly_cargo()
.with_stdout_contains(
"\
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
",
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
)
.run();
}

0 comments on commit 4850f9b

Please sign in to comment.