test: More tests for unwinding + morestack
This commit is contained in:
parent
58844aee42
commit
8d8148f1f7
@ -7,7 +7,10 @@
|
||||
// See the hack in upcall_call_shim_on_c_stack where it messes
|
||||
// with the stack limit.
|
||||
|
||||
use std;
|
||||
|
||||
native mod rustrt {
|
||||
fn set_min_stack(size: uint);
|
||||
fn pin_task();
|
||||
}
|
||||
|
||||
@ -26,10 +29,13 @@ resource and_then_get_big_again(_i: ()) {
|
||||
getbig(i - 1);
|
||||
}
|
||||
}
|
||||
getbig(100000);
|
||||
getbig(10000);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let r = and_then_get_big_again(());
|
||||
getbig_call_c_and_fail(100000);
|
||||
rustrt::set_min_stack(256u);
|
||||
std::task::spawn((), fn (&&_i: ()) {
|
||||
let r = and_then_get_big_again(());
|
||||
getbig_call_c_and_fail(10000);
|
||||
});
|
||||
}
|
34
src/test/run-fail/morestack3.rs
Normal file
34
src/test/run-fail/morestack3.rs
Normal file
@ -0,0 +1,34 @@
|
||||
// xfail-test
|
||||
// error-pattern:explicit failure
|
||||
// compile-flags:--stack-growth
|
||||
|
||||
// Just testing unwinding
|
||||
|
||||
use std;
|
||||
|
||||
native mod rustrt {
|
||||
fn set_min_stack(size: uint);
|
||||
}
|
||||
|
||||
fn getbig_and_fail(&&i: int) {
|
||||
let r = and_then_get_big_again(@0);
|
||||
if i != 0 {
|
||||
getbig_and_fail(i - 1);
|
||||
} else {
|
||||
fail;
|
||||
}
|
||||
}
|
||||
|
||||
resource and_then_get_big_again(_i: @int) {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
getbig(i - 1);
|
||||
}
|
||||
}
|
||||
getbig(1000);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
rustrt::set_min_stack(256u);
|
||||
std::task::spawn(1000, getbig_and_fail);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user