Skip to content

Commit

Permalink
Print a helpful message if any tests were skipped for being up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Sep 9, 2024
1 parent a6735e4 commit acccb39
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/bootstrap/src/utils/render_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ struct Renderer<'a> {
builder: &'a Builder<'a>,
tests_count: Option<usize>,
executed_tests: usize,
/// Number of tests that were skipped due to already being up-to-date
/// (i.e. no relevant changes occurred since they last ran).
up_to_date_tests: usize,
terse_tests_in_line: usize,
}

Expand All @@ -100,6 +103,7 @@ impl<'a> Renderer<'a> {
builder,
tests_count: None,
executed_tests: 0,
up_to_date_tests: 0,
terse_tests_in_line: 0,
}
}
Expand Down Expand Up @@ -127,6 +131,12 @@ impl<'a> Renderer<'a> {
}
}
}

if self.up_to_date_tests > 0 {
let n = self.up_to_date_tests;
let s = if n > 1 { "s" } else { "" };
println!("help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n");
}
}

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

// Keep this in sync with the "up-to-date" ignore message inserted by compiletest.
if let Outcome::Ignored { reason: Some("up-to-date") } = outcome {
self.up_to_date_tests += 1;
}

#[cfg(feature = "build-metrics")]
self.builder.metrics.record_test(
&test.name,
Expand Down
1 change: 1 addition & 0 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ fn make_test(
&& is_up_to_date(&config, testpaths, &early_props, revision, inputs)
{
desc.ignore = true;
// Keep this in sync with the "up-to-date" message detected by bootstrap.
desc.ignore_message = Some("up-to-date");
}
test::TestDescAndFn {
Expand Down

0 comments on commit acccb39

Please sign in to comment.