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 08ce4db

Browse files
committedJun 30, 2024
Auto merge of #127006 - Oneirical:holmes-the-detestive, r=Kobzol
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 #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-msvc
2 parents 716752e + 53a7aee commit 08ce4db

File tree

12 files changed

+118
-82
lines changed

12 files changed

+118
-82
lines changed
 

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

-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ run-make/c-unwind-abi-catch-lib-panic/Makefile
99
run-make/c-unwind-abi-catch-panic/Makefile
1010
run-make/cat-and-grep-sanity-check/Makefile
1111
run-make/cdylib-dylib-linkage/Makefile
12-
run-make/cdylib-fewer-symbols/Makefile
1312
run-make/compiler-lookup-paths-2/Makefile
1413
run-make/compiler-lookup-paths/Makefile
1514
run-make/compiler-rt-works-on-mingw/Makefile
@@ -31,7 +30,6 @@ run-make/env-dep-info/Makefile
3130
run-make/export-executable-symbols/Makefile
3231
run-make/extern-diff-internal-name/Makefile
3332
run-make/extern-flag-disambiguates/Makefile
34-
run-make/extern-flag-pathless/Makefile
3533
run-make/extern-fn-explicit-align/Makefile
3634
run-make/extern-fn-generic/Makefile
3735
run-make/extern-fn-mangle/Makefile
@@ -95,7 +93,6 @@ run-make/lto-smoke-c/Makefile
9593
run-make/macos-deployment-target/Makefile
9694
run-make/macos-fat-archive/Makefile
9795
run-make/manual-link/Makefile
98-
run-make/metadata-dep-info/Makefile
9996
run-make/min-global-align/Makefile
10097
run-make/missing-crate-dependency/Makefile
10198
run-make/mixing-libs/Makefile
@@ -150,7 +147,6 @@ run-make/sepcomp-cci-copies/Makefile
150147
run-make/sepcomp-inlining/Makefile
151148
run-make/sepcomp-separate/Makefile
152149
run-make/share-generics-dylib/Makefile
153-
run-make/silly-file-names/Makefile
154150
run-make/simd-ffi/Makefile
155151
run-make/split-debuginfo/Makefile
156152
run-make/stable-symbol-names/Makefile
@@ -161,7 +157,6 @@ run-make/staticlib-dylib-linkage/Makefile
161157
run-make/std-core-cycle/Makefile
162158
run-make/symbol-mangling-hashed/Makefile
163159
run-make/symbol-visibility/Makefile
164-
run-make/symbols-include-type-name/Makefile
165160
run-make/sysroot-crates-are-unstable/Makefile
166161
run-make/target-cpu-native/Makefile
167162
run-make/target-specs/Makefile

‎tests/run-make/cdylib-fewer-symbols/Makefile

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Symbols related to the allocator should be hidden and not exported from a cdylib,
2+
// for they are internal to Rust
3+
// and not part of the public ABI (application binary interface). This test checks that
4+
// four such symbols are successfully hidden.
5+
// See https://github.com/rust-lang/rust/pull/45710
6+
7+
use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};
8+
9+
fn main() {
10+
// Compile a cdylib
11+
rustc().input("foo.rs").run();
12+
let out = llvm_readobj().arg("--symbols").input(dynamic_lib_name("foo")).run().stdout_utf8();
13+
let out = // All hidden symbols must be removed.
14+
out.lines().filter(|&line| !line.trim().contains("HIDDEN")).collect::<Vec<_>>().join("\n");
15+
assert!(!&out.contains("__rdl_"));
16+
assert!(!&out.contains("__rde_"));
17+
assert!(!&out.contains("__rg_"));
18+
assert!(!&out.contains("__rust_"));
19+
}

‎tests/run-make/extern-flag-pathless/Makefile

