summaryrefslogtreecommitdiffstats
path: root/tests/run-make/remap-path-prefix-dwarf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make/remap-path-prefix-dwarf/Makefile')
-rw-r--r--tests/run-make/remap-path-prefix-dwarf/Makefile37
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/run-make/remap-path-prefix-dwarf/Makefile b/tests/run-make/remap-path-prefix-dwarf/Makefile
index c9ede1b60..8905a00ea 100644
--- a/tests/run-make/remap-path-prefix-dwarf/Makefile
+++ b/tests/run-make/remap-path-prefix-dwarf/Makefile
@@ -3,17 +3,26 @@
# ignore-windows
+include ../tools.mk
+
SRC_DIR := $(abspath .)
SRC_DIR_PARENT := $(abspath ..)
-include ../tools.mk
+ifeq ($(UNAME),Darwin)
+ DEBUGINFOOPTS := -Csplit-debuginfo=off
+else
+ DEBUGINFOOPTS :=
+endif
all: \
abs_input_outside_working_dir \
rel_input_remap_working_dir \
+ rel_input_remap_working_dir_scope \
rel_input_remap_working_dir_parent \
rel_input_remap_working_dir_child \
+ rel_input_remap_working_dir_diagnostics \
abs_input_inside_working_dir \
+ abs_input_inside_working_dir_scope \
abs_input_outside_working_dir
# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within
@@ -27,6 +36,17 @@ abs_input_inside_working_dir:
# No weird duplication of remapped components (see #78479)
"$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir.rlib | $(CGREP) -v "REMAPPED/REMAPPED"
+# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within
+# the working directory of the compiler. We are remapping the path that contains `src`.
+abs_input_inside_working_dir_scope:
+ # We explicitly switch to a directory that *is* a prefix of the directory our
+ # source code is contained in.
+ cd $(SRC_DIR) && $(RUSTC) $(SRC_DIR)/src/quux.rs -o "$(TMPDIR)/abs_input_inside_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix $(SRC_DIR)=REMAPPED -Zremap-path-scope=object $(DEBUGINFOOPTS)
+ # We expect the path to the main source file to be remapped.
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) "REMAPPED/src/quux.rs"
+ # No weird duplication of remapped components (see #78479)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) -v "REMAPPED/REMAPPED"
+
# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path is *not* within
# the working directory of the compiler. We are remapping both the path that contains `src` and
# the working directory to the same thing. This setup corresponds to a workaround that is needed
@@ -52,6 +72,21 @@ rel_input_remap_working_dir:
# No weird duplication of remapped components (see #78479)
"$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+# The compiler is called with a *RELATIVE PATH* as input. We are remapping the working directory of
+# the compiler, which naturally is an implicit prefix of our relative input path. Debuginfo will
+# expand the relative path to an absolute path and we expect the working directory to be remapped
+# in that expansion.
+rel_input_remap_working_dir_scope:
+ cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=object $(DEBUGINFOOPTS)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) "REMAPPED/src/quux.rs"
+ # No weird duplication of remapped components (see #78479)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+
+rel_input_remap_working_dir_diagnostics:
+ cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=diagnostics $(DEBUGINFOOPTS)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/src/quux.rs"
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+
# The compiler is called with a *RELATIVE PATH* as input. We are remapping a *SUB-DIRECTORY* of the
# compiler's working directory. This test makes sure that that directory is remapped even though it
# won't actually show up in this form in the compiler's SourceMap and instead is only constructed