Skip to content

Commit 4c7c810

Browse files
authored
Unrolled build for rust-lang#140953
Rollup merge of rust-lang#140953 - jieyouxu:compiletest-bless-msg, r=compiler-errors Fix a compiletest blessing message It was showing compare mode instead of test name. Fixes rust-lang#140945. Noticed in rust-lang#140622 (comment).
2 parents 2a5da7a + 82fbbc0 commit 4c7c810

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/tools/compiletest/src/runtest.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -2609,18 +2609,19 @@ impl<'test> TestCx<'test> {
26092609
(expected, actual)
26102610
};
26112611

2612-
// Write the actual output to a file in build/
2613-
let test_name = self.config.compare_mode.as_ref().map_or("", |m| m.to_str());
2612+
// Write the actual output to a file in build directory.
26142613
let actual_path = self
26152614
.output_base_name()
26162615
.with_extra_extension(self.revision.unwrap_or(""))
2617-
.with_extra_extension(test_name)
2616+
.with_extra_extension(
2617+
self.config.compare_mode.as_ref().map(|cm| cm.to_str()).unwrap_or(""),
2618+
)
26182619
.with_extra_extension(stream);
26192620

26202621
if let Err(err) = fs::write(&actual_path, &actual) {
2621-
self.fatal(&format!("failed to write {stream} to `{actual_path:?}`: {err}",));
2622+
self.fatal(&format!("failed to write {stream} to `{actual_path}`: {err}",));
26222623
}
2623-
println!("Saved the actual {stream} to {actual_path:?}");
2624+
println!("Saved the actual {stream} to `{actual_path}`");
26242625

26252626
if !self.config.bless {
26262627
if expected.is_empty() {
@@ -2646,13 +2647,16 @@ impl<'test> TestCx<'test> {
26462647

26472648
if !actual.is_empty() {
26482649
if let Err(err) = fs::write(&expected_path, &actual) {
2649-
self.fatal(&format!("failed to write {stream} to `{expected_path:?}`: {err}"));
2650+
self.fatal(&format!("failed to write {stream} to `{expected_path}`: {err}"));
26502651
}
2651-
println!("Blessing the {stream} of {test_name} in {expected_path:?}");
2652+
println!(
2653+
"Blessing the {stream} of `{test_name}` as `{expected_path}`",
2654+
test_name = self.testpaths.file
2655+
);
26522656
}
26532657
}
26542658

2655-
println!("\nThe actual {0} differed from the expected {0}.", stream);
2659+
println!("\nThe actual {stream} differed from the expected {stream}");
26562660

26572661
if self.config.bless { CompareOutcome::Blessed } else { CompareOutcome::Differed }
26582662
}

0 commit comments

Comments
 (0)