1
1
use super :: build_sysroot;
2
2
use super :: config;
3
3
use super :: path:: { Dirs , RelPath } ;
4
- use super :: prepare:: GitRepo ;
4
+ use super :: prepare:: { apply_patches, GitRepo } ;
5
+ use super :: rustc_info:: get_default_sysroot;
5
6
use super :: utils:: { spawn_and_wait, spawn_and_wait_with_input, CargoProject , Compiler } ;
6
7
use super :: { CodegenBackend , SysrootKind } ;
7
8
use std:: env;
8
9
use std:: ffi:: OsStr ;
9
10
use std:: fs;
11
+ use std:: path:: PathBuf ;
10
12
use std:: process:: Command ;
11
13
12
14
static BUILD_EXAMPLE_OUT_DIR : RelPath = RelPath :: BUILD . join ( "example" ) ;
@@ -125,9 +127,9 @@ pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
125
127
pub ( crate ) static PORTABLE_SIMD : CargoProject =
126
128
CargoProject :: new ( & PORTABLE_SIMD_REPO . source_dir ( ) , "portable_simd_target" ) ;
127
129
128
- pub ( crate ) static LIBCORE_TESTS_SRC : RelPath = RelPath :: BUILD . join ( "coretests_src" ) ;
130
+ static LIBCORE_TESTS_SRC : RelPath = RelPath :: BUILD . join ( "coretests_src" ) ;
129
131
130
- pub ( crate ) static LIBCORE_TESTS : CargoProject = CargoProject :: new ( & LIBCORE_TESTS_SRC , "core_tests" ) ;
132
+ static LIBCORE_TESTS : CargoProject = CargoProject :: new ( & LIBCORE_TESTS_SRC , "core_tests" ) ;
131
133
132
134
const EXTENDED_SYSROOT_SUITE : & [ TestCase ] = & [
133
135
TestCase :: custom ( "test.rust-random/rand" , & |runner| {
@@ -145,6 +147,13 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
145
147
}
146
148
} ) ,
147
149
TestCase :: custom ( "test.libcore" , & |runner| {
150
+ apply_patches (
151
+ & runner. dirs ,
152
+ "coretests" ,
153
+ & runner. stdlib_source . join ( "library/core/tests" ) ,
154
+ & LIBCORE_TESTS_SRC . to_path ( & runner. dirs ) ,
155
+ ) ;
156
+
148
157
LIBCORE_TESTS . clean ( & runner. dirs ) ;
149
158
150
159
if runner. is_native {
@@ -231,6 +240,10 @@ pub(crate) fn run_tests(
231
240
rustup_toolchain_name : Option < & str > ,
232
241
target_triple : String ,
233
242
) {
243
+ let stdlib_source =
244
+ get_default_sysroot ( & bootstrap_host_compiler. rustc ) . join ( "lib/rustlib/src/rust" ) ;
245
+ assert ! ( stdlib_source. exists( ) ) ;
246
+
234
247
if config:: get_bool ( "testsuite.no_sysroot" ) {
235
248
let target_compiler = build_sysroot:: build_sysroot (
236
249
dirs,
@@ -247,6 +260,7 @@ pub(crate) fn run_tests(
247
260
target_compiler,
248
261
use_unstable_features,
249
262
bootstrap_host_compiler. triple == target_triple,
263
+ stdlib_source. clone ( ) ,
250
264
) ;
251
265
252
266
BUILD_EXAMPLE_OUT_DIR . ensure_fresh ( dirs) ;
@@ -277,6 +291,7 @@ pub(crate) fn run_tests(
277
291
target_compiler,
278
292
use_unstable_features,
279
293
bootstrap_host_compiler. triple == target_triple,
294
+ stdlib_source,
280
295
) ;
281
296
282
297
if run_base_sysroot {
@@ -299,6 +314,7 @@ struct TestRunner {
299
314
use_unstable_features : bool ,
300
315
dirs : Dirs ,
301
316
target_compiler : Compiler ,
317
+ stdlib_source : PathBuf ,
302
318
}
303
319
304
320
impl TestRunner {
@@ -307,6 +323,7 @@ impl TestRunner {
307
323
mut target_compiler : Compiler ,
308
324
use_unstable_features : bool ,
309
325
is_native : bool ,
326
+ stdlib_source : PathBuf ,
310
327
) -> Self {
311
328
if let Ok ( rustflags) = env:: var ( "RUSTFLAGS" ) {
312
329
target_compiler. rustflags . push ( ' ' ) ;
@@ -327,7 +344,14 @@ impl TestRunner {
327
344
&& target_compiler. triple . contains ( "x86_64" )
328
345
&& !target_compiler. triple . contains ( "windows" ) ;
329
346
330
- Self { is_native, jit_supported, use_unstable_features, dirs, target_compiler }
347
+ Self {
348
+ is_native,
349
+ jit_supported,
350
+ use_unstable_features,
351
+ dirs,
352
+ target_compiler,
353
+ stdlib_source,
354
+ }
331
355
}
332
356
333
357
fn run_testsuite ( & self , tests : & [ TestCase ] ) {
0 commit comments