Skip to content

Commit 1076c7e

Browse files
committed
canonicolize test build dir before normalizing it
Fix fixes failures of the following tests when build directory is a symlink: - `tests/ui/error-codes/E{0464,0523}.rs` - `tests/ui/crate-loading/crateresolve{1,2}.rs` (those are the same tests)
1 parent cf53f68 commit 1076c7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/tools/compiletest/src/runtest.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2375,9 +2375,13 @@ impl<'test> TestCx<'test> {
23752375
let rust_src_dir = rust_src_dir.read_link_utf8().unwrap_or(rust_src_dir.to_path_buf());
23762376
normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL");
23772377

2378+
// Canonicalize test build directory path.
2379+
// Without this some tests fail if build directory is a symlink.
2380+
let output_base_dir = fs::canonicalize(self.output_base_dir()).unwrap();
2381+
23782382
// eg.
23792383
// /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui/<test_dir>/$name.$revision.$mode/
2380-
normalize_path(&self.output_base_dir(), "$TEST_BUILD_DIR");
2384+
normalize_path(&output_base_dir, "$TEST_BUILD_DIR");
23812385
// eg. /home/user/rust/build
23822386
normalize_path(&self.config.build_root, "$BUILD_DIR");
23832387

0 commit comments

Comments
 (0)