Skip to content

Commit 1746499

Browse files
committed
Auto merge of rust-lang#126698 - Oneirical:tessteract, r=<try>
Migrate `unknown-mod-stdin`, `issue-68794-textrel-on-minimal-lib`, `raw-dylib-cross-compilation` and `used-cdylib-macos` `run-make` tests to rmake Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Seriously needs OSX/Windows try-jobs. If it fails, restore `only-linux` in `textrel-on-minimal-lib` and try again. try-job: armhf-gnu try-job: test-various
2 parents 5c8459f + 445eb08 commit 1746499

File tree

11 files changed

+113
-61
lines changed

11 files changed

+113
-61
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ run-make/issue-37839/Makefile
8282
run-make/issue-40535/Makefile
8383
run-make/issue-47384/Makefile
8484
run-make/issue-47551/Makefile
85-
run-make/issue-68794-textrel-on-minimal-lib/Makefile
8685
run-make/issue-69368/Makefile
8786
run-make/issue-83045/Makefile
8887
run-make/issue-83112-incr-test-moved-file/Makefile
@@ -157,7 +156,6 @@ run-make/profile/Makefile
157156
run-make/prune-link-args/Makefile
158157
run-make/raw-dylib-alt-calling-convention/Makefile
159158
run-make/raw-dylib-c/Makefile
160-
run-make/raw-dylib-cross-compilation/Makefile
161159
run-make/raw-dylib-custom-dlltool/Makefile
162160
run-make/raw-dylib-import-name-type/Makefile
163161
run-make/raw-dylib-inline-cross-dylib/Makefile
@@ -211,10 +209,8 @@ run-make/track-path-dep-info/Makefile
211209
run-make/track-pgo-dep-info/Makefile
212210
run-make/translation/Makefile
213211
run-make/type-mismatch-same-crate-name/Makefile
214-
run-make/unknown-mod-stdin/Makefile
215212
run-make/unstable-flag-required/Makefile
216213
run-make/use-suggestions-rust-2018/Makefile
217-
run-make/used-cdylib-macos/Makefile
218214
run-make/volatile-intrinsics/Makefile
219215
run-make/wasm-exceptions-nostd/Makefile
220216
run-make/wasm-override-linker/Makefile

tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile

-18
This file was deleted.

tests/run-make/raw-dylib-cross-compilation/Makefile

-20
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// When cross-compiling using `raw-dylib`, rustc would try to fetch some
2+
// very specific `dlltool` to complete the cross-compilation (such as `i686-w64-mingw32-dlltool`)
3+
// when Windows only calls it `dlltool`. This test performs some cross-compilation in a
4+
// way that previously failed due to this bug, and checks that it succeeds.
5+
// See https://github.com/rust-lang/rust/pull/108355
6+
7+
//@ ignore-i686-pc-windows-msvc
8+
// Reason: dlltool on this distribution is unable to produce x64 binaries
9+
//@ needs-dlltool
10+
// Reason: this is the utility being checked by this test
11+
12+
use run_make_support::{llvm_objdump, rust_lib_name, rustc};
13+
14+
fn main() {
15+
// Build as x86 and make sure that we have x86 objects only.
16+
rustc()
17+
.crate_type("lib")
18+
.crate_name("i686_raw_dylib_test")
19+
.target("i686-pc-windows-gnu")
20+
.input("lib.rs")
21+
.run();
22+
llvm_objdump()
23+
.arg("-a")
24+
.input(rust_lib_name("i686_raw_dylib_test"))
25+
.run()
26+
.assert_stdout_contains("file format coff-i386")
27+
.assert_stdout_not_contains("file format coff-x86-64");
28+
// Build as x64 and make sure that we have x64 objects only.
29+
rustc()
30+
.crate_type("lib")
31+
.crate_name("x64_raw_dylib_test")
32+
.target("x86-64-pc-windows-gnu")
33+
.input("lib.rs")
34+
.run();
35+
llvm_objdump()
36+
.arg("-a")
37+
.input(rust_lib_name("i686_raw_dylib_test"))
38+
.run()
39+
.assert_stdout_not_contains("file format coff-i386")
40+
.assert_stdout_contains("file format coff-x86-64");
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Verify that no text relocations are accidentally introduced by linking a
2+
// minimal rust staticlib.
3+
// The test links a rust static library into a shared library, and checks that
4+
// the linker doesn't have to flag the resulting file as containing TEXTRELs.
5+
// This bug otherwise breaks Android builds, which forbid TEXTRELs.
6+
// See https://github.com/rust-lang/rust/issues/68794
7+
8+
//@ ignore-cross-compile
9+
//@ ignore-windows
10+
// Reason: There is no `bar.dll` produced by CC to run readobj on
11+
12+
use run_make_support::{
13+
cc, dynamic_lib_name, extra_c_flags, extra_cxx_flags, llvm_readobj, rustc, static_lib_name,
14+
};
15+
16+
fn main() {
17+
rustc().input("foo.rs").run();
18+
cc().input("bar.c")
19+
.input(static_lib_name("foo"))
20+
.out_exe(&dynamic_lib_name("bar"))
21+
.arg("-fPIC")
22+
.arg("-shared")
23+
.args(&extra_c_flags())
24+
.args(&extra_cxx_flags())
25+
.run();
26+
llvm_readobj()
27+
.input(dynamic_lib_name("bar"))
28+
.arg("--dynamic")
29+
.run()
30+
.assert_stdout_not_contains("TEXTREL");
31+
}

tests/run-make/unknown-mod-stdin/Makefile

-8
This file was deleted.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Rustc displays a compilation error when it finds a `mod` (module)
2+
// statement referencing a file that does not exist. However, a bug from 2019
3+
// caused invalid `mod` statements to silently insert empty inline modules
4+
// instead of showing an error if the invalid `mod` statement had been passed
5+
// through standard input. This test checks that this bug does not make a resurgence.
6+
// See https://github.com/rust-lang/rust/issues/65601
7+
8+
// NOTE: This is not a UI test, because the bug which this test
9+
// is checking for is specifically tied to passing
10+
// `mod unknown;` through standard input.
11+
12+
use run_make_support::{diff, rustc};
13+
14+
fn main() {
15+
let out = rustc().crate_type("rlib").stdin(b"mod unknown;").arg("-").run_fail();
16+
diff()
17+
.actual_text("actual-stdout", out.stdout_utf8())
18+
.expected_file("unknown-mod.stdout")
19+
.run();
20+
diff()
21+
.actual_text("actual-stderr", out.stderr_utf8())
22+
.expected_file("unknown-mod.stderr")
23+
.normalize(r#"\\"#, "/")
24+
.run();
25+
}

tests/run-make/used-cdylib-macos/Makefile

-11
This file was deleted.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This checks that `#[used]` passes through to the linker on
2+
// Apple targets. This is subject to change in the future.
3+
// See https://github.com/rust-lang/rust/pull/93718
4+
5+
//@ only-apple
6+
7+
use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};
8+
9+
fn main() {
10+
rustc().opt_level("3").input("dylib_used.rs").run();
11+
llvm_readobj()
12+
.input(dynamic_lib_name("dylib_used"))
13+
.arg("--dt")
14+
.run()
15+
.assert_stdout_contains("VERY_IMPORTANT_SYMBOL");
16+
}

0 commit comments

Comments
 (0)