diff --git a/src/test/run-fail/morestack2.rs b/src/test/run-fail/morestack2.rs index 4e92a144085a..02b1adae4816 100644 --- a/src/test/run-fail/morestack2.rs +++ b/src/test/run-fail/morestack2.rs @@ -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); + }); } \ No newline at end of file diff --git a/src/test/run-fail/morestack3.rs b/src/test/run-fail/morestack3.rs new file mode 100644 index 000000000000..9fdd0326b661 --- /dev/null +++ b/src/test/run-fail/morestack3.rs @@ -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); +} \ No newline at end of file