Skip to content

Commit

Permalink
Migrate wasm-exceptions-nostd to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Rejyr committed Jun 29, 2024
1 parent 189232b commit 68b6bb2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,4 @@ run-make/track-pgo-dep-info/Makefile
run-make/translation/Makefile
run-make/type-mismatch-same-crate-name/Makefile
run-make/unstable-flag-required/Makefile
run-make/wasm-exceptions-nostd/Makefile
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile
12 changes: 0 additions & 12 deletions tests/run-make/wasm-exceptions-nostd/Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions tests/run-make/wasm-exceptions-nostd/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//@ only-wasm32-bare

use std::path::Path;

use run_make_support::{cmd, env_var, rustc};

fn main() {
// Add a few command line args to make exceptions work
rustc()
.input(Path::new("src").join("lib.rs"))
.target("wasm32-unknown-unknown")
.panic("unwind")
.arg("-Cllvm-args=-wasm-enable-eh")
.arg("-Ctarget-feature=+exception-handling")
.run();

cmd(&env_var("NODE")).arg("verify.mjs").arg("lib.wasm").run();
}
4 changes: 2 additions & 2 deletions tests/run-make/wasm-exceptions-nostd/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ fn panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
use alloc::boxed::Box;
use alloc::string::ToString;

let msg = info.message().map(|msg| msg.to_string()).unwrap_or("(no message)".to_string());
let exception = Box::new(msg.to_string());
let msg = info.message().to_string();
let exception = Box::new(msg);
unsafe {
let exception_raw = Box::into_raw(exception);
wasm_throw(exception_raw as *mut u8);
Expand Down

0 comments on commit 68b6bb2

Please sign in to comment.