Skip to content

Commit

Permalink
Keep double remap test and add test with real std
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeuw committed Apr 3, 2021
1 parent 00700e5 commit 0afce07
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
8 changes: 0 additions & 8 deletions src/test/codegen/remap_path_prefix/auxiliary/pseudo_std.rs

This file was deleted.

14 changes: 14 additions & 0 deletions src/test/codegen/remap_path_prefix/double-remap-imported.rs
Original file line number Diff line number Diff line change
@@ -0,0 1,14 @@
// ignore-windows
// ignore-tidy-linelength

// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix=/the/aux-src=/the/double/remapped/aux-src
// aux-build:remap_path_prefix_aux.rs

extern crate remap_path_prefix_aux;

// Here we check that path can be remapped again after already having been
// remapped by compile-flags inside auxiliary/remap_path_prefix_aux.rs
// CHECK: !DIFile(filename: "/the/double/remapped/aux-src/remap_path_prefix_aux.rs", directory: ""
fn main() {
remap_path_prefix_aux::some_aux_function();
}
23 changes: 12 additions & 11 deletions src/test/codegen/remap_path_prefix/issue-73167-remap-std.rs
Original file line number Diff line number Diff line change
@@ -1,16 1,17 @@
// ignore-windows
// ignore-tidy-linelength

// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix=/home/USERNAME=REDACTED
// aux-build:pseudo_std.rs
// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}/library/std=/the/std

extern crate pseudo_std;
// Here we check that imported code from std has their path remapped.
// If we were to use an actual std function to test, we'd have to remap {{cwd}}/library/...,
// but that will break if rustc was built with remap-debuginfo = true in config.toml.
// Hence we simulate the path rust-src would take in a real linux installation
// by remapping the prefix inside pseudo_std.rs
// CHECK: !DIFile(filename: "REDACTED/TOOLCHAIN/lib/rustlib/src/rust/library/std/src/pseudo_std.rs", directory: ""
// Here we check that imported code from std has their path remapped
// Ideally we want to do
// COM: CHECK-NOT: !DIFile(filename: "{{cwd}}/library/std/src/thread/mod.rs"
// But {{cwd}} will not be expanded here, so we have to check on the bit afterwards
// Note that we can't use a positive check on `/the/std` either, because the rempap flag will
// have no effect when `remap-debuginfo` is set to true in `config.toml`, causing the test to fail

// CHECK-NOT: !DIFile(filename: "{{.*}}/library/std"
fn main() {
pseudo_std::some_std_function();
std::thread::spawn(|| {
println!("hello");
});
}

0 comments on commit 0afce07

Please sign in to comment.