@@ -187,7 +187,6 @@ impl<T: Debug> FileEngine<T> {
187
187
pub mod tests {
188
188
#![ allow( clippy:: undocumented_unsafe_blocks) ]
189
189
use std:: os:: unix:: ffi:: OsStrExt ;
190
- use std:: os:: unix:: io:: FromRawFd ;
191
190
192
191
use vmm_sys_util:: tempfile:: TempFile ;
193
192
@@ -201,20 +200,6 @@ pub mod tests {
201
200
// 2 pages of memory should be enough to test read/write ops and also dirty tracking.
202
201
const MEM_LEN : usize = 8192 ;
203
202
204
- macro_rules! assert_err {
205
- ( $expression: expr, $( $pattern: tt) +) => {
206
- match $expression {
207
- Err ( UserDataError {
208
- user_data: _,
209
- error: $( $pattern) +,
210
- } ) => ( ) ,
211
- ref err => {
212
- panic!( "expected `{}` but got `{:?}`" , stringify!( $( $pattern) +) , err) ;
213
- }
214
- }
215
- } ;
216
- }
217
-
218
203
macro_rules! assert_sync_execution {
219
204
( $expression: expr, $count: expr) => {
220
205
match $expression {
@@ -265,17 +250,7 @@ pub mod tests {
265
250
266
251
#[ test]
267
252
fn test_sync ( ) {
268
- // Check invalid file
269
253
let mem = create_mem ( ) ;
270
- let file = unsafe { File :: from_raw_fd ( -2 ) } ;
271
- let mut engine = FileEngine :: from_file ( file, FileEngineType :: Sync ) . unwrap ( ) ;
272
- let res = engine. read ( 0 , & mem, GuestAddress ( 0 ) , 0 , ( ) ) ;
273
- assert_err ! ( res, BlockIoError :: Sync ( sync_io:: SyncIoError :: Seek ( _e) ) ) ;
274
- let res = engine. write ( 0 , & mem, GuestAddress ( 0 ) , 0 , ( ) ) ;
275
- assert_err ! ( res, BlockIoError :: Sync ( sync_io:: SyncIoError :: Seek ( _e) ) ) ;
276
- let res = engine. flush ( ( ) ) ;
277
- assert_err ! ( res, BlockIoError :: Sync ( sync_io:: SyncIoError :: SyncAll ( _e) ) ) ;
278
-
279
254
// Create backing file.
280
255
let file = TempFile :: new ( ) . unwrap ( ) . into_file ( ) ;
281
256
let mut engine = FileEngine :: from_file ( file, FileEngineType :: Sync ) . unwrap ( ) ;
@@ -342,10 +317,6 @@ pub mod tests {
342
317
343
318
#[ test]
344
319
fn test_async ( ) {
345
- // Check invalid file
346
- let file = unsafe { File :: from_raw_fd ( -2 ) } ;
347
- FileEngine :: < ( ) > :: from_file ( file, FileEngineType :: Async ) . unwrap_err ( ) ;
348
-
349
320
// Create backing file.
350
321
let file = TempFile :: new ( ) . unwrap ( ) . into_file ( ) ;
351
322
let mut engine = FileEngine :: < ( ) > :: from_file ( file, FileEngineType :: Async ) . unwrap ( ) ;
0 commit comments