about summary refs log tree commit diff
path: root/library/test/src
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2022-04-05 22:42:23 +0200
committerPietro Albini <pietro@pietroalbini.org>2022-04-05 23:18:40 +0200
commit181d28bb6110dc974879db20d433f21aa142db3a (patch)
tree3bbc185fd9386b9cc050235fd1785820fcaaae5c /library/test/src
parente96538aeeb2a71e672e1d1a40dcaf0ad34a826b5 (diff)
trivial cfg(bootstrap) changes
Diffstat (limited to 'library/test/src')
-rw-r--r--library/test/src/console.rs10
-rw-r--r--library/test/src/formatters/json.rs26
-rw-r--r--library/test/src/formatters/pretty.rs7
-rw-r--r--library/test/src/tests.rs19
-rw-r--r--library/test/src/types.rs1
5 files changed, 12 insertions, 51 deletions
diff --git a/library/test/src/console.rs b/library/test/src/console.rs
index 56eef8314fb..dc0123cf432 100644
--- a/library/test/src/console.rs
+++ b/library/test/src/console.rs
@@ -103,12 +103,7 @@ impl ConsoleTestState {
         exec_time: Option<&TestExecTime>,
     ) -> io::Result<()> {
         self.write_log(|| {
-            let TestDesc {
-                name,
-                #[cfg(not(bootstrap))]
-                ignore_message,
-                ..
-            } = test;
+            let TestDesc { name, ignore_message, .. } = test;
             format!(
                 "{} {}",
                 match *result {
@@ -116,14 +111,11 @@ impl ConsoleTestState {
                     TestResult::TrFailed => "failed".to_owned(),
                     TestResult::TrFailedMsg(ref msg) => format!("failed: {msg}"),
                     TestResult::TrIgnored => {
-                        #[cfg(not(bootstrap))]
                         if let Some(msg) = ignore_message {
                             format!("ignored: {msg}")
                         } else {
                             "ignored".to_owned()
                         }
-                        #[cfg(bootstrap)]
-                        "ignored".to_owned()
                     }
                     TestResult::TrBench(ref bs) => fmt_bench_samples(bs),
                     TestResult::TrTimedFail => "failed (time limit exceeded)".to_owned(),
diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs
index 737921c1e10..c07fdafb167 100644
--- a/library/test/src/formatters/json.rs
+++ b/library/test/src/formatters/json.rs
@@ -120,22 +120,16 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
                 Some(&*format!(r#""message": "{}""#, EscapedString(m))),
             ),
 
-            TestResult::TrIgnored => {
-                #[cfg(not(bootstrap))]
-                return self.write_event(
-                    "test",
-                    desc.name.as_slice(),
-                    "ignored",
-                    exec_time,
-                    stdout,
-                    desc.ignore_message
-                        .map(|msg| format!(r#""message": "{}""#, EscapedString(msg)))
-                        .as_deref(),
-                );
-
-                #[cfg(bootstrap)]
-                self.write_event("test", desc.name.as_slice(), "ignored", exec_time, stdout, None)
-            }
+            TestResult::TrIgnored => self.write_event(
+                "test",
+                desc.name.as_slice(),
+                "ignored",
+                exec_time,
+                stdout,
+                desc.ignore_message
+                    .map(|msg| format!(r#""message": "{}""#, EscapedString(msg)))
+                    .as_deref(),
+            ),
 
             TestResult::TrBench(ref bs) => {
                 let median = bs.ns_iter_summ.median as usize;
diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs
index 9b407df2190..69420222980 100644
--- a/library/test/src/formatters/pretty.rs
+++ b/library/test/src/formatters/pretty.rs
@@ -218,12 +218,7 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
         match *result {
             TestResult::TrOk => self.write_ok()?,
             TestResult::TrFailed | TestResult::TrFailedMsg(_) => self.write_failed()?,
-            TestResult::TrIgnored => {
-                #[cfg(not(bootstrap))]
-                self.write_ignored(desc.ignore_message)?;
-                #[cfg(bootstrap)]
-                self.write_ignored(None)?;
-            }
+            TestResult::TrIgnored => self.write_ignored(desc.ignore_message)?,
             TestResult::TrBench(ref bs) => {
                 self.write_bench()?;
                 self.write_plain(&format!(": {}", fmt_bench_samples(bs)))?;
diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs
index 8329e9735d4..0b81aff5907 100644
--- a/library/test/src/tests.rs
+++ b/library/test/src/tests.rs
@@ -61,7 +61,6 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
             desc: TestDesc {
                 name: StaticTestName("1"),
                 ignore: true,
-                #[cfg(not(bootstrap))]
                 ignore_message: None,
                 should_panic: ShouldPanic::No,
                 compile_fail: false,
@@ -74,7 +73,6 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
             desc: TestDesc {
                 name: StaticTestName("2"),
                 ignore: false,
-                #[cfg(not(bootstrap))]
                 ignore_message: None,
                 should_panic: ShouldPanic::No,
                 compile_fail: false,
@@ -95,7 +93,6 @@ pub fn do_not_run_ignored_tests() {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: true,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::No,
             compile_fail: false,
@@ -117,7 +114,6 @@ pub fn ignored_tests_result_in_ignored() {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: true,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::No,
             compile_fail: false,
@@ -143,7 +139,6 @@ fn test_should_panic() {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: false,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::Yes,
             compile_fail: false,
@@ -169,7 +164,6 @@ fn test_should_panic_good_message() {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: false,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::YesWithMessage("error message"),
             compile_fail: false,
@@ -200,7 +194,6 @@ fn test_should_panic_bad_message() {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: false,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::YesWithMessage(expected),
             compile_fail: false,
@@ -235,7 +228,6 @@ fn test_should_panic_non_string_message_type() {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: false,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::YesWithMessage(expected),
             compile_fail: false,
@@ -262,7 +254,6 @@ fn test_should_panic_but_succeeds() {
             desc: TestDesc {
                 name: StaticTestName("whatever"),
                 ignore: false,
-                #[cfg(not(bootstrap))]
                 ignore_message: None,
                 should_panic,
                 compile_fail: false,
@@ -297,7 +288,6 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: false,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::No,
             compile_fail: false,
@@ -333,7 +323,6 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
         desc: TestDesc {
             name: StaticTestName("whatever"),
             ignore: false,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::No,
             compile_fail: false,
@@ -373,7 +362,6 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
     TestDesc {
         name: StaticTestName("whatever"),
         ignore: false,
-        #[cfg(not(bootstrap))]
         ignore_message: None,
         should_panic: ShouldPanic::No,
         compile_fail: false,
@@ -486,7 +474,6 @@ pub fn exclude_should_panic_option() {
         desc: TestDesc {
             name: StaticTestName("3"),
             ignore: false,
-            #[cfg(not(bootstrap))]
             ignore_message: None,
             should_panic: ShouldPanic::Yes,
             compile_fail: false,
@@ -511,7 +498,6 @@ pub fn exact_filter_match() {
                 desc: TestDesc {
                     name: StaticTestName(name),
                     ignore: false,
-                    #[cfg(not(bootstrap))]
                     ignore_message: None,
                     should_panic: ShouldPanic::No,
                     compile_fail: false,
@@ -601,7 +587,6 @@ fn sample_tests() -> Vec<TestDescAndFn> {
             desc: TestDesc {
                 name: DynTestName((*name).clone()),
                 ignore: false,
-                #[cfg(not(bootstrap))]
                 ignore_message: None,
                 should_panic: ShouldPanic::No,
                 compile_fail: false,
@@ -753,7 +738,6 @@ pub fn test_bench_no_iter() {
     let desc = TestDesc {
         name: StaticTestName("f"),
         ignore: false,
-        #[cfg(not(bootstrap))]
         ignore_message: None,
         should_panic: ShouldPanic::No,
         compile_fail: false,
@@ -776,7 +760,6 @@ pub fn test_bench_iter() {
     let desc = TestDesc {
         name: StaticTestName("f"),
         ignore: false,
-        #[cfg(not(bootstrap))]
         ignore_message: None,
         should_panic: ShouldPanic::No,
         compile_fail: false,
@@ -793,7 +776,6 @@ fn should_sort_failures_before_printing_them() {
     let test_a = TestDesc {
         name: StaticTestName("a"),
         ignore: false,
-        #[cfg(not(bootstrap))]
         ignore_message: None,
         should_panic: ShouldPanic::No,
         compile_fail: false,
@@ -804,7 +786,6 @@ fn should_sort_failures_before_printing_them() {
     let test_b = TestDesc {
         name: StaticTestName("b"),
         ignore: false,
-        #[cfg(not(bootstrap))]
         ignore_message: None,
         should_panic: ShouldPanic::No,
         compile_fail: false,
diff --git a/library/test/src/types.rs b/library/test/src/types.rs
index 1084fb98389..ffb1efe18cc 100644
--- a/library/test/src/types.rs
+++ b/library/test/src/types.rs
@@ -117,7 +117,6 @@ pub struct TestId(pub usize);
 pub struct TestDesc {
     pub name: TestName,
     pub ignore: bool,
-    #[cfg(not(bootstrap))]
     pub ignore_message: Option<&'static str>,
     pub should_panic: options::ShouldPanic,
     pub compile_fail: bool,