diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-02-11 20:21:02 +0800 |
|---|---|---|
| committer | Jieyou Xu <jieyouxu@outlook.com> | 2025-03-04 00:21:02 +0800 |
| commit | 7e0a2fcb1b4c8026948212140d7d58b8ed87fa38 (patch) | |
| tree | 504c38d3c68ba90c4258d96800655ed80368ea23 /src | |
| parent | 81d8edc2000aa38b08ad09fce22d90f1990b6459 (diff) | |
| download | rust-7e0a2fcb1b4c8026948212140d7d58b8ed87fa38.tar.gz rust-7e0a2fcb1b4c8026948212140d7d58b8ed87fa38.zip | |
compiletest: change `TEST_BUILD_DIR` to maximally normalize
This is to make test stderr insensitive to compare-mode / debugger that changes the test build dir output name. Previously, this normalized paths up to test-suite-specific build root, e.g. `/path/to/build/test/ui/`. Now, this normalizes up to test-specific build root, e.g. `/path/to/build/test/ui/subdir/$name.$revision.$mode.$debugger/`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index f36d43b211f..6e250ca12c9 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2412,8 +2412,9 @@ impl<'test> TestCx<'test> { 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"); - // eg. /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui - normalize_path(&self.config.build_test_suite_root, "$TEST_BUILD_DIR"); + // eg. + // /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui/<test_dir>/$name.$revision.$mode/ + normalize_path(&self.output_base_dir(), "$TEST_BUILD_DIR"); // eg. /home/user/rust/build normalize_path(&self.config.build_root, "$BUILD_DIR"); @@ -2434,6 +2435,18 @@ impl<'test> TestCx<'test> { .into_owned(); normalized = Self::normalize_platform_differences(&normalized); + + // Normalize long type name hash. + normalized = + static_regex!(r"\$TEST_BUILD_DIR/(?P<filename>[^\.]+).long-type-(?P<hash>\d+).txt") + .replace_all(&normalized, |caps: &Captures<'_>| { + format!( + "$TEST_BUILD_DIR/{filename}.long-type-$LONG_TYPE_HASH.txt", + filename = &caps["filename"] + ) + }) + .into_owned(); + normalized = normalized.replace("\t", "\\t"); // makes tabs visible // Remove test annotations like `//~ ERROR text` from the output, |
