@@ -261,6 +261,7 @@ mod tests {
261
261
use std:: io:: Write ;
262
262
use std:: slice;
263
263
use std:: sync:: Arc ;
264
+ use vmm_sys_util:: tempfile:: TempFile ;
264
265
265
266
// Adding a helper method to extract the errno within an Error::Mmap(e), or return a
266
267
// distinctive value when the error is represented by another variant.
@@ -291,7 +292,7 @@ mod tests {
291
292
292
293
#[ test]
293
294
fn test_mmap_region_from_file ( ) {
294
- let mut f = tempfile :: tempfile ( ) . unwrap ( ) ;
295
+ let mut f = TempFile :: new ( ) . unwrap ( ) . into_file ( ) ;
295
296
let offset: usize = 0 ;
296
297
let buf1 = [ 1u8 , 2 , 3 , 4 , 5 ] ;
297
298
@@ -309,7 +310,7 @@ mod tests {
309
310
310
311
#[ test]
311
312
fn test_mmap_region_build ( ) {
312
- let a = Arc :: new ( tempfile :: tempfile ( ) . unwrap ( ) ) ;
313
+ let a = Arc :: new ( TempFile :: new ( ) . unwrap ( ) . into_file ( ) ) ;
313
314
314
315
let prot = libc:: PROT_READ | libc:: PROT_WRITE ;
315
316
let flags = libc:: MAP_NORESERVE | libc:: MAP_PRIVATE ;
@@ -372,7 +373,7 @@ mod tests {
372
373
373
374
#[ test]
374
375
fn test_mmap_region_fds_overlap ( ) {
375
- let a = Arc :: new ( tempfile :: tempfile ( ) . unwrap ( ) ) ;
376
+ let a = Arc :: new ( TempFile :: new ( ) . unwrap ( ) . into_file ( ) ) ;
376
377
assert_eq ! ( unsafe { libc:: ftruncate( a. as_raw_fd( ) , 1024 * 10 ) } , 0 ) ;
377
378
378
379
let r1 = MmapRegion :: from_file ( FileOffset :: from_arc ( a. clone ( ) , 0 ) , 4096 ) . unwrap ( ) ;
@@ -386,7 +387,7 @@ mod tests {
386
387
assert ! ( r1. fds_overlap( & r2) ) ;
387
388
388
389
// Different files, so there's not overlap.
389
- let new_file = tempfile :: tempfile ( ) . unwrap ( ) ;
390
+ let new_file = TempFile :: new ( ) . unwrap ( ) . into_file ( ) ;
390
391
// Resize before mapping.
391
392
assert_eq ! (
392
393
unsafe { libc:: ftruncate( new_file. as_raw_fd( ) , 1024 * 10 ) } ,
0 commit comments