@@ -8,52 +8,8 @@ use std::thread;
88
99use cargo_test_support:: { project, slow_cpu_multiplier} ;
1010
11- #[ cfg( unix) ]
12- fn enabled ( ) -> bool {
13- true
14- }
15-
16- // On Windows support for these tests is only enabled through the usage of job
17- // objects. Support for nested job objects, however, was added in recent-ish
18- // versions of Windows, so this test may not always be able to succeed.
19- //
20- // As a result, we try to add ourselves to a job object here
21- // can succeed or not.
22- #[ cfg( windows) ]
23- fn enabled ( ) -> bool {
24- use winapi:: um:: { handleapi, jobapi, jobapi2, processthreadsapi} ;
25-
26- unsafe {
27- // If we're not currently in a job, then we can definitely run these
28- // tests.
29- let me = processthreadsapi:: GetCurrentProcess ( ) ;
30- let mut ret = 0 ;
31- let r = jobapi:: IsProcessInJob ( me, 0 as * mut _ , & mut ret) ;
32- assert_ne ! ( r, 0 ) ;
33- if ret == :: winapi:: shared:: minwindef:: FALSE {
34- return true ;
35- }
36-
37- // If we are in a job, then we can run these tests if we can be added to
38- // a nested job (as we're going to create a nested job no matter what as
39- // part of these tests.
40- //
41- // If we can't be added to a nested job, then these tests will
42- // definitely fail, and there's not much we can do about that.
43- let job = jobapi2:: CreateJobObjectW ( 0 as * mut _ , 0 as * const _ ) ;
44- assert ! ( !job. is_null( ) ) ;
45- let r = jobapi2:: AssignProcessToJobObject ( job, me) ;
46- handleapi:: CloseHandle ( job) ;
47- r != 0
48- }
49- }
50-
5111#[ cargo_test]
5212fn ctrl_c_kills_everyone ( ) {
53- if !enabled ( ) {
54- return ;
55- }
56-
5713 let listener = TcpListener :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
5814 let addr = listener. local_addr ( ) . unwrap ( ) ;
5915
0 commit comments