File tree 3 files changed +16
-7
lines changed
3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,8 @@ fn get_target() -> String {
110
110
fn test_runner ( _tests : & [ & ( ) ] ) {
111
111
// Add a test env var to do environment communication tests.
112
112
std:: env:: set_var ( "MIRI_ENV_VAR_TEST" , "0" ) ;
113
+ // Let the tests know where to store temp files (they might run for a different target, which can make this hard to find).
114
+ std:: env:: set_var ( "MIRI_TEMP" , std:: env:: temp_dir ( ) ) ;
113
115
114
116
let target = get_target ( ) ;
115
117
miri_pass ( "tests/run-pass" , & target) ;
Original file line number Diff line number Diff line change @@ -16,19 +16,21 @@ fn main() {
16
16
test_directory ( ) ;
17
17
}
18
18
19
+ fn tmp ( ) -> PathBuf {
20
+ std:: env:: var ( "MIRI_TEMP" ) . map ( PathBuf :: from) . unwrap_or_else ( |_| std:: env:: temp_dir ( ) )
21
+ }
22
+
19
23
/// Prepare: compute filename and make sure the file does not exist.
20
24
fn prepare ( filename : & str ) -> PathBuf {
21
- let tmp = std:: env:: temp_dir ( ) ;
22
- let path = tmp. join ( filename) ;
25
+ let path = tmp ( ) . join ( filename) ;
23
26
// Clean the paths for robustness.
24
27
remove_file ( & path) . ok ( ) ;
25
28
path
26
29
}
27
30
28
31
/// Prepare directory: compute directory name and make sure it does not exist.
29
32
fn prepare_dir ( dirname : & str ) -> PathBuf {
30
- let tmp = std:: env:: temp_dir ( ) ;
31
- let path = tmp. join ( & dirname) ;
33
+ let path = tmp ( ) . join ( & dirname) ;
32
34
// Clean the directory for robustness.
33
35
remove_dir_all ( & path) . ok ( ) ;
34
36
path
Original file line number Diff line number Diff line change 2
2
// compile-flags: -Zmiri-disable-isolation
3
3
4
4
#![ feature( rustc_private) ]
5
+ #![ allow( unused) ] // necessary on macos due to conditional compilation
6
+
7
+ use std:: path:: PathBuf ;
5
8
6
- #[ allow( unused) ] // necessary on macos due to conditional compilation
7
9
extern crate libc;
8
10
11
+ fn tmp ( ) -> PathBuf {
12
+ std:: env:: var ( "MIRI_TEMP" ) . map ( PathBuf :: from) . unwrap_or_else ( |_| std:: env:: temp_dir ( ) )
13
+ }
14
+
9
15
#[ cfg( not( target_os = "macos" ) ) ]
10
16
fn test_posix_fadvise ( ) {
11
17
use std:: convert:: TryInto ;
12
- use std:: env:: temp_dir;
13
18
use std:: fs:: { File , remove_file} ;
14
19
use std:: io:: Write ;
15
20
use std:: os:: unix:: io:: AsRawFd ;
16
21
17
- let path = temp_dir ( ) . join ( "miri_test_libc.txt" ) ;
22
+ let path = tmp ( ) . join ( "miri_test_libc.txt" ) ;
18
23
// Cleanup before test
19
24
remove_file ( & path) . ok ( ) ;
20
25
You can’t perform that action at this time.
0 commit comments