1
1
#![ feature( slice_concat_ext) ]
2
2
3
3
extern crate compiletest_rs as compiletest;
4
+ extern crate tempdir;
4
5
5
6
use std:: slice:: SliceConcatExt ;
6
7
use std:: path:: { PathBuf , Path } ;
7
8
use std:: io:: Write ;
9
+ use tempdir:: TempDir ;
8
10
9
11
macro_rules! eprintln {
10
12
( $( $arg: tt) * ) => {
@@ -35,8 +37,10 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
35
37
path,
36
38
target
37
39
) ;
38
- let mut config = compiletest:: default_config ( ) ;
40
+ let build_dir = TempDir :: new ( "miri-tests" ) . unwrap ( ) ;
41
+ let mut config = compiletest:: Config :: default ( ) ;
39
42
config. mode = "compile-fail" . parse ( ) . expect ( "Invalid mode" ) ;
43
+ config. build_base = build_dir. path ( ) . to_owned ( ) ;
40
44
config. rustc_path = miri_path ( ) ;
41
45
let mut flags = Vec :: new ( ) ;
42
46
if rustc_test_suite ( ) . is_some ( ) {
@@ -66,8 +70,10 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
66
70
67
71
fn run_pass ( path : & str ) {
68
72
eprintln ! ( "## Running run-pass tests in {} against rustc" , path) ;
69
- let mut config = compiletest:: default_config ( ) ;
73
+ let build_dir = TempDir :: new ( "miri-tests" ) . unwrap ( ) ;
74
+ let mut config = compiletest:: Config :: default ( ) ;
70
75
config. mode = "run-pass" . parse ( ) . expect ( "Invalid mode" ) ;
76
+ config. build_base = build_dir. path ( ) . to_owned ( ) ;
71
77
config. src_base = PathBuf :: from ( path) ;
72
78
if let Some ( rustc_path) = rustc_test_suite ( ) {
73
79
config. rustc_path = rustc_path;
@@ -89,8 +95,10 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
89
95
target,
90
96
opt_str
91
97
) ;
92
- let mut config = compiletest:: default_config ( ) ;
98
+ let build_dir = TempDir :: new ( "miri-tests" ) . unwrap ( ) ;
99
+ let mut config = compiletest:: Config :: default ( ) ;
93
100
config. mode = "mir-opt" . parse ( ) . expect ( "Invalid mode" ) ;
101
+ config. build_base = build_dir. path ( ) . to_owned ( ) ;
94
102
config. src_base = PathBuf :: from ( path) ;
95
103
config. target = target. to_owned ( ) ;
96
104
config. host = host. to_owned ( ) ;
0 commit comments