about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAliƩnore Bouttefeux <alienore.bouttefeux@gmail.com>2021-05-03 14:55:22 +0200
committerAliƩnore Bouttefeux <alienore.bouttefeux@gmail.com>2021-05-03 15:22:19 +0200
commit347ed001e81607f609f7c47a6d7cd5f723c288a1 (patch)
treedc69b24543e1bbbd68b1ccac755ba365a562ca6d
parent89ebad52a8b5a6d89d66a158d377cd7505ec4b48 (diff)
downloadrust-347ed001e81607f609f7c47a6d7cd5f723c288a1.tar.gz
rust-347ed001e81607f609f7c47a6d7cd5f723c288a1.zip
proof of concept add test type on prints
-rw-r--r--compiler/rustc_builtin_macros/src/test.rs4
-rw-r--r--library/test/src/formatters/pretty.rs2
-rw-r--r--library/test/src/formatters/terse.rs2
-rw-r--r--library/test/src/tests.rs38
-rw-r--r--library/test/src/types.rs24
-rw-r--r--src/librustdoc/doctest.rs4
-rw-r--r--src/test/rustdoc-ui/cfg-test.stdout4
-rw-r--r--src/test/rustdoc-ui/doc-test-doctest-feature.stdout2
-rw-r--r--src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout2
-rw-r--r--src/test/rustdoc-ui/doctest-output.stdout6
-rw-r--r--src/test/rustdoc-ui/failed-doctest-compile-fail.stdout2
-rw-r--r--src/test/rustdoc-ui/failed-doctest-missing-codes.stdout2
-rw-r--r--src/test/rustdoc-ui/failed-doctest-output.stdout4
-rw-r--r--src/test/rustdoc-ui/failed-doctest-should-panic.stdout2
-rw-r--r--src/test/rustdoc-ui/issue-80992.stdout2
-rw-r--r--src/test/rustdoc-ui/issue-81662-shortness.stdout2
-rw-r--r--src/test/rustdoc-ui/no-run-flag.stdout14
-rw-r--r--src/test/rustdoc-ui/run-directory.correct.stdout2
-rw-r--r--src/test/rustdoc-ui/run-directory.incorrect.stdout2
-rw-r--r--src/test/rustdoc-ui/test-no_std.stdout2
-rw-r--r--src/test/rustdoc-ui/test-type.rs26
-rw-r--r--src/test/rustdoc-ui/test-type.stdout10
-rw-r--r--src/test/rustdoc-ui/unparseable-doc-test.stdout2
-rw-r--r--src/test/ui/test-attrs/test-filter-multiple.run.stdout4
-rw-r--r--src/test/ui/test-attrs/test-type.rs28
-rw-r--r--src/test/ui/test-attrs/test-type.run.stdout8
-rw-r--r--src/test/ui/test-panic-abort-nocapture.run.stdout8
-rw-r--r--src/test/ui/test-panic-abort.run.stdout10
-rw-r--r--src/test/ui/test-passed.run.stdout4
-rw-r--r--src/test/ui/test-thread-capture.run.stdout4
-rw-r--r--src/test/ui/test-thread-nocapture.run.stdout4
-rw-r--r--src/tools/compiletest/src/main.rs2
32 files changed, 187 insertions, 45 deletions
diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs
index e845f9ec55a..99544ddb66e 100644
--- a/compiler/rustc_builtin_macros/src/test.rs
+++ b/compiler/rustc_builtin_macros/src/test.rs
@@ -254,6 +254,10 @@ pub fn expand_test_or_bench(
                                         "allow_fail",
                                         cx.expr_bool(sp, should_fail(&cx.sess, &item)),
                                     ),
