Skip to content

Commit dba5870

Browse files
committed
Auto merge of #7408 - ehuss:fix-xcompile-tests, r=alexcrichton
Fix xcompile tests. The new xcompile tests weren't checking whether or not cross-compiling is disabled. Cross doesn't work on modern macos/xcode, so these were failing for me. Also includes some minor formatting changes.
2 parents da99127 + 4850f9b commit dba5870

File tree

1 file changed

+25
-43
lines changed

1 file changed

+25
-43
lines changed

tests/testsuite/test.rs

+25-43
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::fs::File;
1+
use std::fs::{self, File};
22
use std::io::prelude::*;
33

44
use cargo;
@@ -3665,6 +3665,7 @@ fn test_dep_with_dev() {
36653665
#[cargo_test]
36663666
fn cargo_test_doctest_xcompile_ignores() {
36673667
if !is_nightly() {
3668+
// -Zdoctest-xcompile is unstable
36683669
return;
36693670
}
36703671
let p = project()
@@ -3686,45 +3687,41 @@ fn cargo_test_doctest_xcompile_ignores() {
36863687
#[cfg(not(target_arch = "x86_64"))]
36873688
p.cargo("test")
36883689
.with_stdout_contains(
3689-
"\
3690-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
3691-
",
3690+
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
36923691
)
36933692
.run();
36943693
#[cfg(target_arch = "x86_64")]
36953694
p.cargo("test")
36963695
.with_status(101)
36973696
.with_stdout_contains(
3698-
"\
3699-
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out\
3700-
",
3697+
"test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out",
37013698
)
37023699
.run();
37033700

37043701
#[cfg(not(target_arch = "x86_64"))]
37053702
p.cargo("test -Zdoctest-xcompile")
37063703
.masquerade_as_nightly_cargo()
37073704
.with_stdout_contains(
3708-
"\
3709-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
3710-
",
3705+
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
37113706
)
37123707
.run();
37133708

37143709
#[cfg(target_arch = "x86_64")]
37153710
p.cargo("test -Zdoctest-xcompile")
37163711
.masquerade_as_nightly_cargo()
37173712
.with_stdout_contains(
3718-
"\
3719-
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out\
3720-
",
3713+
"test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out",
37213714
)
37223715
.run();
37233716
}
37243717

37253718
#[cargo_test]
37263719
fn cargo_test_doctest_xcompile() {
3720+
if cross_compile::disabled() {
3721+
return;
3722+
}
37273723
if !is_nightly() {
3724+
// -Zdoctest-xcompile is unstable
37283725
return;
37293726
}
37303727
let p = project()
@@ -3745,29 +3742,26 @@ fn cargo_test_doctest_xcompile() {
37453742

37463743
p.cargo("build").run();
37473744
p.cargo(&format!("test --target {}", cross_compile::alternate()))
3748-
.with_stdout_contains(
3749-
"\
3750-
running 0 tests\
3751-
",
3752-
)
3745+
.with_stdout_contains("running 0 tests")
37533746
.run();
37543747
p.cargo(&format!(
37553748
"test --target {} -Zdoctest-xcompile",
37563749
cross_compile::alternate()
37573750
))
37583751
.masquerade_as_nightly_cargo()
37593752
.with_stdout_contains(
3760-
"\
3761-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
3762-
",
3753+
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
37633754
)
37643755
.run();
37653756
}
37663757

37673758
#[cargo_test]
37683759
fn cargo_test_doctest_xcompile_runner() {
3769-
use std::fs;
3760+
if cross_compile::disabled() {
3761+
return;
3762+
}
37703763
if !is_nightly() {
3764+
// -Zdoctest-xcompile is unstable
37713765
return;
37723766
}
37733767

@@ -3824,33 +3818,27 @@ runner = "{}"
38243818

38253819
p.cargo("build").run();
38263820
p.cargo(&format!("test --target {}", cross_compile::alternate()))
3827-
.with_stdout_contains(
3828-
"\
3829-
running 0 tests\
3830-
",
3831-
)
3821+
.with_stdout_contains("running 0 tests")
38323822
.run();
38333823
p.cargo(&format!(
38343824
"test --target {} -Zdoctest-xcompile",
38353825
cross_compile::alternate()
38363826
))
38373827
.masquerade_as_nightly_cargo()
38383828
.with_stdout_contains(
3839-
"\
3840-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
3841-
",
3842-
)
3843-
.with_stderr_contains(
3844-
"\
3845-
this is a runner\
3846-
",
3829+
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
38473830
)
3831+
.with_stderr_contains("this is a runner")
38483832
.run();
38493833
}
38503834

38513835
#[cargo_test]
38523836
fn cargo_test_doctest_xcompile_no_runner() {
3837+
if cross_compile::disabled() {
3838+
return;
3839+
}
38533840
if !is_nightly() {
3841+
// -Zdoctest-xcompile is unstable
38543842
return;
38553843
}
38563844

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

38733861
p.cargo("build").run();
38743862
p.cargo(&format!("test --target {}", cross_compile::alternate()))
3875-
.with_stdout_contains(
3876-
"\
3877-
running 0 tests\
3878-
",
3879-
)
3863+
.with_stdout_contains("running 0 tests")
38803864
.run();
38813865
p.cargo(&format!(
38823866
"test --target {} -Zdoctest-xcompile",
38833867
cross_compile::alternate()
38843868
))
38853869
.masquerade_as_nightly_cargo()
38863870
.with_stdout_contains(
3887-
"\
3888-
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\
3889-
",
3871+
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out",
38903872
)
38913873
.run();
38923874
}

0 commit comments

Comments
 (0)