Skip to content

Commit de5c8d9

Browse files
committed
make UI test also test extern Rust
1 parent 6cf9185 commit de5c8d9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/test/ui/abi/abort-on-c-abi.rs renamed to src/test/ui/abi/abort-on-panic.rs

+21
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,43 @@ extern "C" fn panic_in_ffi() {
1919
panic!("Test");
2020
}
2121

22+
#[unwind(aborts)]
23+
extern "Rust" fn panic_in_rust_abi() {
24+
panic!("TestRust");
25+
}
26+
2227
fn test() {
2328
let _ = panic::catch_unwind(|| { panic_in_ffi(); });
2429
// The process should have aborted by now.
2530
io::stdout().write(b"This should never be printed.\n");
2631
let _ = io::stdout().flush();
2732
}
2833

34+
fn testrust() {
35+
let _ = panic::catch_unwind(|| { panic_in_rust_abi(); });
36+
// The process should have aborted by now.
37+
io::stdout().write(b"This should never be printed.\n");
38+
let _ = io::stdout().flush();
39+
}
40+
2941
fn main() {
3042
let args: Vec<String> = env::args().collect();
3143
if args.len() > 1 && args[1] == "test" {
3244
return test();
3345
}
46+
if args.len() > 1 && args[1] == "testrust" {
47+
return testrust();
48+
}
3449

3550
let mut p = Command::new(&args[0])
3651
.stdout(Stdio::piped())
3752
.stdin(Stdio::piped())
3853
.arg("test").spawn().unwrap();
3954
assert!(!p.wait().unwrap().success());
55+
56+
let mut p = Command::new(&args[0])
57+
.stdout(Stdio::piped())
58+
.stdin(Stdio::piped())
59+
.arg("testrust").spawn().unwrap();
60+
assert!(!p.wait().unwrap().success());
4061
}

0 commit comments

Comments
 (0)