File tree 2 files changed +34
-7
lines changed
2 files changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ fn main() {
20
20
test_file_open_unix_extra_third_arg ( ) ;
21
21
#[ cfg( target_os = "linux" ) ]
22
22
test_o_tmpfile_flag ( ) ;
23
- test_tempfile ( ) ;
24
23
}
25
24
26
25
fn tmp ( ) -> PathBuf {
@@ -167,9 +166,3 @@ fn test_o_tmpfile_flag() {
167
166
. raw_os_error( ) ,
168
167
) ;
169
168
}
170
-
171
- /// Test that the [`tempfile`] crate is compatible with miri.
172
- fn test_tempfile ( ) {
173
- let dir_path = tmp ( ) ;
174
- tempfile:: tempfile_in ( dir_path) . unwrap ( ) ;
175
- }
Original file line number Diff line number Diff line change
1
+ //@ignore-target-windows: no libc on Windows
2
+ //@compile-flags: -Zmiri-disable-isolation
3
+
4
+ //! Test that the [`tempfile`] crate is compatible with miri.
5
+ fn main ( ) {
6
+ test_tempfile ( ) ;
7
+ test_tempfile_in ( ) ;
8
+ }
9
+
10
+ fn tmp ( ) -> PathBuf {
11
+ std:: env:: var ( "MIRI_TEMP" )
12
+ . map ( |tmp| {
13
+ // MIRI_TEMP is set outside of our emulated
14
+ // program, so it may have path separators that don't
15
+ // correspond to our target platform. We normalize them here
16
+ // before constructing a `PathBuf`
17
+
18
+ #[ cfg( windows) ]
19
+ return PathBuf :: from ( tmp. replace ( "/" , "\\ " ) ) ;
20
+
21
+ #[ cfg( not( windows) ) ]
22
+ return PathBuf :: from ( tmp. replace ( "\\ " , "/" ) ) ;
23
+ } )
24
+ . unwrap_or_else ( |_| std:: env:: temp_dir ( ) )
25
+ }
26
+
27
+ fn test_tempfile ( ) {
28
+ tempfile:: tempfile ( ) . unwrap ( ) ;
29
+ }
30
+
31
+ fn test_tempfile_in ( ) {
32
+ let dir_path = tmp ( ) ;
33
+ tempfile:: tempfile_in ( dir_path) . unwrap ( ) ;
34
+ }
You can’t perform that action at this time.
0 commit comments