compiletest: normalize to $SRC_DIR_REAL before $TEST_BUILD_DIR

in case the real paths into the libstd/libcore are located inside the
the build directory, maybe because it's coming from an extracted dist
component in the build dir (cc opt-dist)
This commit is contained in:
Urgau 2024-09-28 21:44:44 +02:00
parent 61ef9838df
commit 37ea27c741

View File

@ -2301,6 +2301,12 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
// eg. /home/user/rust/compiler
normalize_path(&base_dir.join("compiler"), "$COMPILER_DIR");
// Real paths into the libstd/libcore
let rust_src_dir = &self.config.sysroot_base.join("lib/rustlib/src/rust");
rust_src_dir.try_exists().expect(&*format!("{} should exists", rust_src_dir.display()));
let rust_src_dir = rust_src_dir.read_link().unwrap_or(rust_src_dir.to_path_buf());
normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL");
// Paths into the build directory
let test_build_dir = &self.config.build_base;
let parent_build_dir = test_build_dir.parent().unwrap().parent().unwrap().parent().unwrap();
@ -2310,12 +2316,6 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
// eg. /home/user/rust/build
normalize_path(parent_build_dir, "$BUILD_DIR");
// Real paths into the libstd/libcore
let rust_src_dir = &self.config.sysroot_base.join("lib/rustlib/src/rust");
rust_src_dir.try_exists().expect(&*format!("{} should exists", rust_src_dir.display()));
let rust_src_dir = rust_src_dir.read_link().unwrap_or(rust_src_dir.to_path_buf());
normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL");
if json {
// escaped newlines in json strings should be readable
// in the stderr files. There's no point int being correct,