rust/library
bors e5bb341f0e Auto merge of #111992 - ferrocene:pa-panic-abort-tests-bench, r=m-ou-se
Test benchmarks with `-Z panic-abort-tests`

During test execution, when a `#[bench]` benchmark is encountered it's executed once to check whether it works. Unfortunately that was not compatible with `-Z panic-abort-tests`: the feature works by spawning a subprocess for each test, which prevents the use of dynamic tests as we cannot pass closures to child processes, and before this PR the conversion from benchmark to test was done by turning benchmarks into dynamic tests whose closures execute the benchmark once.

The approach this PR took was to add two new kinds of `TestFn`s: `StaticBenchAsTestFn` and `DynBenchAsTestFn` (⚠️ **this is a breaking change** ⚠️). With that change, a `StaticBenchFn` can be converted into a `StaticBenchAsTestFn` without creating dynamic tests, and making it possible to test `#[bench]` functions with `-Z panic-abort-tests`. The subprocess test runner also had to be updated to perform the conversion from benchmark to test when appropriate.

Along with the bug fix, in the first commit I refactored how tests are executed: rather than executing the test function in multiple places across `libtest`, there is now a private `TestFn::into_runnable()` method, which returns either a `RunnableTest` or `RunnableBench`, on which you can call the `run()` method. This simplified the rest of the changes in the PR.

This PR is best reviewed commit-by-commit.
Fixes https://github.com/rust-lang/rust/issues/73509
2023-07-01 07:07:50 +00:00
..
alloc Rollup merge of #112628 - gootorov:box_alloc_partialeq, r=joshtriplett 2023-06-27 22:10:13 +02:00
backtrace@4245978ca8 PS Vita std support 2023-05-07 18:57:43 +03:00
core Auto merge of #113194 - lu-zero:intrinsics-inline, r=thomcc 2023-07-01 04:24:26 +00:00
panic_abort Remove unnecessary raw pointer in __rust_start_panic arg 2023-03-26 16:40:18 +00:00
panic_unwind Partial stabilisation of c_unwind 2023-04-29 13:01:44 +01:00
portable-simd Explicit set workspace.resolver = "1" 2023-05-31 00:08:11 +01:00
proc_macro Merge proc_macro_span_shrink and proc_macro_span 2023-06-20 19:40:26 -04:00
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std make HashMap::or_insert_with example more simple 2023-06-29 09:33:15 +02:00
stdarch@d77878b729 Bump stdarch 2023-06-13 21:45:04 -07:00
sysroot Expose compiler-builtins-weak-intrinsics feature for -Zbuild-std 2023-06-23 11:15:34 +01:00
test Auto merge of #111992 - ferrocene:pa-panic-abort-tests-bench, r=m-ou-se 2023-07-01 07:07:50 +00:00
unwind wip: Support Apple tvOS in libstd 2023-06-21 14:59:37 -07:00