about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Wörister <mworister@microsoft.com>2024-02-19 14:03:09 +0100
committerMichael Wörister <mworister@microsoft.com>2024-03-14 09:54:29 +0100
commit3c49fe0cbd86b452ba519ffe98ece4a620caee23 (patch)
tree5fd49bbe6bc6a25ca54ec6512cb06aac6672f8a1 /tests
parent9ce37dc7290e60bd0dfc7a5d4fcdbbd836f989f0 (diff)
downloadrust-3c49fe0cbd86b452ba519ffe98ece4a620caee23.tar.gz
rust-3c49fe0cbd86b452ba519ffe98ece4a620caee23.zip
link.exe: don't embed full path to PDB file in binary.
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/pdb-alt-path/Makefile20
-rw-r--r--tests/run-make/pdb-alt-path/main.rs3
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/run-make/pdb-alt-path/Makefile b/tests/run-make/pdb-alt-path/Makefile
new file mode 100644
index 00000000000..d7d435957a3
--- /dev/null
+++ b/tests/run-make/pdb-alt-path/Makefile
@@ -0,0 +1,20 @@
+include ../tools.mk
+
+# only-windows-msvc
+
+all:
+	# Test that we don't have the full path to the PDB file in the binary
+	$(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin
+	$(CGREP) "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
+	$(CGREP) -v "\\my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
+
+	# Test that backtraces still can find debuginfo by checking that they contain symbol names and
+	# source locations.
+	RUST_BACKTRACE="full" $(TMPDIR)/my_crate_name.exe &> $(TMPDIR)/backtrace.txt || exit 0
+	$(CGREP) "my_crate_name::main" < $(TMPDIR)/backtrace.txt
+	$(CGREP) "pdb-alt-path\\main.rs:2" < $(TMPDIR)/backtrace.txt
+
+	# Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected
+	$(RUSTC) main.rs -g --crate-name my_crate_name --crate-type bin -Clink-arg=/PDBALTPATH:abcdefg.pdb
+	$(CGREP) "abcdefg.pdb" < $(TMPDIR)/my_crate_name.exe
+	$(CGREP) -v "my_crate_name.pdb" < $(TMPDIR)/my_crate_name.exe
diff --git a/tests/run-make/pdb-alt-path/main.rs b/tests/run-make/pdb-alt-path/main.rs
new file mode 100644
index 00000000000..e95109fd08a
--- /dev/null
+++ b/tests/run-make/pdb-alt-path/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+    panic!("backtrace please");
+}