about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-09-09 14:30:02 +1000
committerZalathar <Zalathar@users.noreply.github.com>2024-09-09 16:00:14 +1000
commitacccb39bff3c589b286c2dfe0d2f2afc8d1a3775 (patch)
tree55a13de0448d1fa3e43bd13c21c3a5dcdb470984
parenta6735e44ca28207d0f2c87c1f47769fed82b56fe (diff)
downloadrust-acccb39bff3c589b286c2dfe0d2f2afc8d1a3775.tar.gz
rust-acccb39bff3c589b286c2dfe0d2f2afc8d1a3775.zip
Print a helpful message if any tests were skipped for being up-to-date
-rw-r--r--src/bootstrap/src/utils/render_tests.rs15
-rw-r--r--src/tools/compiletest/src/lib.rs1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs
index b8aebc28549..eb2c8254dc0 100644
--- a/src/bootstrap/src/utils/render_tests.rs
+++ b/src/bootstrap/src/utils/render_tests.rs
@@ -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,
 }
 
@@ -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,
         }
     }
@@ -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
@@ -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,
diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs
index 3294a3bd080..33687a3dad3 100644
--- a/src/tools/compiletest/src/lib.rs
+++ b/src/tools/compiletest/src/lib.rs
@@ -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 {