From 37ea27c741f3d04c23033b0c7ec343584b3e7502 Mon Sep 17 00:00:00 2001 From: Urgau Date: Sat, 28 Sep 2024 21:44:44 +0200 Subject: [PATCH] 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) --- src/tools/compiletest/src/runtest.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 922492e451f..456528da21a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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,