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 a8c593c

Browse files
committedJun 19, 2024
Auto merge of rust-lang#126644 - Oneirical:testla-coil, r=<try>
Rewrite `extern-flag-rename-transitive`. `debugger-visualizer-dep-info`, `metadata-flag-frobs-symbols`, `extern-overrides-distribution` and `forced-unwind-terminate-pof` `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). try-job: dist-x86_64-apple
2 parents 3186d17 + 2eab81a commit a8c593c

File tree

12 files changed

+82
-47
lines changed

12 files changed

+82
-47
lines changed
 

‎src/tools/run-make-support/src/rustc.rs

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ impl Rustc {
7373
self
7474
}
7575

76+
/// Incorporate a hashed string to mangled symbols.
77+
pub fn metadata(&mut self, meta: &str) -> &mut Self {
78+
self.cmd.arg(format!("-Cmetadata={meta}"));
79+
self
80+
}
81+
7682
/// Add a suffix in each output filename.
7783
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
7884
self.cmd.arg(format!("-Cextra-filename={suffix}"));

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

-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ run-make/cross-lang-lto-pgo-smoketest/Makefile
2222
run-make/cross-lang-lto-upstream-rlibs/Makefile
2323
run-make/cross-lang-lto/Makefile
2424
run-make/debug-assertions/Makefile
25-
run-make/debugger-visualizer-dep-info/Makefile
2625
run-make/dep-info-doesnt-run-much/Makefile
2726
run-make/dep-info-spaces/Makefile
2827
run-make/dep-info/Makefile
@@ -39,7 +38,6 @@ run-make/export-executable-symbols/Makefile
3938
run-make/extern-diff-internal-name/Makefile
4039
run-make/extern-flag-disambiguates/Makefile
4140
run-make/extern-flag-pathless/Makefile
42-
run-make/extern-flag-rename-transitive/Makefile
4341
run-make/extern-fn-explicit-align/Makefile
4442
run-make/extern-fn-generic/Makefile
4543
run-make/extern-fn-mangle/Makefile
@@ -50,10 +48,8 @@ run-make/extern-fn-with-packed-struct/Makefile
5048
run-make/extern-fn-with-union/Makefile
5149
run-make/extern-multiple-copies/Makefile
5250
run-make/extern-multiple-copies2/Makefile
53-
run-make/extern-overrides-distribution/Makefile
5451
run-make/extra-filename-with-temp-outputs/Makefile
5552
run-make/fmt-write-bloat/Makefile
56-
run-make/forced-unwind-terminate-pof/Makefile
5753
run-make/foreign-double-unwind/Makefile
5854
run-make/foreign-exceptions/Makefile
5955
run-make/foreign-rust-exceptions/Makefile
@@ -119,7 +115,6 @@ run-make/macos-fat-archive/Makefile
119115
run-make/manual-link/Makefile
120116
run-make/many-crates-but-no-match/Makefile
121117
run-make/metadata-dep-info/Makefile
122-
run-make/metadata-flag-frobs-symbols/Makefile
123118
run-make/min-global-align/Makefile
124119
run-make/mingw-export-call-convention/Makefile
125120
run-make/mismatching-target-triples/Makefile

‎tests/run-make/debugger-visualizer-dep-info/Makefile

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This test checks that files referenced via #[debugger_visualizer] are
2+
// included in `--emit dep-info` output.
3+
// See https://github.com/rust-lang/rust/pull/111641
4+
5+
use run_make_support::{invalid_utf8_contains, rustc};
6+
7+
fn main() {
8+
rustc().emit("dep-info").input("main.rs").run();
9+
invalid_utf8_contains("main.d", "foo.py");
10+
invalid_utf8_contains("main.d", "my_visualizers/bar.natvis");
11+
}

‎tests/run-make/extern-flag-rename-transitive/Makefile

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// In this test, baz.rs is looking for an extern crate "a" which
2+
// does not exist, and can only run through the --extern rustc flag
3+
// defining that the "a" crate is in fact just "foo". This test
4+
// checks that the --extern flag takes precedence over the extern
5+
// crate statement in the code.
6+
// See https://github.com/rust-lang/rust/pull/52723
7+
8+
use run_make_support::{rust_lib_name, rustc};
9+
10+
fn main() {
11+
rustc().input("foo.rs").run();
12+
rustc().input("bar.rs").run();
13+
rustc().input("baz.rs").extern_("a", rust_lib_name("foo")).run();
14+
}

‎tests/run-make/extern-overrides-distribution/Makefile

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// The --extern flag should override any "crate_type" declarations in the
2+
// Rust files themselves. In this test, libc is compiled as "lib", but
3+
// main.rs will only run with an rlib, which checks if the --extern flag
4+
// is successfully overriding the default behaviour.
5+
// See https://github.com/rust-lang/rust/pull/21782
6+
7+
//@ ignore-cross-compile
8+
9+
use run_make_support::{rust_lib_name, rustc};
10+
11+
fn main() {
12+
rustc().input("libc.rs").metadata("foo").run();
13+
rustc().input("main.rs").extern_("libc", rust_lib_name("libc")).run();
14+
}

‎tests/run-make/forced-unwind-terminate-pof/Makefile

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// During a forced unwind, crossing the non-Plain Old Frame
2+
// would define the forced unwind as undefined behaviour, and
3+
// immediately abort the unwinding process. This test checks
4+
// that the forced unwinding takes precedence.
5+
// See https://github.com/rust-lang/rust/issues/101469
6+
7+
//@ ignore-cross-compile
8+
//@ ignore-windows
9+
//Reason: pthread (POSIX threads) is not available on Windows
10+
11+
use run_make_support::{run, rustc};
12+
13+
fn main() {
14+
rustc().input("foo.rs").run();
15+
run("foo").assert_stdout_not_contains("cannot unwind");
16+
}

‎tests/run-make/metadata-flag-frobs-symbols/Makefile

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// In this test, foo.rs is compiled twice with different hashes tied to its
2+
// symbols thanks to the metadata flag. bar.rs then ensures that the memory locations
3+
// of foo's symbols are different even though they came from the same original source code.
4+
// This checks that the metadata flag is doing its job.
5+
// See https://github.com/rust-lang/rust/issues/14471
6+
7+
//@ ignore-cross-compile
8+
9+
use run_make_support::{run, rust_lib_name, rustc};
10+
11+
fn main() {
12+
rustc().input("foo.rs").metadata("a").extra_filename("-a").run();
13+
rustc().input("foo.rs").metadata("b").extra_filename("-b").run();
14+
rustc()
15+
.input("bar.rs")
16+
.extern_("foo1", rust_lib_name("foo-a"))
17+
.extern_("foo2", rust_lib_name("foo-b"))
18+
.print("link-args")
19+
.run();
20+
run("bar");
21+
}

0 commit comments

Comments
 (0)
Failed to load comments.