@@ -11,14 +11,16 @@ use std::io::Write;
11
11
use std:: os:: unix:: prelude:: * ;
12
12
use tempfile:: tempfile;
13
13
use tempdir:: TempDir ;
14
- use libc:: { _exit, off_t} ;
14
+ use libc:: off_t;
15
+ use std:: process:: exit;
15
16
16
17
#[ test]
17
18
fn test_fork_and_waitpid ( ) {
19
+ #[ allow( unused_variables) ]
18
20
let m = :: FORK_MTX . lock ( ) . expect ( "Mutex got poisoned by another test" ) ;
19
21
let pid = fork ( ) ;
20
22
match pid {
21
- Ok ( Child ) => { unsafe { _exit ( 0 ) } ; }
23
+ Ok ( Child ) => { exit ( 0 ) ; }
22
24
Ok ( Parent { child } ) => {
23
25
// assert that child was created and pid > 0
24
26
let child_raw: :: libc:: pid_t = child. into ( ) ;
@@ -39,16 +41,16 @@ fn test_fork_and_waitpid() {
39
41
// panic, fork should never fail unless there is a serious problem with the OS
40
42
Err ( _) => panic ! ( "Error: Fork Failed" )
41
43
}
42
- drop ( m) ; // appease the unused_variable checker
43
44
}
44
45
45
46
#[ test]
46
47
fn test_wait ( ) {
47
- // grab FORK_MTX so wait doesn't reap a different test's child process
48
+ // Grab FORK_MTX so wait doesn't reap a different test's child process
49
+ #[ allow( unused_variables) ]
48
50
let m = :: FORK_MTX . lock ( ) . expect ( "Mutex got poisoned by another test" ) ;
49
51
let pid = fork ( ) ;
50
52
match pid {
51
- Ok ( Child ) => { unsafe { _exit ( 0 ) } ; }
53
+ Ok ( Child ) => { exit ( 0 ) ; }
52
54
Ok ( Parent { child } ) => {
53
55
let wait_status = wait ( ) ;
54
56
@@ -58,7 +60,6 @@ fn test_wait() {
58
60
// panic, fork should never fail unless there is a serious problem with the OS
59
61
Err ( _) => panic ! ( "Error: Fork Failed" )
60
62
}
61
- drop ( m) ; // appease the unused_variable checker
62
63
}
63
64
64
65
#[ test]
@@ -104,6 +105,7 @@ macro_rules! execve_test_factory(
104
105
( $test_name: ident, $syscall: ident, $unix_sh: expr, $android_sh: expr) => (
105
106
#[ test]
106
107
fn $test_name( ) {
108
+ #[ allow( unused_variables) ]
107
109
let m = :: FORK_MTX . lock( ) . expect( "Mutex got poisoned by another test" ) ;
108
110
// The `exec`d process will write to `writer`, and we'll read that
109
111
// data from `reader`.
@@ -144,14 +146,14 @@ macro_rules! execve_test_factory(
144
146
assert!( string. contains( "baz=quux" ) ) ;
145
147
}
146
148
}
147
- drop( m) ; // appease the unused_variable checker
148
149
}
149
150
)
150
151
) ;
151
152
152
153
#[ test]
153
154
fn test_fchdir ( ) {
154
155
// fchdir changes the process's cwd
156
+ #[ allow( unused_variables) ]
155
157
let m = :: CWD_MTX . lock ( ) . expect ( "Mutex got poisoned by another test" ) ;
156
158
let tmpdir = TempDir :: new ( "test_fchdir" ) . unwrap ( ) ;
157
159
let tmpdir_path = tmpdir. path ( ) . canonicalize ( ) . unwrap ( ) ;
@@ -161,12 +163,12 @@ fn test_fchdir() {
161
163
assert_eq ! ( getcwd( ) . unwrap( ) , tmpdir_path) ;
162
164
163
165
assert ! ( close( tmpdir_fd) . is_ok( ) ) ;
164
- drop ( m) ; // appease the unused_variable checker
165
166
}
166
167
167
168
#[ test]
168
169
fn test_getcwd ( ) {
169
170
// chdir changes the process's cwd
171
+ #[ allow( unused_variables) ]
170
172
let m = :: CWD_MTX . lock ( ) . expect ( "Mutex got poisoned by another test" ) ;
171
173
let tmp_dir = TempDir :: new ( "test_getcwd" ) . unwrap ( ) ;
172
174
assert ! ( chdir( tmp_dir. path( ) ) . is_ok( ) ) ;
@@ -184,7 +186,6 @@ fn test_getcwd() {
184
186
}
185
187
assert ! ( chdir( inner_tmp_dir. as_path( ) ) . is_ok( ) ) ;
186
188
assert_eq ! ( getcwd( ) . unwrap( ) , inner_tmp_dir. as_path( ) ) ;
187
- drop ( m) ; // appease the unused_variable checker
188
189
}
189
190
190
191
#[ test]
0 commit comments