Skip to content

Commit ec9e9b7

Browse files
authored
Rollup merge of rust-lang#94566 - yanganto:show-ignore-message, r=m-ou-se
Show ignore message in console and json output - Provide ignore the message in console and JSON output - Modify the ignore message style in the log file related: rust-lang#92714
2 parents 192ee67 + 7ede88d commit ec9e9b7

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

test/src/console.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl ConsoleTestState {
118118
TestResult::TrIgnored => {
119119
#[cfg(not(bootstrap))]
120120
if let Some(msg) = ignore_message {
121-
format!("ignored, {msg}")
121+
format!("ignored: {msg}")
122122
} else {
123123
"ignored".to_owned()
124124
}

test/src/formatters/json.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
121121
),
122122

123123
TestResult::TrIgnored => {
124+
#[cfg(not(bootstrap))]
125+
return self.write_event(
126+
"test",
127+
desc.name.as_slice(),
128+
"ignored",
129+
exec_time,
130+
stdout,
131+
desc.ignore_message
132+
.map(|msg| format!(r#""message": "{}""#, EscapedString(msg)))
133+
.as_deref(),
134+
);
135+
136+
#[cfg(bootstrap)]
124137
self.write_event("test", desc.name.as_slice(), "ignored", exec_time, stdout, None)
125138
}
126139

test/src/formatters/pretty.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ impl<T: Write> PrettyFormatter<T> {
4545
self.write_short_result("FAILED", term::color::RED)
4646
}
4747

48-
pub fn write_ignored(&mut self) -> io::Result<()> {
49-
self.write_short_result("ignored", term::color::YELLOW)
48+
pub fn write_ignored(&mut self, message: Option<&'static str>) -> io::Result<()> {
49+
if let Some(message) = message {
50+
self.write_short_result(&format!("ignored, {}", message), term::color::YELLOW)
51+
} else {
52+
self.write_short_result("ignored", term::color::YELLOW)
53+
}
5054
}
5155

5256
pub fn write_time_failed(&mut self) -> io::Result<()> {
@@ -214,7 +218,12 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
214218
match *result {
215219
TestResult::TrOk => self.write_ok()?,
216220
TestResult::TrFailed | TestResult::TrFailedMsg(_) => self.write_failed()?,
217-
TestResult::TrIgnored => self.write_ignored()?,
221+
TestResult::TrIgnored => {
222+
#[cfg(not(bootstrap))]
223+
self.write_ignored(desc.ignore_message)?;
224+
#[cfg(bootstrap)]
225+
self.write_ignored(None)?;
226+
}
218227
TestResult::TrBench(ref bs) => {
219228
self.write_bench()?;
220229
self.write_plain(&format!(": {}", fmt_bench_samples(bs)))?;

0 commit comments

Comments
 (0)