Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Migrate unknown-mod-stdin, issue-68794-textrel-on-minimal-lib, raw-dylib-cross-compilation and used-cdylib-macos run-make tests to rmake #126698

Merged
merged 4 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/tools/compiletest/src/command-list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"ignore-gnu",
"ignore-haiku",
"ignore-horizon",
"ignore-i686-pc-windows-gnu",
"ignore-i686-pc-windows-msvc",
"ignore-illumos",
"ignore-ios",
Expand Down Expand Up @@ -174,6 +175,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"only-bpf",
"only-cdb",
"only-gnu",
"only-i686-pc-windows-gnu",
"only-i686-pc-windows-msvc",
"only-ios",
"only-linux",
Expand Down
4 changes: 0 additions & 4 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ run-make/issue-37839/Makefile
run-make/issue-40535/Makefile
run-make/issue-47384/Makefile
run-make/issue-47551/Makefile
run-make/issue-68794-textrel-on-minimal-lib/Makefile
run-make/issue-69368/Makefile
run-make/issue-83045/Makefile
run-make/issue-83112-incr-test-moved-file/Makefile
Expand Down Expand Up @@ -137,7 +136,6 @@ run-make/profile/Makefile
run-make/prune-link-args/Makefile
run-make/raw-dylib-alt-calling-convention/Makefile
run-make/raw-dylib-c/Makefile
run-make/raw-dylib-cross-compilation/Makefile
run-make/raw-dylib-custom-dlltool/Makefile
run-make/raw-dylib-import-name-type/Makefile
run-make/raw-dylib-inline-cross-dylib/Makefile
Expand Down Expand Up @@ -187,9 +185,7 @@ run-make/track-path-dep-info/Makefile
run-make/track-pgo-dep-info/Makefile
run-make/translation/Makefile
run-make/type-mismatch-same-crate-name/Makefile
run-make/unknown-mod-stdin/Makefile
run-make/unstable-flag-required/Makefile
run-make/used-cdylib-macos/Makefile
run-make/volatile-intrinsics/Makefile
run-make/wasm-exceptions-nostd/Makefile
run-make/wasm-override-linker/Makefile
Expand Down
18 changes: 0 additions & 18 deletions tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile

This file was deleted.

20 changes: 0 additions & 20 deletions tests/run-make/raw-dylib-cross-compilation/Makefile

This file was deleted.

41 changes: 41 additions & 0 deletions tests/run-make/raw-dylib-cross-compilation/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// When cross-compiling using `raw-dylib`, rustc would try to fetch some
// very specific `dlltool` to complete the cross-compilation (such as `i686-w64-mingw32-dlltool`)
// when Windows only calls it `dlltool`. This test performs some cross-compilation in a
// way that previously failed due to this bug, and checks that it succeeds.
// See https://github.com/rust-lang/rust/pull/108355

//@ ignore-i686-pc-windows-gnu
// Reason: dlltool on this distribution is unable to produce x64 binaries
//@ needs-dlltool
// Reason: this is the utility being checked by this test

use run_make_support::{llvm_objdump, rust_lib_name, rustc};

fn main() {
// Build as x86 and make sure that we have x86 objects only.
rustc()
.crate_type("lib")
.crate_name("i686_raw_dylib_test")
.target("i686-pc-windows-gnu")
.input("lib.rs")
.run();
llvm_objdump()
.arg("-a")
.input(rust_lib_name("i686_raw_dylib_test"))
.run()
.assert_stdout_contains("file format coff-i386")
.assert_stdout_not_contains("file format coff-x86-64");
// Build as x64 and make sure that we have x64 objects only.
rustc()
.crate_type("lib")
.crate_name("x64_raw_dylib_test")
.target("x86_64-pc-windows-gnu")
.input("lib.rs")
.run();
llvm_objdump()
.arg("-a")
.input(rust_lib_name("x64_raw_dylib_test"))
.run()
.assert_stdout_not_contains("file format coff-i386")
.assert_stdout_contains("file format coff-x86-64");
}
31 changes: 31 additions & 0 deletions tests/run-make/textrel-on-minimal-lib/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Verify that no text relocations are accidentally introduced by linking a
// minimal rust staticlib.
// The test links a rust static library into a shared library, and checks that
// the linker doesn't have to flag the resulting file as containing TEXTRELs.
// This bug otherwise breaks Android builds, which forbid TEXTRELs.
// See https://github.com/rust-lang/rust/issues/68794

//@ ignore-cross-compile
//@ ignore-windows
// Reason: There is no `bar.dll` produced by CC to run readobj on

use run_make_support::{
cc, dynamic_lib_name, extra_c_flags, extra_cxx_flags, llvm_readobj, rustc, static_lib_name,
};

fn main() {
rustc().input("foo.rs").run();
cc().input("bar.c")
.input(static_lib_name("foo"))
.out_exe(&dynamic_lib_name("bar"))
.arg("-fPIC")
.arg("-shared")
.args(&extra_c_flags())
.args(&extra_cxx_flags())
.run();
llvm_readobj()
.input(dynamic_lib_name("bar"))
.arg("--dynamic")
.run()
.assert_stdout_not_contains("TEXTREL");
}
8 changes: 0 additions & 8 deletions tests/run-make/unknown-mod-stdin/Makefile

This file was deleted.

25 changes: 25 additions & 0 deletions tests/run-make/unknown-mod-stdin/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Rustc displays a compilation error when it finds a `mod` (module)
// statement referencing a file that does not exist. However, a bug from 2019
// caused invalid `mod` statements to silently insert empty inline modules
// instead of showing an error if the invalid `mod` statement had been passed
// through standard input. This test checks that this bug does not make a resurgence.
// See https://github.com/rust-lang/rust/issues/65601

// NOTE: This is not a UI test, because the bug which this test
// is checking for is specifically tied to passing
// `mod unknown;` through standard input.

use run_make_support::{diff, rustc};

fn main() {
let out = rustc().crate_type("rlib").stdin(b"mod unknown;").arg("-").run_fail();
diff()
.actual_text("actual-stdout", out.stdout_utf8())
.expected_file("unknown-mod.stdout")
.run();
diff()
.actual_text("actual-stderr", out.stderr_utf8())
.expected_file("unknown-mod.stderr")
.normalize(r#"\\"#, "/")
.run();
}
11 changes: 0 additions & 11 deletions tests/run-make/used-cdylib-macos/Makefile

This file was deleted.

16 changes: 16 additions & 0 deletions tests/run-make/used-cdylib-macos/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This checks that `#[used]` passes through to the linker on
// Apple targets. This is subject to change in the future.
// See https://github.com/rust-lang/rust/pull/93718

//@ only-apple

use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};

fn main() {
rustc().opt_level("3").input("dylib_used.rs").run();
llvm_readobj()
.input(dynamic_lib_name("dylib_used"))
.arg("--all")
.run()
.assert_stdout_contains("VERY_IMPORTANT_SYMBOL");
}
Loading