Skip to content

Commit aa1d4f6

Browse files
committed
Auto merge of #127044 - Oneirical:fantestic-journey, r=Kobzol,jieyouxu
Migrate `dylib-chain`, `rlib-chain`, `issue-47384`, `msvc-opt-minsize` and `test-harness` `run-make` tests to ui/rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: aarch64-apple
2 parents 2b90614 + 45313a6 commit aa1d4f6

File tree

16 files changed

+134
-76
lines changed

16 files changed

+134
-76
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ run-make/dep-info-spaces/Makefile
2323
run-make/dep-info/Makefile
2424
run-make/dump-ice-to-disk/Makefile
2525
run-make/dump-mono-stats/Makefile
26-
run-make/dylib-chain/Makefile
2726
run-make/emit-path-unhashed/Makefile
2827
run-make/emit-shared-files/Makefile
2928
run-make/emit-to-stdout/Makefile
@@ -66,7 +65,6 @@ run-make/issue-35164/Makefile
6665
run-make/issue-36710/Makefile
6766
run-make/issue-37839/Makefile
6867
run-make/issue-40535/Makefile
69-
run-make/issue-47384/Makefile
7068
run-make/issue-47551/Makefile
7169
run-make/issue-69368/Makefile
7270
run-make/issue-83045/Makefile
@@ -98,7 +96,6 @@ run-make/metadata-dep-info/Makefile
9896
run-make/min-global-align/Makefile
9997
run-make/missing-crate-dependency/Makefile
10098
run-make/mixing-libs/Makefile
101-
run-make/msvc-opt-minsize/Makefile
10299
run-make/native-link-modifier-bundle/Makefile
103100
run-make/native-link-modifier-whole-archive/Makefile
104101
run-make/no-alloc-shim/Makefile
@@ -136,7 +133,6 @@ run-make/remap-path-prefix-dwarf/Makefile
136133
run-make/reproducible-build-2/Makefile
137134
run-make/reproducible-build/Makefile
138135
run-make/return-non-c-like-enum-from-c/Makefile
139-
run-make/rlib-chain/Makefile
140136
run-make/rlib-format-packed-bundled-libs-2/Makefile
141137
run-make/rlib-format-packed-bundled-libs-3/Makefile
142138
run-make/rlib-format-packed-bundled-libs/Makefile
@@ -166,7 +162,6 @@ run-make/target-cpu-native/Makefile
166162
run-make/target-specs/Makefile
167163
run-make/target-without-atomic-cas/Makefile
168164
run-make/test-benches/Makefile
169-
run-make/test-harness/Makefile
170165
run-make/thumb-none-cortex-m/Makefile
171166
run-make/thumb-none-qemu/Makefile
172167
run-make/track-path-dep-info/Makefile

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::path::{Path, PathBuf};
1313
// should all be 1000 or lower. Limits significantly smaller than 1000 are also
1414
// desirable, because large numbers of files are unwieldy in general. See issue
1515
// #73494.
16-
const ENTRY_LIMIT: u32 = 900;
16+
const ENTRY_LIMIT: u32 = 901;
1717
// FIXME: The following limits should be reduced eventually.
1818

1919
const ISSUES_ENTRY_LIMIT: u32 = 1672;

tests/run-make/dylib-chain/Makefile

-13
This file was deleted.

