Skip to content

Commit 0c4a7a4

Browse files
committed
Auto merge of #128363 - Oneirical:not-to-be-undertestimated, r=<try>
Migrate `pdb-buildinfo-cl-cmd` and `pgo-indirect-call-promotion` `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). Please try: try-job: x86_64-msvc
2 parents e69c19e + c866959 commit 0c4a7a4

File tree

7 files changed

+69
-42
lines changed

7 files changed

+69
-42
lines changed

src/tools/compiletest/src/command-list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
202202
"only-watchos",
203203
"only-windows",
204204
"only-windows-gnu",
205+
"only-windows-msvc",
205206
"only-x86",
206207
"only-x86_64",
207208
"only-x86_64-fortanix-unknown-sgx",

src/tools/tidy/src/allowed_run_make_makefiles.txt

-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ run-make/native-link-modifier-bundle/Makefile
3434
run-make/native-link-modifier-whole-archive/Makefile
3535
run-make/no-alloc-shim/Makefile
3636
run-make/no-builtins-attribute/Makefile
37-
run-make/pdb-buildinfo-cl-cmd/Makefile
3837
run-make/pgo-gen-lto/Makefile
39-
run-make/pgo-indirect-call-promotion/Makefile
4038
run-make/print-calling-conventions/Makefile
4139
run-make/print-target-list/Makefile
4240
run-make/raw-dylib-alt-calling-convention/Makefile

tests/run-make/pdb-buildinfo-cl-cmd/Makefile

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Check if the pdb file contains the following information in the LF_BUILDINFO:
2+
// 1. full path to the compiler (cl)
3+
// 2. the commandline args to compile it (cmd)
4+
// This is because these used to be missing in #96475.
5+
// See https://github.com/rust-lang/rust/pull/113492
6+
7+
//@ only-windows-msvc
8+
// Reason: pdb files are unique to this architecture
9+
10+
use run_make_support::{assert_contains, env_var, rfs, rustc};
11+
12+
fn main() {
13+
rustc()
14+
.input("main.rs")
15+
.arg("-g")
16+
.crate_name("my_crate_name")
17+
.crate_type("bin")
18+
.metadata("dc9ef878b0a48666")
19+
.run();
20+
assert_contains(rfs::read_to_string("my_crate_name.pdb"), env_var("RUSTC_ORIGINAL"));
21+
let strings = [
22+
r#""main.rs""#,
23+
r#""-g""#,
24+
r#""--crate-name""#,
25+
r#""my_crate_name""#,
26+
r#""--crate-type""#,
27+
r#""bin""#,
28+
r#""-C""#,
29+
r#""metadata=dc9ef878b0a48666""#,
30+
r#""--out-dir""#,
31+
];
32+
for string in strings {
33+
assert_contains(rfs::read_to_string("my_crate_name.pdb"), string);
34+
}
35+
}

tests/run-make/pdb-buildinfo-cl-cmd/stringlist.txt

-1
This file was deleted.

tests/run-make/pgo-indirect-call-promotion/Makefile

-23
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This test checks that indirect call promotion is performed. The test
2+
// programs calls the same function a thousand times through a function pointer.
3+
// Only PGO data provides the information that it actually always is the same
4+
// function. We verify that the indirect call promotion pass inserts a check
5+
// whether it can make a direct call instead of the indirect call.
6+
// See https://github.com/rust-lang/rust/pull/66631
7+
8+
//@ needs-profiler-support
9+
// Reason: llvm_profdata is used
10+
//@ ignore-cross-compile
11+
// Reason: the compiled binary is executed
12+
13+
use run_make_support::{llvm_filecheck, llvm_profdata, rfs, run, rustc};
14+
15+
fn main() {
16+
// We don't compile `opaque` with either optimizations or instrumentation.
17+
rustc().input("opaque.rs").run();
18+
// Compile the test program with instrumentation
19+
rfs::create_dir("prof_data_dir");
20+
rustc().input("interesting.rs").profile_generate("prof_data_dir").opt().codegen_units(1).run();
21+
rustc().input("main.rs").profile_generate("prof_data_dir").opt().run();
22+
// The argument below generates to the expected branch weights
23+
run("main");
24+
llvm_profdata().merge().output("prof_data_dir/merged.profdata").input("prof_data_dir").run();
25+
rustc()
26+
.input("interesting.rs")
27+
.profile_use("prof_data_dir/merged.profdata")
28+
.opt()
29+
.codegen_units(1)
30+
.emit("llvm-ir")
31+
.run();
32+
llvm_filecheck().patterns("filecheck-patterns.txt").stdin(rfs::read("interesting.ll")).run();
33+
}

0 commit comments

Comments
 (0)