Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xcompile tests. #7408

Merged
merged 1 commit into from
Sep 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}