tests/run-make/dylib-chain/rmake.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// In this test, m4 depends on m3, which depends on m2, which depends on m1.
2+
// Even though dependencies are chained like this and there is no direct mention
3+
// of m1 or m2 in m4.rs, compilation and execution should still succeed. Unlike the
4+
// rlib-chain test, dynamic libraries contain upstream dependencies, and breaking
5+
// the chain by removing the dylibs causes execution to fail.
6+
// See https://github.com/rust-lang/rust/issues/10434
7+
8+
//@ ignore-cross-compile
9+
// Reason: the compiled binary is executed
10+
11+
use run_make_support::{dynamic_lib_name, fs_wrapper, run, run_fail, rustc};
12+
13+
fn main() {
14+
rustc().input("m1.rs").arg("-Cprefer-dynamic").run();
15+
rustc().input("m2.rs").arg("-Cprefer-dynamic").run();
16+
rustc().input("m3.rs").arg("-Cprefer-dynamic").run();
17+
rustc().input("m4.rs").run();
18+
run("m4");
19+
fs_wrapper::remove_file(dynamic_lib_name("m1"));
20+
fs_wrapper::remove_file(dynamic_lib_name("m2"));
21+
fs_wrapper::remove_file(dynamic_lib_name("m3"));
22+
run_fail("m4");
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Linkers treat archives differently from object files: all object files participate in linking,
2+
// while archives will only participate in linking if they can satisfy at least one undefined
3+
// reference (version scripts doesn't count). This causes `#[no_mangle]` or `#[used]` items to
4+
// be ignored by the linker, and since they never participate in the linking, using `KEEP` in the
5+
// linker scripts can't keep them either. This causes #47384. After the fix in #95604, this test
6+
// checks that these symbols and sections successfully appear in the output dynamic library.
7+
// See https://github.com/rust-lang/rust/pull/95604
8+
// See https://github.com/rust-lang/rust/issues/47384
9+
10+
//@ only-linux
11+
// Reason: differences in object file formats on OSX and Windows
12+
// causes errors in the llvm_objdump step
13+
14+
use run_make_support::{dynamic_lib_name, llvm_objdump, llvm_readobj, rustc};
15+
16+
fn main() {
17+
rustc().crate_type("lib").input("lib.rs").run();
18+
rustc().crate_type("cdylib").link_args("-Tlinker.ld").input("main.rs").run();
19+
// Ensure `#[used]` and `KEEP`-ed section is there
20+
llvm_objdump()
21+
.arg("--full-contents")
22+
.arg("--section=.static")
23+
.input(dynamic_lib_name("main"))
24+
.run();
25+
// Ensure `#[no_mangle]` symbol is there
26+
llvm_readobj()
27+
.arg("--symbols")
28+
.input(dynamic_lib_name("main"))
29+
.run()
30+
.assert_stdout_contains("bar");
31+
}

tests/run-make/issue-47384/Makefile

-12
This file was deleted.

tests/run-make/msvc-opt-minsize/Makefile

-6
This file was deleted.

tests/run-make/msvc-opt-minsize/foo.rs

-19
This file was deleted.

tests/run-make/rlib-chain/Makefile

-11
This file was deleted.

tests/run-make/rlib-chain/rmake.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// In this test, m4 depends on m3, which depends on m2, which depends on m1.
2+
// Even though dependencies are chained like this and there is no direct mention
3+
// of m1 or m2 in m4.rs, compilation and execution should still succeed. Unlike
4+
// the dylib-chain test, rlibs do not contain upstream dependencies, and removing
5+
// the libraries still allows m4 to successfully execute.
6+
// See https://github.com/rust-lang/rust/issues/10434
7+
8+
//@ ignore-cross-compile
9+
// Reason: the compiled binary is executed
10+
11+
use run_make_support::{fs_wrapper, run, rust_lib_name, rustc};
12+
13+
fn main() {
14+
rustc().input("m1.rs").run();
15+
rustc().input("m2.rs").run();
16+
rustc().input("m3.rs").run();
17+
rustc().input("m4.rs").run();
18+
run("m4");
19+
fs_wrapper::remove_file(rust_lib_name("m1"));
20+
fs_wrapper::remove_file(rust_lib_name("m2"));
21+
fs_wrapper::remove_file(rust_lib_name("m3"));
22+
run("m4");
23+
}

tests/run-make/test-harness/Makefile

-9
This file was deleted.

tests/run-make/test-harness/rmake.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// The way test suites run can be modified using configuration flags,
2+
// ignoring certain tests while running others. This test contains two
3+
// functions, one which must run and the other which must not. The standard
4+
// output is checked to verify that the ignore configuration is doing its job,
5+
// and that output is successfully minimized with the --quiet flag.
6+
// See https://github.com/rust-lang/rust/commit/f7ebe23ae185991b0fee05b32fbb3e29b89a41bf
7+
8+
//@ ignore-cross-compile
9+
// Reason: the compiled binary is executed
10+
11+
use run_make_support::{run, run_with_args, rustc};
12+
13+
fn main() {
14+
rustc().arg("--test").input("test-ignore-cfg.rs").cfg("ignorecfg").run();
15+
// check that #[cfg_attr(..., ignore)] does the right thing.
16+
run("test-ignore-cfg")
17+
.assert_stdout_contains("shouldnotignore ... ok")
18+
.assert_stdout_contains("shouldignore ... ignored");
19+
assert_eq!(
20+
// One of the lines is exactly "i."
21+
run_with_args("test-ignore-cfg", &["--quiet"]).stdout_utf8().lines().find(|&x| x == "i."),
22+
Some("i.")
23+
);
24+
run_with_args("test-ignore-cfg", &["--quiet"]).assert_stdout_not_contains("should");
25+
}

tests/ui/msvc-opt-minsize.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// A previously outdated version of LLVM caused compilation failures on Windows
2+
// specifically with optimization level `z`. After the update to a more recent LLVM
3+
// version, this test checks that compilation and execution both succeed.
4+
// See https://github.com/rust-lang/rust/issues/45034
5+
6+
//@ ignore-cross-compile
7+
// Reason: the compiled binary is executed
8+
//@ only-windows
9+
// Reason: the observed bug only occurs on Windows
10+
//@ run-pass
11+
//@ compile-flags: -C opt-level=z
12+
13+
#![feature(test)]
14+
extern crate test;
15+
16+
fn foo(x: i32, y: i32) -> i64 {
17+
(x + y) as i64
18+
}
19+
20+
#[inline(never)]
21+
fn bar() {
22+
let _f = Box::new(0);
23+
// This call used to trigger an LLVM bug in opt-level z where the base
24+
// pointer gets corrupted, see issue #45034
25+
let y: fn(i32, i32) -> i64 = test::black_box(foo);
26+
test::black_box(y(1, 2));
27+
}
28+
29+
fn main() {
30+
bar();
31+
}

0 commit comments

Comments
 (0)