Skip to content

Commit acccb39

Browse files
committed
Print a helpful message if any tests were skipped for being up-to-date
1 parent a6735e4 commit acccb39

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/bootstrap/src/utils/render_tests.rs

+15
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ struct Renderer<'a> {
8888
builder: &'a Builder<'a>,
8989
tests_count: Option<usize>,
9090
executed_tests: usize,
91+
/// Number of tests that were skipped due to already being up-to-date
92+
/// (i.e. no relevant changes occurred since they last ran).
93+
up_to_date_tests: usize,
9194
terse_tests_in_line: usize,
9295
}
9396

@@ -100,6 +103,7 @@ impl<'a> Renderer<'a> {
100103
builder,
101104
tests_count: None,
102105
executed_tests: 0,
106+
up_to_date_tests: 0,
103107
terse_tests_in_line: 0,
104108
}
105109
}
@@ -127,6 +131,12 @@ impl<'a> Renderer<'a> {
127131
}
128132
}
129133
}
134+
135+
if self.up_to_date_tests > 0 {
136+
let n = self.up_to_date_tests;
137+
let s = if n > 1 { "s" } else { "" };
138+
println!("help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n");
139+
}
130140
}
131141

132142
/// Renders the stdout characters one by one
@@ -149,6 +159,11 @@ impl<'a> Renderer<'a> {
149159
fn render_test_outcome(&mut self, outcome: Outcome<'_>, test: &TestOutcome) {
150160
self.executed_tests += 1;
151161

162+
// Keep this in sync with the "up-to-date" ignore message inserted by compiletest.
163+
if let Outcome::Ignored { reason: Some("up-to-date") } = outcome {
164+
self.up_to_date_tests += 1;
165+
}
166+
152167
#[cfg(feature = "build-metrics")]
153168
self.builder.metrics.record_test(
154169
&test.name,

src/tools/compiletest/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ fn make_test(
812812
&& is_up_to_date(&config, testpaths, &early_props, revision, inputs)
813813
{
814814
desc.ignore = true;
815+
// Keep this in sync with the "up-to-date" message detected by bootstrap.
815816
desc.ignore_message = Some("up-to-date");
816817
}
817818
test::TestDescAndFn {

0 commit comments

Comments
 (0)