Skip to content

Commit

Permalink
Auto merge of rust-lang#127006 - Oneirical:holmes-the-detestive, r=Ko…
Browse files Browse the repository at this point in the history
…bzol

Migrate `extern-flag-pathless`, `silly-file-names`, `metadata-dep-info`, `cdylib-fewer-symbols` and `symbols-include-type-name` `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).

`cdylib-fewer-symbols` demands a Windows try-job. (Almost guaranteed to fail, but 7 years is a long time)

try-job: x86_64-gnu-distcheck
try-job: x86_64-msvc
try-job: aarch64-apple
  • Loading branch information
bors committed Jul 10, 2024
2 parents 649feb9 + d447321 commit 0fdfb61
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 82 deletions.
5 changes: 0 additions & 5 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ run-make/c-unwind-abi-catch-lib-panic/Makefile
run-make/c-unwind-abi-catch-panic/Makefile
run-make/cat-and-grep-sanity-check/Makefile
run-make/cdylib-dylib-linkage/Makefile
run-make/cdylib-fewer-symbols/Makefile
run-make/compiler-lookup-paths-2/Makefile
run-make/compiler-lookup-paths/Makefile
run-make/compiler-rt-works-on-mingw/Makefile
Expand All @@ -28,7 +27,6 @@ run-make/env-dep-info/Makefile
run-make/export-executable-symbols/Makefile
run-make/extern-diff-internal-name/Makefile
run-make/extern-flag-disambiguates/Makefile
run-make/extern-flag-pathless/Makefile
run-make/extern-fn-explicit-align/Makefile
run-make/extern-fn-generic/Makefile
run-make/extern-fn-mangle/Makefile
Expand Down Expand Up @@ -86,7 +84,6 @@ run-make/lto-smoke-c/Makefile
run-make/macos-deployment-target/Makefile
run-make/macos-fat-archive/Makefile
run-make/manual-link/Makefile
run-make/metadata-dep-info/Makefile
run-make/min-global-align/Makefile
run-make/missing-crate-dependency/Makefile
run-make/mixing-libs/Makefile
Expand Down Expand Up @@ -126,7 +123,6 @@ run-make/sanitizer-cdylib-link/Makefile
run-make/sanitizer-dylib-link/Makefile
run-make/sanitizer-staticlib-link/Makefile
run-make/share-generics-dylib/Makefile
run-make/silly-file-names/Makefile
run-make/simd-ffi/Makefile
run-make/split-debuginfo/Makefile
run-make/stable-symbol-names/Makefile
Expand All @@ -137,7 +133,6 @@ run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile
run-make/symbols-include-type-name/Makefile
run-make/sysroot-crates-are-unstable/Makefile
run-make/test-benches/Makefile
run-make/thumb-none-cortex-m/Makefile
Expand Down
15 changes: 0 additions & 15 deletions tests/run-make/cdylib-fewer-symbols/Makefile

This file was deleted.

21 changes: 21 additions & 0 deletions tests/run-make/cdylib-fewer-symbols/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Symbols related to the allocator should be hidden and not exported from a cdylib,
// for they are internal to Rust
// and not part of the public ABI (application binary interface). This test checks that
// four such symbols are successfully hidden.
// See https://github.com/rust-lang/rust/pull/45710

//@ ignore-cross-compile
// Reason: The __rust_ symbol appears during cross-compilation.

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

fn main() {
// Compile a cdylib
rustc().input("foo.rs").run();
let out =
llvm_readobj().arg("--dyn-symbols").input(dynamic_lib_name("foo")).run().stdout_utf8();
assert!(!&out.contains("__rdl_"), "{out}");
assert!(!&out.contains("__rde_"), "{out}");
assert!(!&out.contains("__rg_"), "{out}");
assert!(!&out.contains("__rust_"), "{out}");
}
34 changes: 0 additions & 34 deletions tests/run-make/extern-flag-pathless/Makefile

This file was deleted.

43 changes: 43 additions & 0 deletions tests/run-make/extern-flag-pathless/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// It is possible, since #64882, to use the --extern flag without an explicit
// path. In the event of two --extern flags, the explicit one with a path will take
// priority, but otherwise, it is a more concise way of fetching specific libraries.
// This test checks that the default priority of explicit extern flags and rlibs is
// respected.
// See https://github.com/rust-lang/rust/pull/64882

//@ ignore-cross-compile
// Reason: the compiled binary is executed

use run_make_support::{dynamic_lib_name, fs_wrapper, run, run_fail, rust_lib_name, rustc};

fn main() {
rustc().input("bar.rs").crate_type("rlib").crate_type("dylib").arg("-Cprefer-dynamic").run();

// By default, the rlib has priority over the dylib.
rustc().input("foo.rs").arg("--extern").arg("bar").run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
run("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));

rustc().input("foo.rs").extern_("bar", rust_lib_name("bar")).arg("--extern").arg("bar").run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
run("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));

// The first explicit usage of extern overrides the second pathless --extern bar.
rustc()
.input("foo.rs")
.extern_("bar", dynamic_lib_name("bar"))
.arg("--extern")
.arg("bar")
.run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
run_fail("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));

// With prefer-dynamic, execution fails as it refuses to use the rlib.
rustc().input("foo.rs").arg("--extern").arg("bar").arg("-Cprefer-dynamic").run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
run_fail("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));
}
7 changes: 0 additions & 7 deletions tests/run-make/metadata-dep-info/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/metadata-dep-info/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Emitting dep-info alongside metadata would present subtle discrepancies
// in the output file, such as the filename transforming underscores_ into hyphens-.
// After the fix in #114750, this test checks that the emitted files are identical
// to the expected output.
// See https://github.com/rust-lang/rust/issues/68839

use run_make_support::{diff, rustc};

fn main() {
rustc()
.emit("metadata,dep-info")
.crate_type("lib")
.input("dash-separated.rs")
.extra_filename("_something-extra")
.run();
diff()
.expected_file("dash-separated_something-extra.expected.d")
.actual_file("dash-separated_something-extra.d")
.run();
}
12 changes: 0 additions & 12 deletions tests/run-make/silly-file-names/Makefile

This file was deleted.

24 changes: 24 additions & 0 deletions tests/run-make/silly-file-names/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// There used to be assert! checks in the compiler to error on encountering
// files starting or ending with < or > respectively, as a preventive measure
// against "fake" files like <anon>. However, this was not truly required,
// as rustc has other checks to verify the veracity of a file. This test includes
// some files with < and > in their names and prints out their output to stdout,
// expecting no errors.
// See https://github.com/rust-lang/rust/issues/73419

//@ ignore-cross-compile
// Reason: the compiled binary is executed
//@ ignore-windows
// Reason: Windows refuses files with < and > in their names

use run_make_support::{diff, fs_wrapper, run, rustc};

fn main() {
fs_wrapper::create_file("<leading-lt");
fs_wrapper::write("<leading-lt", r#""comes from a file with a name that begins with <""#);
fs_wrapper::create_file("trailing-gt>");
fs_wrapper::write("trailing-gt>", r#""comes from a file with a name that ends with >""#);
rustc().input("silly-file-names.rs").output("silly-file-names").run();
let out = run("silly-file-names").stdout_utf8();
diff().expected_file("silly-file-names.run.stdout").actual_text("actual-stdout", out).run();
}
9 changes: 0 additions & 9 deletions tests/run-make/symbols-include-type-name/Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions tests/run-make/symbols-include-type-name/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Method names used to be obfuscated when exported into symbols,
// leaving only an obscure `<impl>`. After the fix in #30328,
// this test checks that method names are successfully saved in the symbol list.
// See https://github.com/rust-lang/rust/issues/30260

use run_make_support::{invalid_utf8_contains, rustc};

fn main() {
rustc().crate_type("staticlib").emit("asm").input("lib.rs").run();
// Check that symbol names for methods include type names, instead of <impl>.
invalid_utf8_contains("lib.s", "Def");
}

0 comments on commit 0fdfb61

Please sign in to comment.