rewrite pdb-buildinfo-cl-cmd to rmake

This commit is contained in:
Oneirical 2024-07-29 16:16:55 -04:00
parent 8d0066922b
commit 7e5a2ea583
4 changed files with 35 additions and 18 deletions

View File

@ -16,7 +16,6 @@ run-make/macos-deployment-target/Makefile
run-make/min-global-align/Makefile
run-make/native-link-modifier-bundle/Makefile
run-make/no-alloc-shim/Makefile
run-make/pdb-buildinfo-cl-cmd/Makefile
run-make/pgo-indirect-call-promotion/Makefile
run-make/remap-path-prefix-dwarf/Makefile
run-make/reproducible-build/Makefile

View File

@ -1,16 +0,0 @@
include ../tools.mk
# only-windows-msvc
# tests if the pdb contains the following information in the LF_BUILDINFO:
# 1. the commandline args to compile it (cmd)
# 2. full path to the compiler (cl)
# we just do a stringsearch on the pdb, as these need to show up at least once, as the LF_BUILDINFO is created for each cgu
# actual parsing would be better, but this is a simple and good enough solution for now
all:
$(RUSTC_ORIGINAL) main.rs -g --crate-name my_crate_name --crate-type bin -C metadata=dc9ef878b0a48666 --out-dir $(TMPDIR)
cat '$(TMPDIR)/my_crate_name.pdb' | grep -F '$(RUSTC_ORIGINAL)'
# using a file containing the string so I don't have problems with escaping quotes and spaces
cat '$(TMPDIR)/my_crate_name.pdb' | grep -f 'stringlist.txt'

View File

@ -0,0 +1,35 @@
// Check if the pdb file contains the following information in the LF_BUILDINFO:
// 1. full path to the compiler (cl)
// 2. the commandline args to compile it (cmd)
// This is because these used to be missing in #96475.
// See https://github.com/rust-lang/rust/pull/113492
//@ only-windows-msvc
// Reason: pdb files are unique to this architecture
use run_make_support::{assert_contains, env_var, rfs, rustc};
fn main() {
rustc()
.input("main.rs")
.arg("-g")
.crate_name("my_crate_name")
.crate_type("bin")
.metadata("dc9ef878b0a48666")
.run();
assert_contains(rfs::read_to_string("my_crate_name.pdb"), env_var("RUSTC_ORIGINAL"));
let strings = [
r#""main.rs""#,
r#""-g""#,
r#""--crate-name""#,
r#""my_crate_name""#,
r#""--crate-type""#,
r#""bin""#,
r#""-C""#,
r#""metadata=dc9ef878b0a48666""#,
r#""--out-dir""#,
];
for string in strings {
assert_contains(rfs::read_to_string("my_crate_name.pdb"), string);
}
}

View File

@ -1 +0,0 @@
"main.rs" "-g" "--crate-name" "my_crate_name" "--crate-type" "bin" "-C" "metadata=dc9ef878b0a48666" "--out-dir"