Skip to content

Commit 4362789

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 4193132 commit 4362789

File tree

7 files changed

+41
-6
lines changed

7 files changed

+41
-6
lines changed

Diff for: tests/run-make/crate-data-smoke/rmake.rs

+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
}

Diff for: tests/run-make/crate-name-priority/rmake.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
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+
//@ ignore-cross-compile (relocations in generic ELF against `arm-unknown-linux-gnueabihf`)
8+
79
use run_make_support::{bin_name, rfs, rustc};
810

911
fn main() {

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

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

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

1113
fn main() {

Diff for: tests/run-make/output-type-permutations/rmake.rs

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// files are exactly what is expected, no more, no less.
55
// See https://github.com/rust-lang/rust/pull/12020
66

7+
//@ ignore-cross-compile
8+
// Reason: some cross-compiled targets don't support various crate types and fail to link.
9+
710
use std::path::PathBuf;
811

912
use run_make_support::{
@@ -17,6 +20,7 @@ use run_make_support::{
1720
// `dir`: the name of the directory where the test happens
1821
// `rustc_invocation`: the rustc command being tested
1922
// Any unexpected output files not listed in `must_exist` or `can_exist` will cause a failure.
23+
#[track_caller]
2024
fn assert_expected_output_files(expectations: Expectations, rustc_invocation: impl Fn()) {
2125
let Expectations { expected_files: must_exist, allowed_files: can_exist, test_dir: dir } =
2226
expectations;

Diff for: tests/run-make/reproducible-build/rmake.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
// See https://github.com/rust-lang/rust/pull/32293
2121
// Tracking Issue: https://github.com/rust-lang/rust/issues/129080
2222

23+
//@ ignore-cross-compile (linker binary needs to run)
24+
2325
use run_make_support::{
2426
bin_name, cwd, diff, is_darwin, is_windows, regex, rfs, run_in_tmpdir, rust_lib_name, rustc,
2527
};

Diff for: tests/run-make/strip/rmake.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//@ ignore-windows Windows does not actually strip
1+
//@ ignore-windows (Windows does not actually strip)
2+
//@ ignore-cross-compile (relocations in generic ELF against `arm-unknown-linux-gnueabihf`)
23

34
// Test that -Cstrip correctly strips/preserves debuginfo and symbols.
45

Diff for: tests/run-make/symbols-all-mangled/rmake.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Check that all symbols in cdylibs, staticlibs and bins are mangled
22
//@ only-elf some object file formats create multiple symbols for each function with different names
3+
//@ ignore-nvptx64 (needs target std)
4+
//@ ignore-cross-compile (host-only)
35

46
use run_make_support::object::read::{Object, ObjectSymbol};
57
use run_make_support::{bin_name, dynamic_lib_name, object, rfs, rustc, static_lib_name};

0 commit comments

Comments
 (0)