diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-05 21:01:18 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-05 21:01:18 -0400 |
| commit | 2ee779c8393cf534414df6837333c188437fad0d (patch) | |
| tree | 67e6a8fbd47761c4a2821482e36dc445e65f7d6a | |
| parent | 7b3add0632f65865159af1ee35933c4e61d41f8b (diff) | |
Add test case in task.rs for #2782
| -rw-r--r-- | src/libcore/task.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 7794798de11..fd69525d63e 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -1207,6 +1207,44 @@ fn test_unkillable() { } #[test] +#[ignore(cfg(windows))] +#[should_fail] +fn test_unkillable_nested() { + import comm::methods; + let po = comm::port(); + let ch = po.chan(); + + // We want to do this after failing + do spawn { + for iter::repeat(10u) { yield() } + ch.send(()); + } + + do spawn { + yield(); + // We want to fail after the unkillable task + // blocks on recv + fail; + } + + unsafe { + do unkillable { + do unkillable {} // Here's the difference from the previous test. + let p = ~0; + let pp: *uint = unsafe::transmute(p); + + // If we are killed here then the box will leak + po.recv(); + + let _p: ~int = unsafe::transmute(pp); + } + } + + // Now we can be killed + po.recv(); +} + +#[test] fn test_tls_multitask() unsafe { fn my_key(+_x: @str) { } local_data_set(my_key, @"parent data"); |
