about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2023-05-26 12:56:51 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2023-05-26 14:59:14 +0200
commit142f4537584e76569a2aaa644f0b3e6c727b194f (patch)
treea37f0464d867634b7a22cc5df6b09dcb5ee852fa
parentb82eb282243811edbc7a0c61c3900d1907cd5d18 (diff)
downloadrust-142f4537584e76569a2aaa644f0b3e6c727b194f.tar.gz
rust-142f4537584e76569a2aaa644f0b3e6c727b194f.zip
add tests on running benchmarks with -Z panic-abort-tests
-rw-r--r--tests/ui/test-attrs/test-panic-abort.rs9
-rw-r--r--tests/ui/test-attrs/test-panic-abort.run.stdout7
2 files changed, 13 insertions, 3 deletions
diff --git a/tests/ui/test-attrs/test-panic-abort.rs b/tests/ui/test-attrs/test-panic-abort.rs
index 931b7993c81..08e5242af66 100644
--- a/tests/ui/test-attrs/test-panic-abort.rs
+++ b/tests/ui/test-attrs/test-panic-abort.rs
@@ -11,9 +11,13 @@
 // ignore-sgx no subprocess support
 
 #![cfg(test)]
+#![feature(test)]
+
+extern crate test;
 
 use std::io::Write;
 use std::env;
+use test::Bencher;
 
 #[test]
 fn it_works() {
@@ -48,3 +52,8 @@ fn no_residual_environment() {
         }
     }
 }
+
+#[bench]
+fn benchmark(b: &mut Bencher) {
+    b.iter(|| assert_eq!(1 + 1, 2));
+}
diff --git a/tests/ui/test-attrs/test-panic-abort.run.stdout b/tests/ui/test-attrs/test-panic-abort.run.stdout
index f608a8cdc55..b6b9c2560fe 100644
--- a/tests/ui/test-attrs/test-panic-abort.run.stdout
+++ b/tests/ui/test-attrs/test-panic-abort.run.stdout
@@ -1,5 +1,6 @@
 
-running 5 tests
+running 6 tests
+test benchmark ... ok
 test it_exits ... FAILED
 test it_fails ... FAILED
 test it_panics - should panic ... ok
@@ -18,7 +19,7 @@ testing123
 testing321
 thread 'main' panicked at 'assertion failed: `(left == right)`
   left: `2`,
- right: `5`', $DIR/test-panic-abort.rs:34:5
+ right: `5`', $DIR/test-panic-abort.rs:38:5
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 
 
@@ -26,5 +27,5 @@ failures:
     it_exits
     it_fails
 
-test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+test result: FAILED. 4 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME