diff options
| author | Waffle Lapkin <waffle.lapkin@gmail.com> | 2025-04-15 10:09:31 +0200 |
|---|---|---|
| committer | Waffle Lapkin <waffle.lapkin@gmail.com> | 2025-04-15 21:55:41 +0200 |
| commit | 89b4eba49cc15e0a4e53f7816473201d12be5f4f (patch) | |
| tree | dffee2b9f2db37011f6ad422656985ccbe64d0ee | |
| parent | 6c441cc7a53e3c9ca0dd1957b8055ccdd851b488 (diff) | |
| download | rust-89b4eba49cc15e0a4e53f7816473201d12be5f4f.tar.gz rust-89b4eba49cc15e0a4e53f7816473201d12be5f4f.zip | |
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`.
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index fc83ea42043..eb298060b2e 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2375,13 +2375,16 @@ impl<'test> TestCx<'test> { let rust_src_dir = rust_src_dir.read_link_utf8().unwrap_or(rust_src_dir.to_path_buf()); normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL"); - // Canonicalize test build directory path. - // Without this some tests fail if build directory is a symlink. - let output_base_dir = self.output_base_dir().canonicalize_utf8().unwrap(); - // eg. // /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui/<test_dir>/$name.$revision.$mode/ - normalize_path(&output_base_dir, "$TEST_BUILD_DIR"); + normalize_path(&self.output_base_dir(), "$TEST_BUILD_DIR"); + // Same as above, but with a canonicalized path. + // This is required because some tests print canonical paths inside test build directory, + // so if the build directory is a symlink, normalization doesn't help. + // + // NOTE: There are also tests which print the non-canonical name, so we need both this and + // the above normalizations. + normalize_path(&self.output_base_dir().canonicalize_utf8().unwrap(), "$TEST_BUILD_DIR"); // eg. /home/user/rust/build normalize_path(&self.config.build_root, "$BUILD_DIR"); |
