diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-02-15 01:16:53 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-02-15 01:16:53 -0800 |
| commit | 9f95ccb4269f2bb795c56d0fa7692cb7705c608e (patch) | |
| tree | 0d260d24ff3521f4c36ff9075b10d0461afb3607 /src | |
| parent | 450c4f3fa84f1cc1fe85e2f74402e00a7557433b (diff) | |
| download | rust-9f95ccb4269f2bb795c56d0fa7692cb7705c608e.tar.gz rust-9f95ccb4269f2bb795c56d0fa7692cb7705c608e.zip | |
test: Add a crust function stress test
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/run-pass/crust-stress.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/run-pass/crust-stress.rs b/src/test/run-pass/crust-stress.rs new file mode 100644 index 00000000000..73dac3f48c4 --- /dev/null +++ b/src/test/run-pass/crust-stress.rs @@ -0,0 +1,28 @@ +// This creates a bunch of yielding tasks that run concurrently +// while holding onto C stacks + +native mod rustrt { + fn rust_dbg_call(cb: *u8, + data: ctypes::uintptr_t) -> ctypes::uintptr_t; +} + +crust fn cb(data: ctypes::uintptr_t) -> ctypes::uintptr_t { + if data == 1u { + data + } else { + task::yield(); + count(data - 1u) + count(data - 1u) + } +} + +fn count(n: uint) -> uint { + rustrt::rust_dbg_call(cb, n) +} + +fn main() { + iter::repeat(100u) {|| + task::spawn {|| + count(5u); + }; + } +} \ No newline at end of file |
