Skip to content

Commit ee211c8

Browse files
committed
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/`.
1 parent c542b07 commit ee211c8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/tools/compiletest/src/runtest.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -2412,8 +2412,9 @@ impl<'test> TestCx<'test> {
24122412
let rust_src_dir = rust_src_dir.read_link().unwrap_or(rust_src_dir.to_path_buf());
24132413
normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL");
24142414

2415-
// eg. /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui
2416-
normalize_path(&self.config.build_test_suite_root, "$TEST_BUILD_DIR");
2415+
// eg.
2416+
// /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui/<test_dir>/$name.$revision.$mode/
2417+
normalize_path(&self.output_base_dir(), "$TEST_BUILD_DIR");
24172418
// eg. /home/user/rust/build
24182419
normalize_path(&self.config.build_root, "$BUILD_DIR");
24192420

@@ -2433,6 +2434,17 @@ impl<'test> TestCx<'test> {
24332434
.replace_all(&normalized, "SRC_DIR$1:LL:COL")
24342435
.into_owned();
24352436

2437+
// Normalize long type name hash.
2438+
normalized =
2439+
static_regex!(r"\$TEST_BUILD_DIR/(?P<filename>[^\.]+).long-type-(?P<hash>\d+).txt")
2440+
.replace_all(&normalized, |caps: &Captures<'_>| {
2441+
format!(
2442+
"$TEST_BUILD_DIR/{filename}.long-type-$LONG_TYPE_HASH.txt",
2443+
filename = &caps["filename"]
2444+
)
2445+
})
2446+
.into_owned();
2447+
24362448
normalized = Self::normalize_platform_differences(&normalized);
24372449
normalized = normalized.replace("\t", "\\t"); // makes tabs visible
24382450

0 commit comments

Comments
 (0)