@@ -9,23 +9,11 @@ use colored::*;
9
9
use compiletest_rs as compiletest;
10
10
11
11
fn miri_path ( ) -> PathBuf {
12
- if rustc_test_suite ( ) . is_some ( ) {
13
- PathBuf :: from ( option_env ! ( "MIRI_PATH" ) . unwrap ( ) )
14
- } else {
15
- PathBuf :: from ( env ! ( "CARGO_BIN_EXE_miri" ) )
16
- }
17
- }
18
-
19
- fn rustc_test_suite ( ) -> Option < PathBuf > {
20
- option_env ! ( "RUSTC_TEST_SUITE" ) . map ( PathBuf :: from)
21
- }
22
-
23
- fn rustc_lib_path ( ) -> PathBuf {
24
- option_env ! ( "RUSTC_LIB_PATH" ) . unwrap ( ) . into ( )
12
+ PathBuf :: from ( option_env ! ( "MIRI_PATH" ) . unwrap_or ( env ! ( "CARGO_BIN_EXE_miri" ) ) )
25
13
}
26
14
27
15
fn run_tests ( mode : & str , path : & str , target : & str ) {
28
- let in_rustc_test_suite = rustc_test_suite ( ) . is_some ( ) ;
16
+ let in_rustc_test_suite = option_env ! ( "RUSTC_STAGE" ) . is_some ( ) ;
29
17
// Add some flags we always want.
30
18
let mut flags = Vec :: new ( ) ;
31
19
flags. push ( "--edition 2018" . to_owned ( ) ) ;
@@ -50,9 +38,9 @@ fn run_tests(mode: &str, path: &str, target: &str) {
50
38
let mut config = compiletest:: Config :: default ( ) . tempdir ( ) ;
51
39
config. mode = mode. parse ( ) . expect ( "Invalid mode" ) ;
52
40
config. rustc_path = miri_path ( ) ;
53
- if in_rustc_test_suite {
54
- config. run_lib_path = rustc_lib_path ( ) ;
55
- config. compile_lib_path = rustc_lib_path ( ) ;
41
+ if let Some ( lib_path ) = option_env ! ( "RUSTC_LIB_PATH" ) {
42
+ config. run_lib_path = PathBuf :: from ( lib_path ) ;
43
+ config. compile_lib_path = PathBuf :: from ( lib_path ) ;
56
44
}
57
45
config. filter = env:: args ( ) . nth ( 1 ) ;
58
46
config. host = get_host ( ) ;
@@ -91,15 +79,9 @@ fn miri_pass(path: &str, target: &str) {
91
79
}
92
80
93
81
fn get_host ( ) -> String {
94
- let rustc = rustc_test_suite ( ) . unwrap_or ( PathBuf :: from ( "rustc" ) ) ;
95
- let rustc_version = std:: process:: Command :: new ( rustc)
96
- . arg ( "-vV" )
97
- . output ( )
98
- . expect ( "rustc not found for -vV" )
99
- . stdout ;
100
- let rustc_version = std:: str:: from_utf8 ( & rustc_version) . expect ( "rustc -vV is not utf8" ) ;
101
- let version_meta = rustc_version:: version_meta_for ( & rustc_version)
102
- . expect ( "failed to parse rustc version info" ) ;
82
+ let version_meta = rustc_version:: VersionMeta :: for_command (
83
+ std:: process:: Command :: new ( miri_path ( ) )
84
+ ) . expect ( "failed to parse rustc version info" ) ;
103
85
version_meta. host
104
86
}
105
87
0 commit comments