Skip to content

Commit 89b4eba

Browse files
committed
normalize canonical and non-canonical paths in compiletest
Apparently there are tests that print canonical paths *and* tests which print non-canonical paths. An example of the latter is `tests/ui/type_length_limit.rs`.
1 parent 6c441cc commit 89b4eba

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/tools/compiletest/src/runtest.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -2375,13 +2375,16 @@ 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 = self.output_base_dir().canonicalize_utf8().unwrap();
2381-
23822378
// eg.
23832379
// /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui/<test_dir>/$name.$revision.$mode/
2384-
normalize_path(&output_base_dir, "$TEST_BUILD_DIR");
2380+
normalize_path(&self.output_base_dir(), "$TEST_BUILD_DIR");
2381+
// Same as above, but with a canonicalized path.
2382+
// This is required because some tests print canonical paths inside test build directory,
2383+
// so if the build directory is a symlink, normalization doesn't help.
2384+
//
2385+
// NOTE: There are also tests which print the non-canonical name, so we need both this and
2386+
// the above normalizations.
2387+
normalize_path(&self.output_base_dir().canonicalize_utf8().unwrap(), "$TEST_BUILD_DIR");
23852388
// eg. /home/user/rust/build
23862389
normalize_path(&self.config.build_root, "$BUILD_DIR");
23872390

0 commit comments

Comments
 (0)