From 7b19389d586a4bb29180c365e69138609b8a6f01 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 19 Jul 2024 14:05:09 -0400 Subject: [PATCH] rewrite test-benches to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/test-benches/Makefile | 12 ----------- tests/run-make/test-benches/rmake.rs | 21 +++++++++++++++++++ 3 files changed, 21 insertions(+), 13 deletions(-) delete mode 100644 tests/run-make/test-benches/Makefile create mode 100644 tests/run-make/test-benches/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index bd25a6c144e..8612d591c7e 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -100,7 +100,6 @@ run-make/staticlib-dylib-linkage/Makefile run-make/symbol-mangling-hashed/Makefile run-make/symbol-visibility/Makefile run-make/sysroot-crates-are-unstable/Makefile -run-make/test-benches/Makefile run-make/thumb-none-cortex-m/Makefile run-make/thumb-none-qemu/Makefile run-make/translation/Makefile diff --git a/tests/run-make/test-benches/Makefile b/tests/run-make/test-benches/Makefile deleted file mode 100644 index 11aed2e4c79..00000000000 --- a/tests/run-make/test-benches/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -include ../tools.mk - -# ignore-cross-compile -# needs-unwind #[bench] and -Zpanic-abort-tests can't be combined - -all: - # Smoke-test that `#[bench]` isn't entirely broken. - $(RUSTC) --test smokebench.rs -O - $(call RUN,smokebench --bench) - $(call RUN,smokebench --bench noiter) - $(call RUN,smokebench --bench yesiter) - $(call RUN,smokebench) diff --git a/tests/run-make/test-benches/rmake.rs b/tests/run-make/test-benches/rmake.rs new file mode 100644 index 00000000000..acf9b04becb --- /dev/null +++ b/tests/run-make/test-benches/rmake.rs @@ -0,0 +1,21 @@ +// #[bench] is a Rust feature to run benchmarks on performance-critical +// code, which previously experienced a runtime panic bug in #103794. +// In order to ensure future breakages of this feature are detected, this +// smoke test was created, using the benchmarking feature with various +// runtime flags. +// See https://github.com/rust-lang/rust/issues/103794 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed +//@ needs-unwind +// Reason: #[bench] and -Zpanic-abort-tests can't be combined + +use run_make_support::{run, run_with_args, rustc}; + +fn main() { + rustc().arg("--test").input("smokebench.rs").opt().run(); + run_with_args("smokebench", &["--bench"]); + run_with_args("smokebench", &["--bench", "noiter"]); + run_with_args("smokebench", &["--bench", "yesiter"]); + run("smokebench"); +}