From a7a7db0443840a21749fd6f3a61a317e0e2c13e7 Mon Sep 17 00:00:00 2001 From: Florian Schmiderer Date: Fri, 6 Sep 2024 23:38:54 +0200 Subject: [PATCH] Add Unit test for S_OBJNAME --- tests/run-make/pdb-sobjname/filecheck.txt | 1 + tests/run-make/pdb-sobjname/main.rs | 1 + tests/run-make/pdb-sobjname/rmake.rs | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 tests/run-make/pdb-sobjname/filecheck.txt create mode 100644 tests/run-make/pdb-sobjname/main.rs create mode 100644 tests/run-make/pdb-sobjname/rmake.rs diff --git a/tests/run-make/pdb-sobjname/filecheck.txt b/tests/run-make/pdb-sobjname/filecheck.txt new file mode 100644 index 0000000000000..80e5c0037e8b2 --- /dev/null +++ b/tests/run-make/pdb-sobjname/filecheck.txt @@ -0,0 +1 @@ +CHECK: S_OBJNAME{{.+}}my_great_crate_name{{.+}}.o \ No newline at end of file diff --git a/tests/run-make/pdb-sobjname/main.rs b/tests/run-make/pdb-sobjname/main.rs new file mode 100644 index 0000000000000..f328e4d9d04c3 --- /dev/null +++ b/tests/run-make/pdb-sobjname/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/pdb-sobjname/rmake.rs b/tests/run-make/pdb-sobjname/rmake.rs new file mode 100644 index 0000000000000..a9c9013c4bdfa --- /dev/null +++ b/tests/run-make/pdb-sobjname/rmake.rs @@ -0,0 +1,18 @@ +// Check if the pdb file contains an S_OBJNAME entry with the name of the .o file + +// This is because it used to be missing in #96475. +// See https://github.com/rust-lang/rust/pull/115704 + +//@ only-windows-msvc +// Reason: pdb files are unique to this architecture + +use run_make_support::{llvm, rustc}; + +fn main() { + rustc().input("main.rs").arg("-g").crate_name("my_great_crate_name").crate_type("bin").run(); + + let pdbutil_result = + llvm::LlvmPdbutil::new().arg("dump").arg("-symbols").input("my_great_crate_name.pdb").run(); + + llvm::llvm_filecheck().patterns("filecheck.txt").stdin_buf(pdbutil_result.stdout_utf8()).run(); +}