+                                    // compile_fail: true | false
+                                    field("compile_fail", cx.expr_bool(sp, false)),
+                                    // no_run: true | false
+                                    field("no_run", cx.expr_bool(sp, false)),
                                     // should_panic: ...
                                     field(
                                         "should_panic",
diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs
index 5e41d6d9692..00d4b18b302 100644
--- a/library/test/src/formatters/pretty.rs
+++ b/library/test/src/formatters/pretty.rs
@@ -169,7 +169,7 @@ impl<T: Write> PrettyFormatter<T> {
 
     fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
         let name = desc.padded_name(self.max_name_len, desc.name.padding());
-        self.write_plain(&format!("test {} ... ", name))?;
+        self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?;
 
         Ok(())
     }
diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs
index 6f46f7255a4..a68ceb404f9 100644
--- a/library/test/src/formatters/terse.rs
+++ b/library/test/src/formatters/terse.rs
@@ -158,7 +158,7 @@ impl<T: Write> TerseFormatter<T> {
 
     fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
         let name = desc.padded_name(self.max_name_len, desc.name.padding());
-        self.write_plain(&format!("test {} ... ", name))?;
+        self.write_plain(&format!("test {} {} ... ", name, desc.test_mode_string()))?;
 
         Ok(())
     }
diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs
index 6a3f31b74ea..794f7277004 100644
--- a/library/test/src/tests.rs
+++ b/library/test/src/tests.rs
@@ -61,6 +61,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
                 ignore: true,
                 should_panic: ShouldPanic::No,
                 allow_fail: false,
+                compile_fail: false,
+                no_run: false,
                 test_type: TestType::Unknown,
             },
             testfn: DynTestFn(Box::new(move || {})),
@@ -71,6 +73,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
                 ignore: false,
                 should_panic: ShouldPanic::No,
                 allow_fail: false,
+                compile_fail: false,
+                no_run: false,
                 test_type: TestType::Unknown,
             },
             testfn: DynTestFn(Box::new(move || {})),
