Skip to content

Commit 8d8148f

Browse files
committed
test: More tests for unwinding + morestack
1 parent 58844ae commit 8d8148f

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

src/test/run-fail/morestack2.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
// See the hack in upcall_call_shim_on_c_stack where it messes
88
// with the stack limit.
99

10+
use std;
11+
1012
native mod rustrt {
13+
fn set_min_stack(size: uint);
1114
fn pin_task();
1215
}
1316

@@ -26,10 +29,13 @@ resource and_then_get_big_again(_i: ()) {
2629
getbig(i - 1);
2730
}
2831
}
29-
getbig(100000);
32+
getbig(10000);
3033
}
3134

3235
fn main() {
33-
let r = and_then_get_big_again(());
34-
getbig_call_c_and_fail(100000);
36+
rustrt::set_min_stack(256u);
37+
std::task::spawn((), fn (&&_i: ()) {
38+
let r = and_then_get_big_again(());
39+
getbig_call_c_and_fail(10000);
40+
});
3541
}

src/test/run-fail/morestack3.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// xfail-test
2+
// error-pattern:explicit failure
3+
// compile-flags:--stack-growth
4+
5+
// Just testing unwinding
6+
7+
use std;
8+
9+
native mod rustrt {
10+
fn set_min_stack(size: uint);
11+
}
12+
13+
fn getbig_and_fail(&&i: int) {
14+
let r = and_then_get_big_again(@0);
15+
if i != 0 {
16+
getbig_and_fail(i - 1);
17+
} else {
18+
fail;
19+
}
20+
}
21+
22+
resource and_then_get_big_again(_i: @int) {
23+
fn getbig(i: int) {
24+
if i != 0 {
25+
getbig(i - 1);
26+
}
27+
}
28+
getbig(1000);
29+
}
30+
31+
fn main() {
32+
rustrt::set_min_stack(256u);
33+
std::task::spawn(1000, getbig_and_fail);
34+
}

0 commit comments

Comments
 (0)