-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Migrate c-unwind-abi-catch-lib-panic
, foreign-rust-exceptions
and export-executable-symbols
run-make
tests to rmake
#128065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Exercise unwinding a panic. This catches a panic across an FFI (foreign function interface) | ||
// boundary and downcasts it into an integer. | ||
// The Rust code that panics is in a separate crate. | ||
// See https://github.com/rust-lang/rust/commit/baf227ea0c1e07fc54395a51e4b3881d701180cb | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
//@ needs-unwind | ||
// Reason: this test exercises unwinding a panic | ||
|
||
use run_make_support::{cc, is_msvc, llvm_ar, run, rustc, static_lib_name}; | ||
|
||
fn main() { | ||
// Compile `add.c` into an object file. | ||
if is_msvc() { | ||
cc().arg("-c").out_exe("add").input("add.c").run(); | ||
} else { | ||
cc().arg("-v").arg("-c").out_exe("add.o").input("add.c").run(); | ||
}; | ||
|
||
// Compile `panic.rs` into an object file. | ||
// Note that we invoke `rustc` directly, so we may emit an object rather | ||
// than an archive. We'll do that later. | ||
rustc().emit("obj").input("panic.rs").run(); | ||
|
||
// Now, create an archive using these two objects. | ||
if is_msvc() { | ||
llvm_ar().obj_to_ar().args(&[&static_lib_name("add"), "add.obj", "panic.o"]).run(); | ||
} else { | ||
llvm_ar().obj_to_ar().args(&[&static_lib_name("add"), "add.o", "panic.o"]).run(); | ||
}; | ||
|
||
// Compile `main.rs`, which will link into our library, and run it. | ||
rustc().input("main.rs").run(); | ||
run("main"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// The unstable flag `-Z export-executable-symbols` exports symbols from executables, as if | ||
// they were dynamic libraries. This test is a simple smoke test to check that this feature | ||
// works by using it in compilation, then checking that the output binary contains the exported | ||
// symbol. | ||
// See https://github.com/rust-lang/rust/pull/85673 | ||
|
||
//@ only-unix | ||
// Reason: the export-executable-symbols flag only works on Unix | ||
// due to hardcoded platform-specific implementation | ||
// (See #85673) | ||
//@ ignore-wasm32 | ||
//@ ignore-wasm64 | ||
//@ ignore-none | ||
// Reason: no-std is not supported | ||
|
||
use run_make_support::{bin_name, llvm_readobj, rustc}; | ||
|
||
fn main() { | ||
rustc().arg("-Zexport-executable-symbols").input("main.rs").crate_type("bin").run(); | ||
llvm_readobj() | ||
.symbols() | ||
.input(bin_name("main")) | ||
.run() | ||
.assert_stdout_contains("exported_symbol"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Rust exceptions can be foreign (from C code, in this test) or local. Foreign | ||
// exceptions should not be caught, as that can cause undefined behaviour. Instead | ||
// of catching them, #102721 made it so that the binary panics in execution with a helpful message. | ||
// This test checks that the correct message appears and that execution fails when trying to catch | ||
// a foreign exception. | ||
// See https://github.com/rust-lang/rust/issues/102715 | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
//@ needs-unwind | ||
// Reason: unwinding panics is exercised in this test | ||
|
||
//@ ignore-i686-pc-windows-gnu | ||
// Reason: This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder | ||
// so cross-DLL unwinding does not work. | ||
|
||
use run_make_support::{run_fail, rustc}; | ||
|
||
fn main() { | ||
rustc().input("bar.rs").crate_type("cdylib").run(); | ||
rustc().input("foo.rs").run(); | ||
run_fail("foo").assert_stderr_contains("Rust cannot catch foreign exceptions"); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.