Add test case in task.rs for #2782
This commit is contained in:
@@ -1206,6 +1206,44 @@ fn test_unkillable() {
|
|||||||
po.recv();
|
po.recv();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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]
|
#[test]
|
||||||
fn test_tls_multitask() unsafe {
|
fn test_tls_multitask() unsafe {
|
||||||
fn my_key(+_x: @str) { }
|
fn my_key(+_x: @str) { }
|
||||||
|
|||||||
Reference in New Issue
Block a user