rust/tests/run-make/pdb-buildinfo-cl-cmd/rmake.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
Rust
Raw Normal View History

2024-07-29 15:16:55 -05:00
// 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, bstr, env_var, rfs, rustc};
2024-07-29 15:16:55 -05:00
fn main() {
rustc()
.input("main.rs")
.arg("-g")
.crate_name("my_crate_name")
.crate_type("bin")
.metadata("dc9ef878b0a48666")
.run();
let tests = [
&env_var("RUSTC"),
2024-07-29 15:16:55 -05:00
r#""main.rs""#,
r#""-g""#,
r#""--crate-name""#,
r#""my_crate_name""#,
r#""--crate-type""#,
r#""bin""#,
r#""-Cmetadata=dc9ef878b0a48666""#,
2024-07-29 15:16:55 -05:00
];
for test in tests {
assert_pdb_contains(test);
2024-07-29 15:16:55 -05:00
}
}
fn assert_pdb_contains(needle: &str) {
let needle = needle.as_bytes();
use bstr::ByteSlice;
assert!(&rfs::read("my_crate_name.pdb").find(needle).is_some());
}