@@ -89,6 +93,8 @@ pub fn do_not_run_ignored_tests() {
             ignore: true,
             should_panic: ShouldPanic::No,
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -108,6 +114,8 @@ pub fn ignored_tests_result_in_ignored() {
             ignore: true,
             should_panic: ShouldPanic::No,
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -131,6 +139,8 @@ fn test_should_panic() {
             ignore: false,
             should_panic: ShouldPanic::Yes,
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -154,6 +164,8 @@ fn test_should_panic_good_message() {
             ignore: false,
             should_panic: ShouldPanic::YesWithMessage("error message"),
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -182,6 +194,8 @@ fn test_should_panic_bad_message() {
             ignore: false,
             should_panic: ShouldPanic::YesWithMessage(expected),
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -214,6 +228,8 @@ fn test_should_panic_non_string_message_type() {
             ignore: false,
             should_panic: ShouldPanic::YesWithMessage(expected),
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -238,6 +254,8 @@ fn test_should_panic_but_succeeds() {
                 ignore: false,
                 should_panic,
                 allow_fail: false,
+                compile_fail: false,
+                no_run: false,
                 test_type: TestType::Unknown,
             },
             testfn: DynTestFn(Box::new(f)),
@@ -270,6 +288,8 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
             ignore: false,
             should_panic: ShouldPanic::No,
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -303,6 +323,8 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
             ignore: false,
             should_panic: ShouldPanic::No,
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type,
         },
         testfn: DynTestFn(Box::new(f)),
@@ -340,6 +362,8 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
         ignore: false,
         should_panic: ShouldPanic::No,
         allow_fail: false,
+        compile_fail: false,
+        no_run: false,
         test_type,
     }
 }
@@ -451,6 +475,8 @@ pub fn exclude_should_panic_option() {
             ignore: false,
             should_panic: ShouldPanic::Yes,
             allow_fail: false,
+            compile_fail: false,
+            no_run: false,
             test_type: TestType::Unknown,
         },
         testfn: DynTestFn(Box::new(move || {})),
@@ -473,6 +499,8 @@ pub fn exact_filter_match() {
                     ignore: false,
                     should_panic: ShouldPanic::No,
                     allow_fail: false,
+                    compile_fail: false,
+                    no_run: false,
                     test_type: TestType::Unknown,
                 },
                 testfn: DynTestFn(Box::new(move || {})),
@@ -565,6 +593,8 @@ pub fn sort_tests() {
                     ignore: false,
                     should_panic: ShouldPanic::No,
                     allow_fail: false,
+                    compile_fail: false,
+                    no_run: false,
                     test_type: TestType::Unknown,
                 },
                 testfn: DynTestFn(Box::new(testfn)),
@@ -642,6 +672,8 @@ pub fn test_bench_no_iter() {
         ignore: false,
         should_panic: ShouldPanic::No,
         allow_fail: false,
+        compile_fail: false,
+        no_run: false,
         test_type: TestType::Unknown,
     };
 
@@ -662,6 +694,8 @@ pub fn test_bench_iter() {
         ignore: false,
         should_panic: ShouldPanic::No,
         allow_fail: false,
+        compile_fail: false,
+        no_run: false,
         test_type: TestType::Unknown,
     };
 
@@ -676,6 +710,8 @@ fn should_sort_failures_before_printing_them() {
         ignore: false,
         should_panic: ShouldPanic::No,
         allow_fail: false,
+        compile_fail: false,
+        no_run: false,
         test_type: TestType::Unknown,
     };
 
@@ -684,6 +720,8 @@ fn should_sort_failures_before_printing_them() {
         ignore: false,
         should_panic: ShouldPanic::No,
         allow_fail: false,
+        compile_fail: false,
+        no_run: false,
         test_type: TestType::Unknown,
     };
 
diff --git a/library/test/src/types.rs b/library/test/src/types.rs
index c5d91f653b3..61c644f7972 100644
--- a/library/test/src/types.rs
+++ b/library/test/src/types.rs
@@ -124,6 +124,8 @@ pub struct TestDesc {
     pub ignore: bool,
     pub should_panic: options::ShouldPanic,
     pub allow_fail: bool,
+    pub compile_fail: bool,
+    pub no_run: bool,
     pub test_type: TestType,
 }
 
@@ -140,6 +142,28 @@ impl TestDesc {
             }
         }
     }
+
+    pub fn test_mode_string(&self) -> String {
+        if self.ignore {
+            return "ignore".to_string();
+        }
+        match self.should_panic {
+            options::ShouldPanic::Yes | options::ShouldPanic::YesWithMessage(_) => {
+                return "should panic".to_string();
+            }
+            _ => {}
+        }
+        if self.allow_fail {
+            return "allow fail".to_string();
+        }
+        if self.compile_fail {
+            return "compile fail".to_string();
+        }
+        if self.no_run {
+            return "compile".to_string();
+        }
+        "run".to_string()
+    }
 }
 
 #[derive(Debug)]
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index c0157121e19..8ef9170f919 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -879,6 +879,7 @@ impl Tester for Collector {
         let target = self.options.target.clone();
         let target_str = target.to_string();
         let unused_externs = self.unused_extern_reports.clone();
+        let no_run = config.no_run || options.no_run;
         if !config.compile_fail {
             self.compiling_test_count.fetch_add(1, Ordering::SeqCst);
         }
@@ -934,13 +935,14 @@ impl Tester for Collector {
                 // compiler failures are test failures
                 should_panic: testing::ShouldPanic::No,
                 allow_fail: config.allow_fail,
+                compile_fail: config.compile_fail,
+                no_run,
                 test_type: testing::TestType::DocTest,
             },
             testfn: testing::DynTestFn(box move || {
                 let report_unused_externs = |uext| {
                     unused_externs.lock().unwrap().push(uext);
                 };
-                let no_run = config.no_run || options.no_run;
                 let res = run_test(
                     &test,
                     &cratename,
diff --git a/src/test/rustdoc-ui/cfg-test.stdout b/src/test/rustdoc-ui/cfg-test.stdout
index 2960ff8d3b4..fdd754609ef 100644
--- a/src/test/rustdoc-ui/cfg-test.stdout
+++ b/src/test/rustdoc-ui/cfg-test.stdout
@@ -1,7 +1,7 @@
 
 running 2 tests
-test $DIR/cfg-test.rs - Bar (line 27) ... ok
-test $DIR/cfg-test.rs - Foo (line 19) ... ok
+test $DIR/cfg-test.rs - Bar (line 27) run ... ok
+test $DIR/cfg-test.rs - Foo (line 19) run ... ok
 
 test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout
index d7de1f10522..ecf5dcd056a 100644
--- a/src/test/rustdoc-ui/doc-test-doctest-feature.stdout
+++ b/src/test/rustdoc-ui/doc-test-doctest-feature.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/doc-test-doctest-feature.rs - Foo (line 9) ... ok
+test $DIR/doc-test-doctest-feature.rs - Foo (line 9) run ... ok
 
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout
index 5b07fc4c87a..7f900cb2858 100644
--- a/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout
+++ b/src/test/rustdoc-ui/doc-test-rustdoc-feature.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) ... ok
+test $DIR/doc-test-rustdoc-feature.rs - Foo (line 10) run ... ok
 
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/doctest-output.stdout b/src/test/rustdoc-ui/doctest-output.stdout
index 35b0e366fb5..1b5857d251b 100644
--- a/src/test/rustdoc-ui/doctest-output.stdout
+++ b/src/test/rustdoc-ui/doctest-output.stdout
@@ -1,8 +1,8 @@
 
 running 3 tests
-test $DIR/doctest-output.rs - (line 8) ... ok
-test $DIR/doctest-output.rs - ExpandedStruct (line 24) ... ok
-test $DIR/doctest-output.rs - foo::bar (line 18) ... ok
+test $DIR/doctest-output.rs - (line 8) run ... ok
+test $DIR/doctest-output.rs - ExpandedStruct (line 24) run ... ok
+test $DIR/doctest-output.rs - foo::bar (line 18) run ... ok
 
 test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout b/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout
index b8bb5ccb403..dc811df609c 100644
--- a/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-compile-fail.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) ... FAILED
+test $DIR/failed-doctest-compile-fail.rs - Foo (line 9) compile fail ... FAILED
 
 failures:
 
diff --git a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout
index 7367a7d6519..a76511eb29e 100644
--- a/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-missing-codes.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) ... FAILED
+test $DIR/failed-doctest-missing-codes.rs - Foo (line 9) compile fail ... FAILED
 
 failures:
 
diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout
index 6dfe648f854..83c8c5301e0 100644
--- a/src/test/rustdoc-ui/failed-doctest-output.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-output.stdout
@@ -1,7 +1,7 @@
 
 running 2 tests
-test $DIR/failed-doctest-output.rs - OtherStruct (line 22) ... FAILED
-test $DIR/failed-doctest-output.rs - SomeStruct (line 12) ... FAILED
+test $DIR/failed-doctest-output.rs - OtherStruct (line 22) run ... FAILED
+test $DIR/failed-doctest-output.rs - SomeStruct (line 12) run ... FAILED
 
 failures:
 
diff --git a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout
index 57a20092a5d..e3d0216441b 100644
--- a/src/test/rustdoc-ui/failed-doctest-should-panic.stdout
+++ b/src/test/rustdoc-ui/failed-doctest-should-panic.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED
+test $DIR/failed-doctest-should-panic.rs - Foo (line 9) run ... FAILED
 
 failures:
 
diff --git a/src/test/rustdoc-ui/issue-80992.stdout b/src/test/rustdoc-ui/issue-80992.stdout
index 1dd19f46827..e7110dee4fb 100644
--- a/src/test/rustdoc-ui/issue-80992.stdout
+++ b/src/test/rustdoc-ui/issue-80992.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/issue-80992.rs - test (line 7) ... ok
+test $DIR/issue-80992.rs - test (line 7) compile fail ... ok
 
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/issue-81662-shortness.stdout b/src/test/rustdoc-ui/issue-81662-shortness.stdout
index 748113be3a2..3c2901e70f0 100644
--- a/src/test/rustdoc-ui/issue-81662-shortness.stdout
+++ b/src/test/rustdoc-ui/issue-81662-shortness.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/issue-81662-shortness.rs - foo (line 6) ... FAILED
+test $DIR/issue-81662-shortness.rs - foo (line 6) run ... FAILED
 
 failures:
 
diff --git a/src/test/rustdoc-ui/no-run-flag.stdout b/src/test/rustdoc-ui/no-run-flag.stdout
index d92f5da8335..418691e4f0c 100644
--- a/src/test/rustdoc-ui/no-run-flag.stdout
+++ b/src/test/rustdoc-ui/no-run-flag.stdout
@@ -1,12 +1,12 @@
 
 running 7 tests
-test $DIR/no-run-flag.rs - f (line 11) ... ok
-test $DIR/no-run-flag.rs - f (line 14) ... ignored
-test $DIR/no-run-flag.rs - f (line 17) ... ok
-test $DIR/no-run-flag.rs - f (line 23) ... ok
-test $DIR/no-run-flag.rs - f (line 28) ... ok
-test $DIR/no-run-flag.rs - f (line 32) ... ok
-test $DIR/no-run-flag.rs - f (line 8) ... ok
+test $DIR/no-run-flag.rs - f (line 11) compile ... ok
+test $DIR/no-run-flag.rs - f (line 14) ignore ... ignored
+test $DIR/no-run-flag.rs - f (line 17) compile ... ok
+test $DIR/no-run-flag.rs - f (line 23) compile fail ... ok
+test $DIR/no-run-flag.rs - f (line 28) compile ... ok
+test $DIR/no-run-flag.rs - f (line 32) compile ... ok
+test $DIR/no-run-flag.rs - f (line 8) compile ... ok
 
 test result: ok. 6 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/run-directory.correct.stdout b/src/test/rustdoc-ui/run-directory.correct.stdout
index e9b2754794a..a5bc41ece99 100644
--- a/src/test/rustdoc-ui/run-directory.correct.stdout
+++ b/src/test/rustdoc-ui/run-directory.correct.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/run-directory.rs - foo (line 10) ... ok
+test $DIR/run-directory.rs - foo (line 10) run ... ok
 
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/run-directory.incorrect.stdout b/src/test/rustdoc-ui/run-directory.incorrect.stdout
index 97a5dbc5c0c..542043bc437 100644
--- a/src/test/rustdoc-ui/run-directory.incorrect.stdout
+++ b/src/test/rustdoc-ui/run-directory.incorrect.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/run-directory.rs - foo (line 19) ... ok
+test $DIR/run-directory.rs - foo (line 19) run ... ok
 
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/test-no_std.stdout b/src/test/rustdoc-ui/test-no_std.stdout
index 8d5a30804c1..82dbffcbd55 100644
--- a/src/test/rustdoc-ui/test-no_std.stdout
+++ b/src/test/rustdoc-ui/test-no_std.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/test-no_std.rs - f (line 10) ... ok
+test $DIR/test-no_std.rs - f (line 10) run ... ok
 
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/rustdoc-ui/test-type.rs b/src/test/rustdoc-ui/test-type.rs
new file mode 100644
index 00000000000..882da5c2503
--- /dev/null
+++ b/src/test/rustdoc-ui/test-type.rs
@@ -0,0 +1,26 @@
+// compile-flags: --test --test-args=--test-threads=1
+// check-pass
+// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+
+/// ```
+/// let a = true;
+/// ```
+/// ```should_panic
+/// panic!()
+/// ```
+/// ```ignore (incomplete-code)
+/// fn foo() {
+/// ```
+/// ```no_run
+/// loop {
+///     println!("Hello, world");
+/// }
+/// ```
+/// fails to compile
+/// ```compile_fail
+/// let x = 5;
+/// x += 2; // shouldn't compile!
+/// ```
+
+pub fn f() {}
diff --git a/src/test/rustdoc-ui/test-type.stdout b/src/test/rustdoc-ui/test-type.stdout
new file mode 100644
index 00000000000..8f36d643b2f
--- /dev/null
+++ b/src/test/rustdoc-ui/test-type.stdout
@@ -0,0 +1,10 @@
+
+running 5 tests
+test $DIR/test-type.rs - f (line 12) ignore ... ignored
+test $DIR/test-type.rs - f (line 15) compile ... ok
+test $DIR/test-type.rs - f (line 21) compile fail ... ok
+test $DIR/test-type.rs - f (line 6) run ... ok
+test $DIR/test-type.rs - f (line 9) run ... ok
+
+test result: ok. 4 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/src/test/rustdoc-ui/unparseable-doc-test.stdout b/src/test/rustdoc-ui/unparseable-doc-test.stdout
index 2641c66f25e..dbbb6541b97 100644
--- a/src/test/rustdoc-ui/unparseable-doc-test.stdout
+++ b/src/test/rustdoc-ui/unparseable-doc-test.stdout
@@ -1,6 +1,6 @@
 
 running 1 test
-test $DIR/unparseable-doc-test.rs - foo (line 7) ... FAILED
+test $DIR/unparseable-doc-test.rs - foo (line 7) run ... FAILED
 
 failures:
 
diff --git a/src/test/ui/test-attrs/test-filter-multiple.run.stdout b/src/test/ui/test-attrs/test-filter-multiple.run.stdout
index 1aa684ed507..6389d7f998f 100644
--- a/src/test/ui/test-attrs/test-filter-multiple.run.stdout
+++ b/src/test/ui/test-attrs/test-filter-multiple.run.stdout
@@ -1,7 +1,7 @@
 
 running 2 tests
-test test1 ... ok
-test test2 ... ok
+test test1 run ... ok
+test test2 run ... ok
 
 test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in $TIME
 
diff --git a/src/test/ui/test-attrs/test-type.rs b/src/test/ui/test-attrs/test-type.rs
new file mode 100644
index 00000000000..3f0fa81373f
--- /dev/null
+++ b/src/test/ui/test-attrs/test-type.rs
@@ -0,0 +1,28 @@
+// compile-flags: --test
+// run-flags: --test-threads=1
+// check-run-results
+// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+// ignore-emscripten no threads support
+// run-pass
+
+
+#[test]
+fn test_ok() {
+    let _a = true;
+}
+
+#[test]
+#[should_panic]
+fn test_panic() {
+    panic!();
+}
+
+#[test]
+#[ignore]
+fn test_no_run() {
+    loop{
+        println!("Hello, world");
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/test-attrs/test-type.run.stdout b/src/test/ui/test-attrs/test-type.run.stdout
new file mode 100644
index 00000000000..5f10c784f89
--- /dev/null
+++ b/src/test/ui/test-attrs/test-type.run.stdout
@@ -0,0 +1,8 @@
+
+running 3 tests
+test test_no_run ignore ... ignored
+test test_ok run ... ok
+test test_panic should panic ... ok
+
+test result: ok. 2 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/src/test/ui/test-panic-abort-nocapture.run.stdout b/src/test/ui/test-panic-abort-nocapture.run.stdout
index 15b19676a7c..29d5172ce8c 100644
--- a/src/test/ui/test-panic-abort-nocapture.run.stdout
+++ b/src/test/ui/test-panic-abort-nocapture.run.stdout
@@ -1,12 +1,12 @@
 
 running 4 tests
-test it_fails ... about to fail
+test it_fails run ... about to fail
 FAILED
-test it_panics ... about to panic
+test it_panics should panic ... about to panic
 ok
-test it_works ... about to succeed
+test it_works run ... about to succeed
 ok
-test it_writes_to_stdio ... hello, world
+test it_writes_to_stdio run ... hello, world
 testing123
 ok
 
diff --git a/src/test/ui/test-panic-abort.run.stdout b/src/test/ui/test-panic-abort.run.stdout
index 467f834afec..2842f08f6cc 100644
--- a/src/test/ui/test-panic-abort.run.stdout
+++ b/src/test/ui/test-panic-abort.run.stdout
@@ -1,10 +1,10 @@
 
 running 5 tests
-test it_exits ... FAILED
-test it_fails ... FAILED
-test it_panics ... ok
-test it_works ... ok
-test no_residual_environment ... ok
+test it_exits run ... FAILED
+test it_fails run ... FAILED
+test it_panics should panic ... ok
+test it_works run ... ok
+test no_residual_environment run ... ok
 
 failures:
 
diff --git a/src/test/ui/test-passed.run.stdout b/src/test/ui/test-passed.run.stdout
index 17f70d60749..cd4b0e466a3 100644
--- a/src/test/ui/test-passed.run.stdout
+++ b/src/test/ui/test-passed.run.stdout
@@ -1,7 +1,7 @@
 
 running 2 tests
-test it_works ... ok
-test it_works_too ... ok
+test it_works run ... ok
+test it_works_too run ... ok
 
 test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/src/test/ui/test-thread-capture.run.stdout b/src/test/ui/test-thread-capture.run.stdout
index 487cfb55eb4..db9d90f20f2 100644
--- a/src/test/ui/test-thread-capture.run.stdout
+++ b/src/test/ui/test-thread-capture.run.stdout
@@ -1,7 +1,7 @@
 
 running 2 tests
-test thready_fail ... FAILED
-test thready_pass ... ok
+test thready_fail run ... FAILED
+test thready_pass run ... ok
 
 failures:
 
diff --git a/src/test/ui/test-thread-nocapture.run.stdout b/src/test/ui/test-thread-nocapture.run.stdout
index 9d2da50826c..42e6d40a4d1 100644
--- a/src/test/ui/test-thread-nocapture.run.stdout
+++ b/src/test/ui/test-thread-nocapture.run.stdout
@@ -1,11 +1,11 @@
 
 running 2 tests
-test thready_fail ... fee
+test thready_fail run ... fee
 fie
 foe
 fum
 FAILED
-test thready_pass ... fee
+test thready_pass run ... fee
 fie
 foe
 fum
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index d1798a52df7..f3751ff244f 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -649,6 +649,8 @@ fn make_test(config: &Config, testpaths: &TestPaths, inputs: &Stamp) -> Vec<test
                     ignore,
                     should_panic,
                     allow_fail: false,
+                    compile_fail: false,
+                    no_run: false,
                     test_type: test::TestType::Unknown,
                 },
                 testfn: make_test_closure(config, testpaths, revision),