diff options
| author | Urgau <urgau@numericable.fr> | 2023-08-25 11:32:30 +0200 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2023-10-17 10:11:31 +0200 |
| commit | ab92dc37866ee9ee5a1ee95b0e997c15ab342ca7 (patch) | |
| tree | 2b3f0d5d34f4880ec34c4e39363d78d783c43aac | |
| parent | dcde31ad1e9af2a73592320af6c32d016a38aa26 (diff) | |
| download | rust-ab92dc37866ee9ee5a1ee95b0e997c15ab342ca7.tar.gz rust-ab92dc37866ee9ee5a1ee95b0e997c15ab342ca7.zip | |
[RFC 3127 - Trim Paths]: Adjust tests for -Zremap-path-scope
| -rw-r--r-- | tests/run-make/remap-path-prefix-dwarf/Makefile | 29 | ||||
| -rw-r--r-- | tests/run-make/remap-path-prefix/Makefile | 16 | ||||
| -rw-r--r-- | tests/run-make/split-debuginfo/Makefile | 64 |
3 files changed, 107 insertions, 2 deletions
diff --git a/tests/run-make/remap-path-prefix-dwarf/Makefile b/tests/run-make/remap-path-prefix-dwarf/Makefile index c9ede1b6027..cfbf1237325 100644 --- a/tests/run-make/remap-path-prefix-dwarf/Makefile +++ b/tests/run-make/remap-path-prefix-dwarf/Makefile @@ -11,9 +11,12 @@ include ../tools.mk 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 +30,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 + # 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 +66,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 + "$(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 + "$(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 diff --git a/tests/run-make/remap-path-prefix/Makefile b/tests/run-make/remap-path-prefix/Makefile index 2a7378fdf9e..1d2459236c4 100644 --- a/tests/run-make/remap-path-prefix/Makefile +++ b/tests/run-make/remap-path-prefix/Makefile @@ -7,3 +7,19 @@ all: $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux --crate-type=lib --emit=metadata auxiliary/lib.rs grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 + + $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=object --crate-type=lib --emit=metadata auxiliary/lib.rs + grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 + ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 + + $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=diagnostics --crate-type=lib --emit=metadata auxiliary/lib.rs + ! grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 + grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 + + $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=diagnostics,object --crate-type=lib --emit=metadata auxiliary/lib.rs + grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 + ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 + + $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=split-debuginfo --crate-type=lib --emit=metadata auxiliary/lib.rs + ! grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1 + grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1 diff --git a/tests/run-make/split-debuginfo/Makefile b/tests/run-make/split-debuginfo/Makefile index 71e014c1f71..9e05c8dc179 100644 --- a/tests/run-make/split-debuginfo/Makefile +++ b/tests/run-make/split-debuginfo/Makefile @@ -104,7 +104,7 @@ packed-lto-single: ls $(TMPDIR)/*.dwp && exit 1 || exit 0 rm $(TMPDIR)/libbaz.rlib -packed-remapped: packed-remapped-split packed-remapped-single +packed-remapped: packed-remapped-split packed-remapped-single packed-remapped-scope packed-remapped-wrong-scope # - Debuginfo in `.dwo` files # - `.o` and binary refer to remapped `.dwo` paths which do not exist @@ -134,6 +134,36 @@ packed-remapped-single: rm $(TMPDIR)/foo.dwp rm $(TMPDIR)/$(call BIN,foo) +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` present +packed-remapped-scope: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ + -Z remap-path-scope=split-debuginfo-path foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` deleted +# - `.dwo` never created +# - `.dwp` present +packed-remapped-wrong-scope: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ + -Z remap-path-scope=macro foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1 + ls $(TMPDIR)/*.o && exit 1 || exit 0 + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + rm $(TMPDIR)/foo.dwp + rm $(TMPDIR)/$(call BIN,foo) + packed-crosscrate: packed-crosscrate-split packed-crosscrate-single # - Debuginfo in `.dwo` files @@ -230,7 +260,7 @@ unpacked-lto-single: ls $(TMPDIR)/*.dwp && exit 1 || exit 0 rm $(TMPDIR)/libbaz.rlib -unpacked-remapped: unpacked-remapped-split unpacked-remapped-single +unpacked-remapped: unpacked-remapped-split unpacked-remapped-single unpacked-remapped-scope unpacked-remapped-wrong-scope # - Debuginfo in `.dwo` files # - `.o` and binary refer to remapped `.dwo` paths which do not exist @@ -260,6 +290,36 @@ unpacked-remapped-single: ls $(TMPDIR)/*.dwp && exit 1 || exit 0 rm $(TMPDIR)/$(call BIN,foo) +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` present +# - `.dwo` never created +# - `.dwp` never created +unpacked-remapped-scope: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ + -Z remap-path-scope=split-debuginfo-path foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 + rm $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + +# - Debuginfo in `.o` files +# - `.o` and binary refer to remapped `.o` paths which do not exist +# - `.o` present +# - `.dwo` never created +# - `.dwp` never created +unpacked-remapped-wrong-scope: + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ + -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ + -Z remap-path-scope=macro foo.rs -g + objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1 + rm $(TMPDIR)/*.o + ls $(TMPDIR)/*.dwo && exit 1 || exit 0 + ls $(TMPDIR)/*.dwp && exit 1 || exit 0 + rm $(TMPDIR)/$(call BIN,foo) + unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single # - Debuginfo in `.dwo` files |
