Skip to content

Commit a5ba40d

Browse files
authored
Unrolled build for rust-lang#128363
Rollup merge of rust-lang#128363 - Oneirical:not-to-be-undertestimated, r=jieyouxu Migrate `pdb-buildinfo-cl-cmd` and `pgo-indirect-call-promotion` `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). Please try: try-job: x86_64-msvc try-job: x86_64-mingw try-job: i686-msvc try-job: i686-mingw try-job: x86_64-gnu-llvm-17 try-job: aarch64-apple
2 parents 8b38707 + 7d1a97f commit a5ba40d

File tree

7 files changed

+73
-42
lines changed

7 files changed

+73
-42
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
204204
"only-watchos",
205205
"only-windows",
206206
"only-windows-gnu",
207+
"only-windows-msvc",
207208
"only-x86",
208209
"only-x86_64",
209210
"only-x86_64-fortanix-unknown-sgx",

src/tools/tidy/src/allowed_run_make_makefiles.txt

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ run-make/macos-deployment-target/Makefile
1616
run-make/min-global-align/Makefile
1717
run-make/native-link-modifier-bundle/Makefile
1818
run-make/no-alloc-shim/Makefile
19-
run-make/pdb-buildinfo-cl-cmd/Makefile
20-
run-make/pgo-indirect-call-promotion/Makefile
2119
run-make/remap-path-prefix-dwarf/Makefile
2220
run-make/reproducible-build/Makefile
2321
run-make/rlib-format-packed-bundled-libs/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,39 @@
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, bstr, 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+
let tests = [
21+
&env_var("RUSTC"),
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#""-Cmetadata=dc9ef878b0a48666""#,
29+
];
30+
for test in tests {
31+
assert_pdb_contains(test);
32+
}
33+
}
34+
35+
fn assert_pdb_contains(needle: &str) {
36+
let needle = needle.as_bytes();
37+
use bstr::ByteSlice;
38+
assert!(&rfs::read("my_crate_name.pdb").find(needle).is_some());
39+
}

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)