Skip to content

Commit 0a783ac

Browse files
committed
Repair some run-make tests on cross-compile
1 parent 4ec4d0e commit 0a783ac

File tree

39 files changed

+88
-30
lines changed

39 files changed

+88
-30
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//@ needs-target-std
1+
//@ ignore-cross-compile (needs to run doctests)
2+
23
use std::path::Path;
34

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

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

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

55
use std::path::PathBuf;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ needs-target-std
2-
//
2+
//@ needs-crate-type: dylib
3+
34
// Tests the -Zembed-metadata compiler flag.
45
// Tracking issue: https://github.com/rust-lang/rust/issues/139165
56

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ needs-target-std
22
//@ ignore-windows
33
//@ ignore-apple
4+
//@ ignore-wasm (`object` doesn't handle wasm object files)
45

56
// This test should be replaced with one in tests/debuginfo once we can easily
67
// 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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
// See https://github.com/rust-lang/rust/pull/51946
88

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

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

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

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

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

48
fn main() {

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

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

48
fn main() {

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

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

48
fn main() {

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

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

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

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

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

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

1010
use std::fmt::Write;
1111

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

1414
fn main() {
1515
rustc().input("depa.rs").run();
@@ -33,9 +33,11 @@ fn needle_from_libs(libs: &[&str]) -> String {
3333
let mut needle = String::new();
3434
for lib in libs {
3535
if is_msvc() {
36-
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();
3739
} else {
38-
let _ = needle.write_fmt(format_args!(r#""-l{lib}" "#));
40+
needle.write_fmt(format_args!(r#""-l{lib}" "#)).unwrap();
3941
}
4042
}
4143
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,4 +1,6 @@
11
//@ needs-target-std
2+
//@ ignore-cross-compile (need to run fake linker)
3+
24
use run_make_support::{Rustc, diff, regex, rustc};
35

46
fn run_rustc() -> Rustc {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
// See https://github.com/rust-lang/rust/issues/99425
55

66
//@ needs-target-std
7+
78
//@ ignore-apple
9+
//@ ignore-wasm
810
// Reason: linking fails due to the unusual ".ext" staticlib name.
911

1012
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ needs-target-std
2-
//
2+
33
// `no_builtins` is an attribute related to LLVM's optimizations. In order to ensure that it has an
44
// effect on link-time optimizations (LTO), it should be added to function declarations in a crate.
55
// This test uses the `llvm-filecheck` tool to determine that this attribute is successfully
@@ -11,5 +11,6 @@ use run_make_support::{llvm_filecheck, rfs, rustc};
1111
fn main() {
1212
rustc().input("no_builtins.rs").emit("link").run();
1313
rustc().input("main.rs").emit("llvm-ir").run();
14+
1415
llvm_filecheck().patterns("filecheck.main.txt").stdin_buf(rfs::read("main.ll")).run();
1516
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ needs-target-std
2-
//
2+
//@ needs-crate-type: proc-macro
3+
34
// A compiler bug caused the following issue:
45
// If a crate A depends on crate B, and crate B
56
// depends on crate C, and crate C contains a procedural

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

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ needs-target-std
2-
//
2+
//@ needs-crate-type: proc-macro
3+
34
// --emit dep-info used to print all macro-generated code it could
45
// find as if it was part of a nonexistent file named "proc-macro source",
56
// 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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ needs-target-std
2-
//
2+
//@ needs-dynamic-linking
3+
//@ needs-crate-type: dylib
4+
35
// This test makes sure all generic instances get re-exported from Rust dylibs for use by
46
// `-Zshare-generics`. There are two rlibs (`instance_provider_a` and `instance_provider_b`)
57
// 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: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//@ needs-target-std
2+
23
//! This test checks rustc `-` (stdin) support
34
45
use std::path::PathBuf;
56

6-
use run_make_support::{is_windows, rustc};
7+
use run_make_support::{bin_name, rustc};
78

89
const HELLO_WORLD: &str = r#"
910
fn main() {
@@ -16,11 +17,7 @@ const NOT_UTF8: &[u8] = &[0xff, 0xff, 0xff];
1617
fn main() {
1718
// echo $HELLO_WORLD | rustc -
1819
rustc().arg("-").stdin_buf(HELLO_WORLD).run();
19-
assert!(
20-
PathBuf::from(if !is_windows() { "rust_out" } else { "rust_out.exe" })
21-
.try_exists()
22-
.unwrap()
23-
);
20+
assert!(PathBuf::from(bin_name("rust_out")).try_exists().unwrap());
2421

2522
// echo $NOT_UTF8 | rustc -
2623
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ needs-target-std
2-
//
2+
//@ needs-crate-type: dylib, cdylib, proc-macro
3+
//@ needs-dynamic-linking
4+
35
// Dynamic libraries on Rust used to export a very high amount of symbols,
46
// going as far as filling the output with mangled names and generic function
57
// 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ needs-target-std
2-
//
2+
//@ needs-crate-type: proc-macro
3+
34
// This test checks the functionality of `tracked_path::path`, a procedural macro
45
// feature that adds a dependency to another file inside the procmacro. In this case,
56
// the text file is added through this method, and the test checks that the compilation

tests/run-make/used/rmake.rs

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

0 commit comments

Comments
 (0)