|
| 1 | +// This test makes sure that changes to files referenced via //[debugger_visualizer] |
| 2 | +// are picked up when compiling incrementally. |
| 3 | + |
| 4 | +// We have to copy the source to $(TMPDIR) because Github CI mounts the source |
| 5 | +// directory as readonly. We need to apply modifications to some of the source |
| 6 | +// file. |
| 7 | + |
| 8 | +use run_make_support::{ |
| 9 | + fs_wrapper, invalid_utf8_contains_str, invalid_utf8_not_contains_str, rustc, |
| 10 | +}; |
| 11 | +use std::io::Read; |
| 12 | + |
| 13 | +fn main() { |
| 14 | + fs_wrapper::create_file("foo.py"); |
| 15 | + fs_wrapper::write("foo.py", "GDB script v1"); |
| 16 | + fs_wrapper::create_file("foo.natvis"); |
| 17 | + fs_wrapper::write("foo.py", "Natvis v1"); |
| 18 | + rustc() |
| 19 | + .input("foo.rs") |
| 20 | + .crate_type("rlib") |
| 21 | + .emit("metadata") |
| 22 | + .incremental("incremental") |
| 23 | + .arg("-Zincremental-verify-ich") |
| 24 | + .run(); |
| 25 | + |
| 26 | + invalid_utf8_contains_str("libfoo.rmeta", "GDB script v1"); |
| 27 | + invalid_utf8_contains_str("libfoo.rmeta", "Natvis v1"); |
| 28 | + |
| 29 | + // Change only the GDB script and check that the change has been picked up |
| 30 | + fs_wrapper::remove_file("foo.py"); |
| 31 | + fs_wrapper::create_file("foo.py"); |
| 32 | + fs_wrapper::write("foo.py", "GDB script v2"); |
| 33 | + rustc() |
| 34 | + .input("foo.rs") |
| 35 | + .crate_type("rlib") |
| 36 | + .emit("metadata") |
| 37 | + .incremental("incremental") |
| 38 | + .arg("-Zincremental-verify-ich") |
| 39 | + .run(); |
| 40 | + |
| 41 | + invalid_utf8_contains_str("libfoo.rmeta", "GDB script v2"); |
| 42 | + invalid_utf8_not_contains_str("libfoo.rmeta", "GDB script v1"); |
| 43 | + invalid_utf8_contains_str("libfoo.rmeta", "Natvis v1"); |
| 44 | + |
| 45 | + // Now change the Natvis version and check that the change has been picked up |
| 46 | + fs_wrapper::remove_file("foo.natvis"); |
| 47 | + fs_wrapper::create_file("foo.natvis"); |
| 48 | + fs_wrapper::write("foo.py", "Natvis v2"); |
| 49 | + rustc() |
| 50 | + .input("foo.rs") |
| 51 | + .crate_type("rlib") |
| 52 | + .emit("metadata") |
| 53 | + .incremental("incremental") |
| 54 | + .arg("-Zincremental-verify-ich") |
| 55 | + .run(); |
| 56 | + |
| 57 | + invalid_utf8_contains_str("libfoo.rmeta", "GDB script v2"); |
| 58 | + invalid_utf8_not_contains_str("libfoo.rmeta", "GDB script v1"); |
| 59 | + invalid_utf8_not_contains_str("libfoo.rmeta", "Natvis v1"); |
| 60 | + invalid_utf8_contains_str("libfoo.rmeta", "Natvis v2"); |
| 61 | +} |
0 commit comments