|
| 1 | +// Generating metadata alongside remap-path-prefix would fail to actually remap the path |
| 2 | +// in the metadata. After this was fixed in #85344, this test checks that "auxiliary" is being |
| 3 | +// successfully remapped to "/the/aux" in the rmeta files. |
| 4 | +// See https://github.com/rust-lang/rust/pull/85344 |
| 5 | + |
| 6 | +// FIXME(Oneirical): check if works without ignore-windows |
| 7 | + |
| 8 | +use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, is_darwin, rustc}; |
| 9 | + |
| 10 | +fn main() { |
| 11 | + let mut out_simple = rustc(); |
| 12 | + let mut out_object = rustc(); |
| 13 | + let mut out_macro = rustc(); |
| 14 | + let mut out_diagobj = rustc(); |
| 15 | + out_simple |
| 16 | + .remap_path_prefix("auxiliary", "/the/aux") |
| 17 | + .crate_type("lib") |
| 18 | + .emit("metadata") |
| 19 | + .input("auxiliary/lib.rs"); |
| 20 | + out_object |
| 21 | + .remap_path_prefix("auxiliary", "/the/aux") |
| 22 | + .crate_type("lib") |
| 23 | + .emit("metadata") |
| 24 | + .input("auxiliary/lib.rs"); |
| 25 | + out_macro |
| 26 | + .remap_path_prefix("auxiliary", "/the/aux") |
| 27 | + .crate_type("lib") |
| 28 | + .emit("metadata") |
| 29 | + .input("auxiliary/lib.rs"); |
| 30 | + out_diagobj |
| 31 | + .remap_path_prefix("auxiliary", "/the/aux") |
| 32 | + .crate_type("lib") |
| 33 | + .emit("metadata") |
| 34 | + .input("auxiliary/lib.rs"); |
| 35 | + |
| 36 | + out_simple.run(); |
| 37 | + invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs"); |
| 38 | + invalid_utf8_not_contains("liblib.rmeta", "auxiliary"); |
| 39 | + |
| 40 | + out_object.arg("-Zremap-path-scope=object"); |
| 41 | + out_macro.arg("-Zremap-path-scope=macro"); |
| 42 | + out_diagobj.arg("-Zremap-path-scope=diagnostics,object"); |
| 43 | + if is_darwin() { |
| 44 | + out_object.arg("-Csplit-debuginfo=off"); |
| 45 | + out_macro.arg("-Csplit-debuginfo=off"); |
| 46 | + out_diagobj.arg("-Csplit-debuginfo=off"); |
| 47 | + } |
| 48 | + |
| 49 | + out_object.run(); |
| 50 | + invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs"); |
| 51 | + invalid_utf8_not_contains("liblib.rmeta", "auxiliary"); |
| 52 | + out_macro.run(); |
| 53 | + invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs"); |
| 54 | + invalid_utf8_not_contains("liblib.rmeta", "auxiliary"); |
| 55 | + out_diagobj.run(); |
| 56 | + invalid_utf8_contains("liblib.rmeta", "/the/aux/lib.rs"); |
| 57 | + invalid_utf8_not_contains("liblib.rmeta", "auxiliary"); |
| 58 | +} |
0 commit comments