compiletest: normalize paths from repository root
When testing macros from `rustc_macros` in `ui-fulldeps` tests, sometimes paths from the compiler source tree can be shown in error messages - these need to be normalized. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
5685abc96b
commit
b5545f1b0c
@ -3494,22 +3494,21 @@ impl<'test> TestCx<'test> {
|
|||||||
normalize_path(parent_dir, "$DIR");
|
normalize_path(parent_dir, "$DIR");
|
||||||
|
|
||||||
// Paths into the libstd/libcore
|
// Paths into the libstd/libcore
|
||||||
let src_dir = self
|
let base_dir = self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();
|
||||||
.config
|
let src_dir = base_dir.join("library");
|
||||||
.src_base
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.parent()
|
|
||||||
.unwrap()
|
|
||||||
.join("library");
|
|
||||||
normalize_path(&src_dir, "$SRC_DIR");
|
normalize_path(&src_dir, "$SRC_DIR");
|
||||||
|
|
||||||
|
// `ui-fulldeps` tests can show paths to the compiler source when testing macros from
|
||||||
|
// `rustc_macros`
|
||||||
|
// eg. /home/user/rust/compiler
|
||||||
|
let compiler_src_dir = base_dir.join("compiler");
|
||||||
|
normalize_path(&compiler_src_dir, "$COMPILER_DIR");
|
||||||
|
|
||||||
if let Some(virtual_rust_source_base_dir) =
|
if let Some(virtual_rust_source_base_dir) =
|
||||||
option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(PathBuf::from)
|
option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(PathBuf::from)
|
||||||
{
|
{
|
||||||
normalize_path(&virtual_rust_source_base_dir.join("library"), "$SRC_DIR");
|
normalize_path(&virtual_rust_source_base_dir.join("library"), "$SRC_DIR");
|
||||||
|
normalize_path(&virtual_rust_source_base_dir.join("compiler"), "$COMPILER_DIR");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paths into the build directory
|
// Paths into the build directory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user