Skip to content

Commit 5b2e664

Browse files
committed
Repair some run-make tests on cross-compile
1 parent 464c5c7 commit 5b2e664

File tree

39 files changed

+108
-16
lines changed

39 files changed

+108
-16
lines changed

tests/run-make/doctests-merge/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ ignore-cross-compile (needs to run doctests)
2+
13
use std::path::Path;
24

35
use run_make_support::{cwd, diff, rustc, rustdoc};

tests/run-make/doctests-runtool/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ ignore-cross-compile (needs to run host tool binary)
2+
13
// Tests behavior of rustdoc `--test-runtool`.
24

35
use std::path::PathBuf;

tests/run-make/embed-metadata/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ needs-target-std
2+
//@ needs-crate-type: dylib
3+
14
// Tests the -Zembed-metadata compiler flag.
25
// Tracking issue: https://github.com/rust-lang/rust/issues/139165
36

tests/run-make/embed-source-dwarf/rmake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ ignore-windows
22
//@ ignore-apple
3+
//@ ignore-wasm (`object` doesn't handle wasm object files)
34

45
// This test should be replaced with one in tests/debuginfo once we can easily
56
// tell via GDB or LLDB if debuginfo contains source code. Cheap tricks in LLDB

tests/run-make/emit-shared-files/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// `all-shared` should only emit files that can be shared between crates.
66
// See https://github.com/rust-lang/rust/pull/83478
77

8+
//@ needs-target-std
9+
810
use run_make_support::{has_extension, has_prefix, path, rustdoc, shallow_find_files};
911

