Skip to content

Commit

Permalink
Auto merge of #126805 - Oneirical:weaves-of-testiny, r=<try>
Browse files Browse the repository at this point in the history
Migrate `pdb-alt-path`, `mismatching-target-triples` and `mingw-export-call-convention` `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).

Needs MSVC try jobs.

try-job: x86_64-mingw
try-job: x86_64-msvc
  • Loading branch information
bors committed Jun 25, 2024
2 parents d929a42 + a2ed16c commit c00f017
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 43 deletions.
3 changes: 0 additions & 3 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ run-make/manual-link/Makefile
run-make/many-crates-but-no-match/Makefile
run-make/metadata-dep-info/Makefile
run-make/min-global-align/Makefile
run-make/mingw-export-call-convention/Makefile
run-make/mismatching-target-triples/Makefile
run-make/missing-crate-dependency/Makefile
run-make/mixing-libs/Makefile
run-make/msvc-opt-minsize/Makefile
Expand All @@ -128,7 +126,6 @@ run-make/pass-linker-flags-flavor/Makefile
run-make/pass-linker-flags-from-dep/Makefile
run-make/pass-linker-flags/Makefile
run-make/pass-non-c-like-enum-to-c/Makefile
run-make/pdb-alt-path/Makefile
run-make/pdb-buildinfo-cl-cmd/Makefile
run-make/pgo-gen-lto/Makefile
run-make/pgo-gen-no-imp-symbols/Makefile
Expand Down
9 changes: 0 additions & 9 deletions tests/run-make/mingw-export-call-convention/Makefile

This file was deleted.

13 changes: 13 additions & 0 deletions tests/run-make/mingw-export-call-convention/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// On windows-gnu, symbol exporting used to fail to export names
// with no_mangle. #72049 brought this feature up to par with msvc,
// and this test checks that the symbol "bar" is successfully exported.
// See https://github.com/rust-lang/rust/issues/50176

//@ only-x86_64-pc-windows-gnu

use run_make_support::{llvm_readobj, rustc};

fn main() {
rustc().input("foo.rs").run();
llvm_readobj().arg("--all").input("libfoo.dll.a").run().assert_stdout_contains("bar");
}
11 changes: 0 additions & 11 deletions tests/run-make/mismatching-target-triples/Makefile

This file was deleted.

15 changes: 15 additions & 0 deletions tests/run-make/mismatching-target-triples/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// In this test, foo links against 32-bit architecture, and then, bar, which depends
// on foo, links against 64-bit architecture, causing a metadata mismatch due to the
// differences in target architectures. This used to cause an internal compiler error,
// now replaced by a clearer normal error message. This test checks that this aforementioned
// error message is used.
// See https://github.com/rust-lang/rust/issues/10814

use run_make_support::rustc;

fn main() {
rustc().input("foo.rs").target("i686-unknown-linux-gnu").run();
rustc().input("bar.rs").target("x86_64-unknown-linux-gnu").run_fail().assert_stderr_contains(
r#"couldn't find crate `foo` with expected target triple x86_64-unknown-linux-gnu"#,
);
}
20 changes: 0 additions & 20 deletions tests/run-make/pdb-alt-path/Makefile

This file was deleted.

39 changes: 39 additions & 0 deletions tests/run-make/pdb-alt-path/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// The information inside a .exe file contains a string of the PDB file name.
// This could be a security concern if the full path was exposed, as it could
// reveal information about the filesystem where the bin was first compiled.
// This should only be overridden by `-Clink-arg=/PDBALTPATH:...` - this test
// checks that no full file paths are exposed and that the override flag is respected.
// See https://github.com/rust-lang/rust/pull/121297

//@ only-x86_64-pc-windows-msvc

use run_make_support::{bin_name, invalid_utf8_contains, invalid_utf8_not_contains, run, rustc};

fn main() {
// Test that we don't have the full path to the PDB file in the binary
rustc()
.input("main.rs")
.arg("-g")
.crate_name("my_crate_name")
.crate_type("bin")
.arg("-Cforce-frame-pointers")
.run();
invalid_utf8_contains(&bin_name("my_crate_name"), "my_crate_name.pdb");
invalid_utf8_not_contains(&bin_name("my_crate_name"), r#"\my_crate_name.pdb"#);
// Test that backtraces still can find debuginfo by checking that they contain symbol names and
// source locations.
let out = run(&bin_name("my_crate_name"));
out.assert_stdout_contains("my_crate_name::fn_in_backtrace");
out.assert_stdout_contains("main.rs:15");
// Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
rustc()
.input("main.rs")
.arg("-g")
.crate_name("my_crate_name")
.crate_type("bin")
.link_arg("/PDBALTPATH:abcdefg.pdb")
.arg("-Cforce-frame-pointers")
.run();
invalid_utf8_contains(&bin_name("my_crate_name"), "abcdefg.pdb");
invalid_utf8_not_contains(&bin_name("my_crate_name"), "my_crate_name.pdb");
}

0 comments on commit c00f017

Please sign in to comment.