Skip to content

Commit d9cb404

Browse files
committed
tests: produce target artifacts and/or require crate type / ignore cross-compile
Some tests fail on cross-compiled targets due to various linker problems on cross-compiled target, and having test coverage for these against cross-compiled targets is nice but not necessary.
1 parent cb9354a commit d9cb404

File tree

7 files changed

+147
-45
lines changed

7 files changed

+147
-45
lines changed
+27-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,43 @@
1-
use run_make_support::{bin_name, rust_lib_name, rustc};
1+
use run_make_support::{bin_name, rust_lib_name, rustc, target};
22

33
fn main() {
4-
rustc().print("crate-name").input("crate.rs").run().assert_stdout_equals("foo");
5-
rustc().print("file-names").input("crate.rs").run().assert_stdout_equals(bin_name("foo"));
64
rustc()
5+
.target(target())
6+
.print("crate-name")
7+
.input("crate.rs")
8+
.run()
9+
.assert_stdout_equals("foo");
10+
rustc()
11+
.target(target())
12+
.print("file-names")
13+
.input("crate.rs")
14+
.run()
15+
.assert_stdout_equals(bin_name("foo"));
16+
rustc()
17+
.target(target())
718
.print("file-names")
819
.crate_type("lib")
920
.arg("--test")
1021
.input("crate.rs")
1122
.run()
1223
.assert_stdout_equals(bin_name("foo"));
1324
rustc()
25+
.target(target())
1426
.print("file-names")
1527
.arg("--test")
1628
.input("lib.rs")
1729
.run()
1830
.assert_stdout_equals(bin_name("mylib"));
19-
rustc().print("file-names").input("lib.rs").run().assert_stdout_equals(rust_lib_name("mylib"));
20-
rustc().print("file-names").input("rlib.rs").run().assert_stdout_equals(rust_lib_name("mylib"));
31+
rustc()
32+
.target(target())
33+
.print("file-names")
34+
.input("lib.rs")
35+
.run()
36+
.assert_stdout_equals(rust_lib_name("mylib"));
37+
rustc()
38+
.target(target())
39+
.print("file-names")
40+
.input("rlib.rs")
41+
.run()
42+
.assert_stdout_equals(rust_lib_name("mylib"));
2143
}

tests/run-make/crate-name-priority/rmake.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
// and the compiler flags, and checks that the flag is favoured each time.
55
// See https://github.com/rust-lang/rust/pull/15518
66

7-
use run_make_support::{bin_name, rfs, rustc};
7+
//@ ignore-cross-compile (relocations in generic ELF against `arm-unknown-linux-gnueabihf`)
8+
9+
use run_make_support::{bin_name, rfs, rustc, target};
810

911
fn main() {
10-
rustc().input("foo.rs").run();
12+
rustc().target(target()).input("foo.rs").run();
1113
rfs::remove_file(bin_name("foo"));
12-
rustc().input("foo.rs").crate_name("bar").run();
14+
rustc().target(target()).input("foo.rs").crate_name("bar").run();
1315
rfs::remove_file(bin_name("bar"));
14-
rustc().input("foo1.rs").run();
16+
rustc().target(target()).input("foo1.rs").run();
1517
rfs::remove_file(bin_name("foo"));
16-
rustc().input("foo1.rs").output(bin_name("bar1")).run();
18+
rustc().target(target()).input("foo1.rs").output(bin_name("bar1")).run();
1719
rfs::remove_file(bin_name("bar1"));
1820
}

tests/run-make/extra-filename-with-temp-outputs/rmake.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
// are named as expected.
77
// See https://github.com/rust-lang/rust/pull/15686
88

9-
use run_make_support::{bin_name, cwd, has_prefix, has_suffix, rfs, rustc, shallow_find_files};
9+
//@ ignore-cross-compile (relocations in generic ELF against `arm-unknown-linux-gnueabihf`)
10+
11+
use run_make_support::{
12+
bin_name, cwd, has_prefix, has_suffix, rfs, rustc, shallow_find_files, target,
13+
};
1014

1115
fn main() {
12-
rustc().extra_filename("bar").input("foo.rs").arg("-Csave-temps").run();
16+
rustc().target(target()).extra_filename("bar").input("foo.rs").arg("-Csave-temps").run();
1317
let object_files = shallow_find_files(cwd(), |path| {
1418
has_prefix(path, "foobar.foo") && has_suffix(path, "0.rcgu.o")
1519
});

0 commit comments

Comments
 (0)