1012
fn main() {

tests/run-make/emit-stack-sizes/rmake.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// this diagnostics information should be located.
77
// See https://github.com/rust-lang/rust/pull/51946
88

9-
//@ ignore-windows
10-
//@ ignore-apple
9+
//@ needs-target-std
10+
//@ only-elf
1111
// Reason: this feature only works when the output object format is ELF.
1212
// This won't be the case on Windows/OSX - for example, OSX produces a Mach-O binary.
1313

tests/run-make/env-dep-info/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ needs-target-std
2+
//@ needs-crate-type: proc-macro
3+
14
// Inside dep-info emit files, #71858 made it so all accessed environment
25
// variables are usefully printed. This test checks that this feature works
36
// as intended by checking if the environment variables used in compilation

tests/run-make/export/disambiguator/rmake.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//@ needs-target-std
2+
3+
// NOTE: `sdylib`'s platform support is basically just `dylib`'s platform support.
4+
//@ needs-crate-type: dylib
5+
16
use run_make_support::rustc;
27

38
fn main() {

tests/run-make/export/extern-opt/rmake.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
use run_make_support::{rustc, dynamic_lib_name};
1+
//@ needs-target-std
2+
3+
// NOTE: `sdylib`'s platform support is basically that of `dylib`.
4+
//@ needs-crate-type: dylib
5+
6+
use run_make_support::{dynamic_lib_name, rustc};
27

38
fn main() {
49
rustc()

tests/run-make/export/simple/rmake.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//@ needs-target-std
2+
3+
// NOTE: `sdylib`'s platform support is basically that of `dylib`.
4+
//@ needs-crate-type: dylib
5+
16
use run_make_support::rustc;
27

38
fn main() {

tests/run-make/invalid-so/rmake.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//@ needs-target-std
2+
//@ needs-crate-type: dylib
3+
//@ needs-dynamic-linking
4+
15
// When a fake library was given to the compiler, it would
26
// result in an obscure and unhelpful error message. This test
37
// creates a false "foo" dylib, and checks that the standard error

tests/run-make/link-args-order/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ needs-target-std
2+
//@ ignore-wasm (explicit linker invocations)
3+
14
// Passing linker arguments to the compiler used to be lost or reordered in a messy way
25
// as they were passed further to the linker. This was fixed in #70665, and this test
36
// checks that linker arguments remain intact and in the order they were originally passed in.

tests/run-make/link-dedup/rmake.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ needs-target-std
2+
13
// When native libraries are passed to the linker, there used to be an annoyance
24
// where multiple instances of the same library in a row would cause duplication in
35
// outputs. This has been fixed, and this test checks that it stays fixed.
@@ -7,7 +9,7 @@
79

810
use std::fmt::Write;
911

10-
use run_make_support::{is_msvc, rustc};
12+
use run_make_support::{is_msvc, rustc, target};
1113

1214
fn main() {
1315
rustc().input("depa.rs").run();
@@ -31,9 +33,11 @@ fn needle_from_libs(libs: &[&str]) -> String {
3133
let mut needle = String::new();
3234
for lib in libs {
3335
if is_msvc() {
34-
let _ = needle.write_fmt(format_args!(r#""{lib}.lib" "#));
36+
needle.write_fmt(format_args!(r#""{lib}.lib" "#)).unwrap();
37+
} else if target().contains("wasm") {
38+
needle.write_fmt(format_args!(r#""-l" "{lib}" "#)).unwrap();
3539
} else {
36-
let _ = needle.write_fmt(format_args!(r#""-l{lib}" "#));
40+
needle.write_fmt(format_args!(r#""-l{lib}" "#)).unwrap();
3741
}
3842
}
3943
needle.pop(); // remove trailing space

tests/run-make/linker-warning/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ ignore-cross-compile (need to run fake linker)
2+
13
use run_make_support::{Rustc, diff, regex, rustc};
24

35
fn run_rustc() -> Rustc {

tests/run-make/native-link-modifier-verbatim-linker/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
// This test is the same as native-link-modifier-rustc, but without rlibs.
44
// See https://github.com/rust-lang/rust/issues/99425
55

6+
//@ needs-target-std
7+
68
//@ ignore-apple
9+
//@ ignore-wasm
710
// Reason: linking fails due to the unusual ".ext" staticlib name.
811

912
use run_make_support::rustc;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
CHECK: declare void @foo()
1+
CHECK: declare{{.*}} void @foo()
22
CHECK-SAME: #[[ATTR_3:[0-9]+]]
33

4-
CHECK: attributes #[[ATTR_3]]
4+
CHECK: attributes #[[ATTR_3]]
55
CHECK-SAME: no-builtins

tests/run-make/no-builtins-attribute/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ needs-target-std
2+
13
// `no_builtins` is an attribute related to LLVM's optimizations. In order to ensure that it has an
24
// effect on link-time optimizations (LTO), it should be added to function declarations in a crate.
35
// This test uses the `llvm-filecheck` tool to determine that this attribute is successfully
@@ -9,5 +11,6 @@ use run_make_support::{llvm_filecheck, rfs, rustc};
911
fn main() {
1012
rustc().input("no_builtins.rs").emit("link").run();
1113
rustc().input("main.rs").emit("llvm-ir").run();
14+
1215
llvm_filecheck().patterns("filecheck.main.txt").stdin_buf(rfs::read("main.ll")).run();
1316
}

tests/run-make/proc-macro-three-crates/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ needs-target-std
2+
//@ needs-crate-type: proc-macro
3+
14
// A compiler bug caused the following issue:
25
// If a crate A depends on crate B, and crate B
36
// depends on crate C, and crate C contains a procedural

tests/run-make/repr128-dwarf/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ needs-target-std
2+
//@ ignore-wasm (`object` can't handle wasm object files)
13
//@ ignore-windows
24
// This test should be replaced with one in tests/debuginfo once GDB or LLDB support 128-bit enums.
35

tests/run-make/rustc-macro-dep-files/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ needs-target-std
2+
//@ needs-crate-type: proc-macro
3+
14
// --emit dep-info used to print all macro-generated code it could
25
// find as if it was part of a nonexistent file named "proc-macro source",
36
// which is not a valid path. After this was fixed in #36776, this test checks

tests/run-make/rustdoc-default-output/rmake.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// ensures the output of rustdoc's help menu is as expected.
44
// See https://github.com/rust-lang/rust/issues/88756
55

6-
use run_make_support::{diff, rustdoc};
6+
use run_make_support::{bare_rustdoc, diff};
77

88
fn main() {
9-
let out = rustdoc().run().stdout_utf8();
9+
let out = bare_rustdoc().run().stdout_utf8();
1010
diff()
1111
.expected_file("output-default.stdout")
1212
.actual_text("actual", out)

tests/run-make/rustdoc-dep-info/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// This is a simple smoke test for rustdoc's `--emit dep-info` feature. It prints out
22
// information about dependencies in a Makefile-compatible format, as a `.d` file.
33

4+
//@ needs-target-std
5+
46
use run_make_support::assertion_helpers::assert_contains;
57
use run_make_support::{path, rfs, rustdoc};
68

tests/run-make/rustdoc-determinism/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Assert that the search index is generated deterministically, regardless of the
22
// order that crates are documented in.
33

4+
//@ needs-target-std
5+
46
use run_make_support::{diff, path, rustdoc};
57

68
fn main() {

tests/run-make/rustdoc-error-lines/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Assert that the search index is generated deterministically, regardless of the
22
// order that crates are documented in.
33

4+
//@ needs-target-std
5+
46
use run_make_support::rustdoc;
57

68
fn main() {

tests/run-make/rustdoc-io-error/rmake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// containers would use a non-root user, but this leads to issues with
1414
// `mkfs.ext4 -d`, as well as mounting a loop device for the rootfs.
1515
//@ ignore-windows - the `set_readonly` functions doesn't work on folders.
16+
//@ needs-target-std
1617

1718
use run_make_support::{path, rfs, rustdoc};
1819

tests/run-make/rustdoc-map-file/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// This test ensures that all items from `foo` are correctly generated into the `redirect-map.json`
22
// file with `--generate-redirect-map` rustdoc option.
33

4+
//@ needs-target-std
5+
46
use run_make_support::rfs::read_to_string;
57
use run_make_support::{path, rustdoc, serde_json};
68

tests/run-make/rustdoc-output-path/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Checks that if the output folder doesn't exist, rustdoc will create it.
22

3+
//@ needs-target-std
4+
35
use run_make_support::{path, rustdoc};
46

57
fn main() {

tests/run-make/rustdoc-output-stdout/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
22
// a JSON file.
33

4+
//@ needs-target-std
5+
46
use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive};
57
use run_make_support::{rustdoc, serde_json};
68

tests/run-make/rustdoc-test-args/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ ignore-cross-compile (needs to run doctest binary)
2+
13
use std::iter;
24
use std::path::Path;
35

tests/run-make/rustdoc-themes/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Test that rustdoc will properly load in a theme file and display it in the theme selector.
22

3+
//@ needs-target-std
4+
35
use std::path::Path;
46

57
use run_make_support::{htmldocck, rfs, rustdoc, source_root};

tests/run-make/rustdoc-verify-output-files/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ needs-target-std
2+
13
use std::path::{Path, PathBuf};
24

35
use run_make_support::{assert_dirs_are_equal, rfs, rustdoc};

tests/run-make/rustdoc-with-out-dir-option/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ needs-target-std
2+
13
use run_make_support::{htmldocck, rustdoc};
24

35
fn main() {

tests/run-make/rustdoc-with-output-option/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ needs-target-std
2+
13
use run_make_support::{htmldocck, rustdoc};
24

35
fn main() {

tests/run-make/share-generics-dylib/rmake.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//@ needs-target-std
2+
//@ needs-dynamic-linking
3+
//@ needs-crate-type: dylib
4+
15
// This test makes sure all generic instances get re-exported from Rust dylibs for use by
26
// `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`)
37
// which both provide an instance of `Cell<i32>::set`. There is `instance_user_dylib` which is

tests/run-make/stdin-rustc/rmake.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
//@ needs-target-std
2+
13
//! This test checks rustc `-` (stdin) support
24
35
use std::path::PathBuf;
46

5-
use run_make_support::{is_windows, rustc};
7+
use run_make_support::{bin_name, rustc};
68

79
const HELLO_WORLD: &str = r#"
810
fn main() {
@@ -15,11 +17,7 @@ const NOT_UTF8: &[u8] = &[0xff, 0xff, 0xff];
1517
fn main() {
1618
// echo $HELLO_WORLD | rustc -
1719
rustc().arg("-").stdin_buf(HELLO_WORLD).run();
18-
assert!(
19-
PathBuf::from(if !is_windows() { "rust_out" } else { "rust_out.exe" })
20-
.try_exists()
21-
.unwrap()
22-
);
20+
assert!(PathBuf::from(bin_name("rust_out")).try_exists().unwrap());
2321

2422
// echo $NOT_UTF8 | rustc -
2523
rustc().arg("-").stdin_buf(NOT_UTF8).run_fail().assert_stderr_contains(

tests/run-make/stdin-rustdoc/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ ignore-cross-compile (needs to run doctests)
2+
13
//! This test checks rustdoc `-` (stdin) handling
24
35
use std::path::PathBuf;

tests/run-make/symbol-visibility/rmake.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//@ needs-target-std
2+
//@ needs-crate-type: dylib, cdylib, proc-macro
3+
//@ needs-dynamic-linking
4+
15
// Dynamic libraries on Rust used to export a very high amount of symbols,
26
// going as far as filling the output with mangled names and generic function
37
// names. After the rework of #38117, this test checks that no mangled Rust symbols

tests/run-make/track-path-dep-info/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ needs-target-std
2+
//@ needs-crate-type: proc-macro
3+
14
// This test checks the functionality of `tracked_path::path`, a procedural macro
25
// feature that adds a dependency to another file inside the procmacro. In this case,
36
// the text file is added through this method, and the test checks that the compilation

tests/run-make/used/rmake.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//@ needs-target-std
2+
//@ ignore-wasm (`object` can't handle wasm object files)
3+
14
// This test ensures that the compiler is keeping static variables, even if not referenced
25
// by another part of the program, in the output object file.
36
//

0 commit comments

Comments
 (0)