-34
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// It is possible, since #64882, to use the --extern flag without an explicit
2+
// path. In the event of two --extern flags, the explicit one with a path will take
3+
// priority, but otherwise, it is a more concise way of fetching specific libraries.
4+
// This test checks that the default priority of explicit extern flags and rlibs is
5+
// respected.
6+
// See https://github.com/rust-lang/rust/pull/64882
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, rust_lib_name, rustc};
12+
13+
fn main() {
14+
rustc().input("bar.rs").crate_type("rlib").crate_type("dylib").arg("-Cprefer-dynamic").run();
15+
16+
// By default, the rlib has priority over the dylib.
17+
rustc().input("foo.rs").arg("--extern").arg("bar").run();
18+
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
19+
run("foo");
20+
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));
21+
22+
rustc().input("foo.rs").extern_("bar", rust_lib_name("bar")).arg("--extern").arg("bar").run();
23+
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
24+
run("foo");
25+
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));
26+
27+
// The first explicit usage of extern overrides the second pathless --extern bar.
28+
rustc()
29+
.input("foo.rs")
30+
.extern_("bar", dynamic_lib_name("bar"))
31+
.arg("--extern")
32+
.arg("bar")
33+
.run();
34+
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
35+
run_fail("foo");
36+
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));
37+
38+
// With prefer-dynamic, execution fails as it refuses to use the rlib.
39+
rustc().input("foo.rs").arg("--extern").arg("bar").arg("-Cprefer-dynamic").run();
40+
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp");
41+
run_fail("foo");
42+
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar"));
43+
}

‎tests/run-make/metadata-dep-info/Makefile

-7
This file was deleted.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Emitting dep-info alongside metadata would present subtle discrepancies
2+
// in the output file, such as the filename transforming underscores_ into hyphens-.
3+
// After the fix in #114750, this test checks that the emitted files are identical
4+
// to the expected output.
5+
// See https://github.com/rust-lang/rust/issues/68839
6+
7+
use run_make_support::{diff, rustc};
8+
9+
fn main() {
10+
rustc()
11+
.emit("metadata,dep-info")
12+
.crate_type("lib")
13+
.input("dash-separated.rs")
14+
.extra_filename("_something-extra")
15+
.run();
16+
diff()
17+
.expected_file("dash-separated_something-extra.expected.d")
18+
.actual_file("dash-separated_something-extra.d")
19+
.run();
20+
}

‎tests/run-make/silly-file-names/Makefile

-12
This file was deleted.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// There used to be assert! checks in the compiler to error on encountering
2+
// files starting or ending with < or > respectively, as a preventive measure
3+
// against "fake" files like <anon>. However, this was not truly required,
4+
// as rustc has other checks to verify the veracity of a file. This test includes
5+
// some files with < and > in their names and prints out their output to stdout,
6+
// expecting no errors.
7+
// See https://github.com/rust-lang/rust/issues/73419
8+
9+
//@ ignore-cross-compile
10+
// Reason: the compiled binary is executed
11+
//@ ignore-windows
12+
// Reason: Windows refuses files with < and > in their names
13+
14+
use run_make_support::{diff, fs_wrapper, run, rustc};
15+
16+
fn main() {
17+
fs_wrapper::create_file("<leading-lt");
18+
fs_wrapper::write("<leading-lt", r#""comes from a file with a name that begins with <""#);
19+
fs_wrapper::create_file("trailing-gt>");
20+
fs_wrapper::write("trailing-gt>", r#""comes from a file with a name that ends with >""#);
21+
rustc().input("silly-file-names.rs").output("silly-file-names").run();
22+
let out = run("silly-file-names").stdout_utf8();
23+
diff().expected_file("silly-file-names.run.stdout").actual_text("actual-stdout", out).run();
24+
}

‎tests/run-make/symbols-include-type-name/Makefile

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Method names used to be obfuscated when exported into symbols,
2+
// leaving only an obscure `<impl>`. After the fix in #30328,
3+
// this test checks that method names are successfully saved in the symbol list.
4+
// See https://github.com/rust-lang/rust/issues/30260
5+
6+
use run_make_support::{invalid_utf8_contains, rustc};
7+
8+
fn main() {
9+
rustc().crate_type("staticlib").emit("asm").input("lib.rs").run();
10+
// Check that symbol names for methods include type names, instead of <impl>.
11+
invalid_utf8_contains("lib.s", "Def");
12+
}

0 commit comments

Comments
 (0)
Failed to load comments.