Skip to content

Commit 0fdfb61

Browse files
committed
Auto merge of rust-lang#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 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
2 parents 649feb9 + d447321 commit 0fdfb61

File tree

12 files changed

+120
-82
lines changed

12 files changed

+120
-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
@@ -28,7 +27,6 @@ run-make/env-dep-info/Makefile
2827
run-make/export-executable-symbols/Makefile
2928
run-make/extern-diff-internal-name/Makefile
3029
run-make/extern-flag-disambiguates/Makefile
31-
run-make/extern-flag-pathless/Makefile
3230
run-make/extern-fn-explicit-align/Makefile
3331
run-make/extern-fn-generic/Makefile
3432
run-make/extern-fn-mangle/Makefile
@@ -86,7 +84,6 @@ run-make/lto-smoke-c/Makefile
8684
run-make/macos-deployment-target/Makefile
8785
run-make/macos-fat-archive/Makefile
8886
run-make/manual-link/Makefile
89-
run-make/metadata-dep-info/Makefile
9087
run-make/min-global-align/Makefile
9188
run-make/missing-crate-dependency/Makefile
9289
run-make/mixing-libs/Makefile
@@ -126,7 +123,6 @@ run-make/sanitizer-cdylib-link/Makefile
126123
run-make/sanitizer-dylib-link/Makefile
127124
run-make/sanitizer-staticlib-link/Makefile
128125
run-make/share-generics-dylib/Makefile
129-
run-make/silly-file-names/Makefile
130126
run-make/simd-ffi/Makefile
131127
run-make/split-debuginfo/Makefile
132128
run-make/stable-symbol-names/Makefile
@@ -137,7 +133,6 @@ run-make/staticlib-dylib-linkage/Makefile
137133
run-make/std-core-cycle/Makefile
138134
run-make/symbol-mangling-hashed/Makefile
139135
run-make/symbol-visibility/Makefile
140-
run-make/symbols-include-type-name/Makefile
141136
run-make/sysroot-crates-are-unstable/Makefile
142137
run-make/test-benches/Makefile
143138
run-make/thumb-none-cortex-m/Makefile

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

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
//@ ignore-cross-compile
8+
// Reason: The __rust_ symbol appears during cross-compilation.
9+
10+
use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};
11+
12+
fn main() {
13+
// Compile a cdylib
14+
rustc().input("foo.rs").run();
15+
let out =
16+
llvm_readobj().arg("--dyn-symbols").input(dynamic_lib_name("foo")).run().stdout_utf8();
17+
assert!(!&out.contains("__rdl_"), "{out}");
18+
assert!(!&out.contains("__rde_"), "{out}");
19+
assert!(!&out.contains("__rg_"), "{out}");
20+
assert!(!&out.contains("__rust_"), "{out}");
21+
}

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)