@@ -78,14 +78,6 @@ pub fn linkcheck(build: &Build, host: &str) {
78
78
pub fn cargotest ( build : & Build , stage : u32 , host : & str ) {
79
79
let ref compiler = Compiler :: new ( stage, host) ;
80
80
81
- // Configure PATH to find the right rustc. NB. we have to use PATH
82
- // and not RUSTC because the Cargo test suite has tests that will
83
- // fail if rustc is not spelled `rustc`.
84
- let path = build. sysroot ( compiler) . join ( "bin" ) ;
85
- let old_path = :: std:: env:: var ( "PATH" ) . expect ( "" ) ;
86
- let sep = if cfg ! ( windows) { ";" } else { ":" } ;
87
- let ref newpath = format ! ( "{}{}{}" , path. display( ) , sep, old_path) ;
88
-
89
81
// Note that this is a short, cryptic, and not scoped directory name. This
90
82
// is currently to minimize the length of path on Windows where we otherwise
91
83
// quickly run into path name limit constraints.
@@ -95,9 +87,35 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
95
87
let _time = util:: timeit ( ) ;
96
88
let mut cmd = Command :: new ( build. tool ( & Compiler :: new ( 0 , host) , "cargotest" ) ) ;
97
89
build. prepare_tool_cmd ( compiler, & mut cmd) ;
98
- build. run ( cmd. env ( "PATH" , newpath)
99
- . arg ( & build. cargo )
100
- . arg ( & out_dir) ) ;
90
+ build. run ( cmd. arg ( & build. cargo )
91
+ . arg ( & out_dir)
92
+ . env ( "RUSTC" , build. compiler_path ( compiler) )
93
+ . env ( "RUSTDOC" , build. rustdoc ( compiler) ) )
94
+ }
95
+
96
+ /// Runs `cargo test` for `cargo` packaged with Rust.
97
+ pub fn cargo ( build : & Build , stage : u32 , host : & str ) {
98
+ let ref compiler = Compiler :: new ( stage, host) ;
99
+
100
+ // Configure PATH to find the right rustc. NB. we have to use PATH
101
+ // and not RUSTC because the Cargo test suite has tests that will
102
+ // fail if rustc is not spelled `rustc`.
103
+ let path = build. sysroot ( compiler) . join ( "bin" ) ;
104
+ let old_path = :: std:: env:: var ( "PATH" ) . expect ( "" ) ;
105
+ let sep = if cfg ! ( windows) { ";" } else { ":" } ;
106
+ let ref newpath = format ! ( "{}{}{}" , path. display( ) , sep, old_path) ;
107
+
108
+ let mut cargo = build. cargo ( compiler, Mode :: Tool , host, "test" ) ;
109
+ cargo. arg ( "--manifest-path" ) . arg ( build. src . join ( "cargo/Cargo.toml" ) ) ;
110
+
111
+ // Don't build tests dynamically, just a pain to work with
112
+ cargo. env ( "RUSTC_NO_PREFER_DYNAMIC" , "1" ) ;
113
+
114
+ // Don't run cross-compile tests, we may not have cross-compiled libstd libs
115
+ // available.
116
+ cargo. env ( "CFG_DISABLE_CROSS_TESTS" , "1" ) ;
117
+
118
+ build. run ( cargo. env ( "PATH" , newpath) ) ;
101
119
}
102
120
103
121
/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.
0 commit comments