Skip to content

Commit

Permalink
Rollup merge of #127985 - Oneirical:testibule-of-hell, r=Kobzol
Browse files Browse the repository at this point in the history
Migrate `test-benches`, `c-unwind-abi-catch-panic` and `compiler-lookup-paths-2` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
  • Loading branch information
jieyouxu authored Jul 22, 2024
2 parents c896139 + 2192a91 commit 5b915ab
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 36 deletions.
3 changes: 0 additions & 3 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ run-make/branch-protection-check-IBT/Makefile
run-make/c-dynamic-dylib/Makefile
run-make/c-dynamic-rlib/Makefile
run-make/c-unwind-abi-catch-lib-panic/Makefile
run-make/c-unwind-abi-catch-panic/Makefile
run-make/cat-and-grep-sanity-check/Makefile
run-make/cdylib-dylib-linkage/Makefile
run-make/compiler-lookup-paths-2/Makefile
run-make/compiler-rt-works-on-mingw/Makefile
run-make/cross-lang-lto-clang/Makefile
run-make/cross-lang-lto-pgo-smoketest/Makefile
Expand Down Expand Up @@ -90,7 +88,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
Expand Down
10 changes: 0 additions & 10 deletions tests/run-make/c-unwind-abi-catch-panic/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions tests/run-make/c-unwind-abi-catch-panic/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A test for calling `C-unwind` functions across foreign function boundaries (FFI).
// This test triggers a panic when calling a foreign function that calls *back* into Rust.
// This catches a panic across an FFI boundary and downcasts it into an integer.
// The Rust code that panics is in the same directory, unlike `c-unwind-abi-catch-lib-panic`.
// See https://github.com/rust-lang/rust/pull/76570

//@ ignore-cross-compile
// Reason: the compiled binary is executed
//@ needs-unwind
// Reason: this test exercises panic unwinding

use run_make_support::{build_native_static_lib, run, rustc};

fn main() {
build_native_static_lib("add");
rustc().input("main.rs").run();
run("main");
}
11 changes: 0 additions & 11 deletions tests/run-make/compiler-lookup-paths-2/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/compiler-lookup-paths-2/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This test checks that extern crate declarations in Cargo without a corresponding declaration
// in the manifest of a dependency are NOT allowed. The last rustc call does it anyways, which
// should result in a compilation failure.
// See https://github.com/rust-lang/rust/pull/21113

use run_make_support::{path, rfs, rust_lib_name, rustc};

fn main() {
rfs::create_dir("a");
rfs::create_dir("b");
rustc().input("a.rs").run();
rfs::rename(rust_lib_name("a"), path("a").join(rust_lib_name("a")));
rustc().input("b.rs").library_search_path("a").run();
rfs::rename(rust_lib_name("b"), path("b").join(rust_lib_name("b")));
rustc()
.input("c.rs")
.library_search_path("crate=b")
.library_search_path("dependency=a")
.run_fail();
}
12 changes: 0 additions & 12 deletions tests/run-make/test-benches/Makefile

This file was deleted.

22 changes: 22 additions & 0 deletions tests/run-make/test-benches/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// #[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() {
// Smoke-test that #[bench] isn't entirely broken.
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");
}

0 comments on commit 5b915ab

Please sign in to comment.