mirror of https://github.com/rust-lang/rust.git
Add/improve tests for debugger_visualizer change detection.
This commit is contained in:
parent
d623668551
commit
cfca5b0b87
|
@ -1,8 +1,9 @@
|
|||
# ignore-windows-gnu
|
||||
|
||||
include ../tools.mk
|
||||
|
||||
# This test makes sure that files referenced via #[debugger_visualizer] are
|
||||
# included in `--emit dep-info` output.
|
||||
|
||||
all:
|
||||
$(RUSTC) --emit dep-info main.rs
|
||||
$(CGREP) "foo.py" < $(TMPDIR)/main.d
|
||||
$(CGREP) "my_visualizers/bar.py" < $(TMPDIR)/main.d
|
||||
$(CGREP) "my_visualizers/bar.natvis" < $(TMPDIR)/main.d
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
fn main() {
|
||||
const _UNUSED: u32 = {
|
||||
mod inner {
|
||||
#![debugger_visualizer(gdb_script_file = "my_visualizers/bar.py")]
|
||||
#![debugger_visualizer(natvis_file = "my_visualizers/bar.natvis")]
|
||||
pub const XYZ: u32 = 123;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<!-- empty -->
|
|
@ -1 +0,0 @@
|
|||
# empty
|
|
@ -0,0 +1,51 @@
|
|||
include ../tools.mk
|
||||
|
||||
# This test makes sure that changes to files referenced via #[debugger_visualizer]
|
||||
# are picked up when compiling incrementally.
|
||||
|
||||
# We have to copy the source to $(TMPDIR) because Github CI mounts the source
|
||||
# directory as readonly. We need to apply modifications to some of the source
|
||||
# file.
|
||||
SRC_DIR := $(TMPDIR)/src
|
||||
|
||||
INCR_CACHE_DIR := $(TMPDIR)/incremental
|
||||
|
||||
|
||||
all:
|
||||
rm -rf $(TMPDIR)/*
|
||||
mkdir $(SRC_DIR)
|
||||
cp -t $(SRC_DIR) ./foo.rs
|
||||
echo "GDB script v1" > $(SRC_DIR)/foo.py
|
||||
echo "Natvis v1" > $(SRC_DIR)/foo.natvis
|
||||
$(RUSTC) $(SRC_DIR)/foo.rs \
|
||||
--crate-type=rlib \
|
||||
--emit metadata \
|
||||
-C incremental=$(INCR_CACHE_DIR) \
|
||||
-Z incremental-verify-ich
|
||||
$(CGREP) "GDB script v1" < $(TMPDIR)/libfoo.rmeta
|
||||
$(CGREP) "Natvis v1" < $(TMPDIR)/libfoo.rmeta
|
||||
|
||||
# Change only the GDB script and check that the change has been picked up
|
||||
echo "GDB script v2" > $(SRC_DIR)/foo.py
|
||||
$(RUSTC) $(SRC_DIR)/foo.rs \
|
||||
--crate-type=rlib \
|
||||
--emit metadata \
|
||||
-C incremental=$(INCR_CACHE_DIR) \
|
||||
-Z incremental-verify-ich
|
||||
|
||||
$(CGREP) "GDB script v2" < $(TMPDIR)/libfoo.rmeta
|
||||
$(CGREP) -v "GDB script v1" < $(TMPDIR)/libfoo.rmeta
|
||||
$(CGREP) "Natvis v1" < $(TMPDIR)/libfoo.rmeta
|
||||
|
||||
# Now change the Natvis version and check that the change has been picked up
|
||||
echo "Natvis v2" > $(SRC_DIR)/foo.natvis
|
||||
$(RUSTC) $(SRC_DIR)/foo.rs \
|
||||
--crate-type=rlib \
|
||||
--emit metadata \
|
||||
-C incremental=$(INCR_CACHE_DIR) \
|
||||
-Z incremental-verify-ich
|
||||
|
||||
$(CGREP) "GDB script v2" < $(TMPDIR)/libfoo.rmeta
|
||||
$(CGREP) -v "GDB script v1" < $(TMPDIR)/libfoo.rmeta
|
||||
$(CGREP) "Natvis v2" < $(TMPDIR)/libfoo.rmeta
|
||||
$(CGREP) -v "Natvis v1" < $(TMPDIR)/libfoo.rmeta
|
|
@ -0,0 +1,6 @@
|
|||
#![debugger_visualizer(natvis_file = "./foo.natvis")]
|
||||
#![debugger_visualizer(gdb_script_file = "./foo.py")]
|
||||
|
||||
pub struct Foo {
|
||||
pub x: u32,
|
||||
}
|
Loading…
Reference in New Issue