Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1c53c0a

Browse files
committedJun 29, 2024
Auto merge of rust-lang#126698 - Oneirical:tessteract, r=Kobzol
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: x86_64-mingw try-job: x86_64-msvc
2 parents 9ed2ab3 + 4c9eeda commit 1c53c0a

File tree

12 files changed

+115
-61
lines changed

12 files changed

+115
-61
lines changed
 

‎src/tools/compiletest/src/command-list.rs

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
5353
"ignore-gnu",
5454
"ignore-haiku",
5555
"ignore-horizon",
56+
"ignore-i686-pc-windows-gnu",
5657
"ignore-i686-pc-windows-msvc",
5758
"ignore-illumos",
5859
"ignore-ios",
@@ -174,6 +175,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
174175
"only-bpf",
175176
"only-cdb",
176177
"only-gnu",
178+
"only-i686-pc-windows-gnu",
177179
"only-i686-pc-windows-msvc",
178180
"only-ios",
179181
"only-linux",

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ run-make/issue-37839/Makefile
7070
run-make/issue-40535/Makefile
7171
run-make/issue-47384/Makefile
7272
run-make/issue-47551/Makefile
73-
run-make/issue-68794-textrel-on-minimal-lib/Makefile
7473
run-make/issue-69368/Makefile
7574
run-make/issue-83045/Makefile
7675
run-make/issue-83112-incr-test-moved-file/Makefile
@@ -137,7 +136,6 @@ run-make/profile/Makefile
137136
run-make/prune-link-args/Makefile
138137
run-make/raw-dylib-alt-calling-convention/Makefile
139138
run-make/raw-dylib-c/Makefile
140-
run-make/raw-dylib-cross-compilation/Makefile
141139
run-make/raw-dylib-custom-dlltool/Makefile
142140
run-make/raw-dylib-import-name-type/Makefile
143141
run-make/raw-dylib-inline-cross-dylib/Makefile
@@ -187,9 +185,7 @@ run-make/track-path-dep-info/Makefile
187185
run-make/track-pgo-dep-info/Makefile
188186
run-make/translation/Makefile
189187
run-make/type-mismatch-same-crate-name/Makefile
190-
run-make/unknown-mod-stdin/Makefile
191188
run-make/unstable-flag-required/Makefile
192-
run-make/used-cdylib-macos/Makefile
193189
run-make/volatile-intrinsics/Makefile
194190
run-make/wasm-exceptions-nostd/Makefile
195191
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-gnu
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("x64_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("--all")
14+
.run()
15+
.assert_stdout_contains("VERY_IMPORTANT_SYMBOL");
16+
}

0 commit comments

Comments
 (0)
Failed to load comments.