@@ -90,7 +90,7 @@ impl Step for CrateBootstrap {
90
90
) ;
91
91
92
92
let crate_name = path. rsplit_once ( '/' ) . unwrap ( ) . 1 ;
93
- run_cargo_test ( cargo, & [ ] , & [ ] , crate_name, crate_name , bootstrap_host, builder) ;
93
+ run_cargo_test ( cargo, & [ ] , & [ ] , crate_name, bootstrap_host, builder) ;
94
94
}
95
95
}
96
96
@@ -140,15 +140,7 @@ You can skip linkcheck with --skip src/tools/linkchecker"
140
140
SourceType :: InTree ,
141
141
& [ ] ,
142
142
) ;
143
- run_cargo_test (
144
- cargo,
145
- & [ ] ,
146
- & [ ] ,
147
- "linkchecker" ,
148
- "linkchecker self tests" ,
149
- bootstrap_host,
150
- builder,
151
- ) ;
143
+ run_cargo_test ( cargo, & [ ] , & [ ] , "linkchecker self tests" , bootstrap_host, builder) ;
152
144
153
145
if builder. doc_tests == DocTests :: No {
154
146
return ;
@@ -337,7 +329,7 @@ impl Step for Cargo {
337
329
) ;
338
330
339
331
// NOTE: can't use `run_cargo_test` because we need to overwrite `PATH`
340
- let mut cargo = prepare_cargo_test ( cargo, & [ ] , & [ ] , "cargo" , self . host , builder) ;
332
+ let mut cargo = prepare_cargo_test ( cargo, & [ ] , & [ ] , self . host , builder) ;
341
333
342
334
// Don't run cross-compile tests, we may not have cross-compiled libstd libs
343
335
// available.
@@ -423,7 +415,7 @@ impl Step for RustAnalyzer {
423
415
cargo. env ( "SKIP_SLOW_TESTS" , "1" ) ;
424
416
425
417
cargo. add_rustc_lib_path ( builder) ;
426
- run_cargo_test ( cargo, & [ ] , & [ ] , "rust-analyzer" , "rust-analyzer" , host, builder) ;
418
+ run_cargo_test ( cargo, & [ ] , & [ ] , "rust-analyzer" , host, builder) ;
427
419
}
428
420
}
429
421
@@ -472,7 +464,7 @@ impl Step for Rustfmt {
472
464
473
465
cargo. add_rustc_lib_path ( builder) ;
474
466
475
- run_cargo_test ( cargo, & [ ] , & [ ] , "rustfmt" , "rustfmt" , host, builder) ;
467
+ run_cargo_test ( cargo, & [ ] , & [ ] , "rustfmt" , host, builder) ;
476
468
}
477
469
}
478
470
@@ -588,7 +580,7 @@ impl Step for Miri {
588
580
589
581
// We can NOT use `run_cargo_test` since Miri's integration tests do not use the usual test
590
582
// harness and therefore do not understand the flags added by `add_flags_and_try_run_test`.
591
- let mut cargo = prepare_cargo_test ( cargo, & [ ] , & [ ] , "miri" , host, builder) ;
583
+ let mut cargo = prepare_cargo_test ( cargo, & [ ] , & [ ] , host, builder) ;
592
584
593
585
// miri tests need to know about the stage sysroot
594
586
cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
@@ -736,7 +728,7 @@ impl Step for CompiletestTest {
736
728
& [ ] ,
737
729
) ;
738
730
cargo. allow_features ( "test" ) ;
739
- run_cargo_test ( cargo, & [ ] , & [ ] , "compiletest" , "compiletest self test", host, builder) ;
731
+ run_cargo_test ( cargo, & [ ] , & [ ] , "compiletest self test" , host, builder) ;
740
732
}
741
733
}
742
734
@@ -797,7 +789,7 @@ impl Step for Clippy {
797
789
cargo. env ( "HOST_LIBS" , host_libs) ;
798
790
799
791
cargo. add_rustc_lib_path ( builder) ;
800
- let cargo = prepare_cargo_test ( cargo, & [ ] , & [ ] , "clippy" , host, builder) ;
792
+ let cargo = prepare_cargo_test ( cargo, & [ ] , & [ ] , host, builder) ;
801
793
802
794
let _guard = builder. msg_sysroot_tool ( Kind :: Test , compiler. stage , "clippy" , host, host) ;
803
795
@@ -1277,15 +1269,7 @@ impl Step for CrateRunMakeSupport {
1277
1269
& [ ] ,
1278
1270
) ;
1279
1271
cargo. allow_features ( "test" ) ;
1280
- run_cargo_test (
1281
- cargo,
1282
- & [ ] ,
1283
- & [ ] ,
1284
- "run-make-support" ,
1285
- "run-make-support self test" ,
1286
- host,
1287
- builder,
1288
- ) ;
1272
+ run_cargo_test ( cargo, & [ ] , & [ ] , "run-make-support self test" , host, builder) ;
1289
1273
}
1290
1274
}
1291
1275
@@ -1322,7 +1306,7 @@ impl Step for CrateBuildHelper {
1322
1306
& [ ] ,
1323
1307
) ;
1324
1308
cargo. allow_features ( "test" ) ;
1325
- run_cargo_test ( cargo, & [ ] , & [ ] , "build_helper" , "build_helper self test", host, builder) ;
1309
+ run_cargo_test ( cargo, & [ ] , & [ ] , "build_helper self test" , host, builder) ;
1326
1310
}
1327
1311
}
1328
1312
@@ -2507,13 +2491,12 @@ fn run_cargo_test<'a>(
2507
2491
cargo : builder:: Cargo ,
2508
2492
libtest_args : & [ & str ] ,
2509
2493
crates : & [ String ] ,
2510
- primary_crate : & str ,
2511
2494
description : impl Into < Option < & ' a str > > ,
2512
2495
target : TargetSelection ,
2513
2496
builder : & Builder < ' _ > ,
2514
2497
) -> bool {
2515
2498
let compiler = cargo. compiler ( ) ;
2516
- let mut cargo = prepare_cargo_test ( cargo, libtest_args, crates, primary_crate , target, builder) ;
2499
+ let mut cargo = prepare_cargo_test ( cargo, libtest_args, crates, target, builder) ;
2517
2500
let _time = helpers:: timeit ( builder) ;
2518
2501
let _group = description. into ( ) . and_then ( |what| {
2519
2502
builder. msg_sysroot_tool ( Kind :: Test , compiler. stage , what, compiler. host , target)
@@ -2537,7 +2520,6 @@ fn prepare_cargo_test(
2537
2520
cargo : builder:: Cargo ,
2538
2521
libtest_args : & [ & str ] ,
2539
2522
crates : & [ String ] ,
2540
- primary_crate : & str ,
2541
2523
target : TargetSelection ,
2542
2524
builder : & Builder < ' _ > ,
2543
2525
) -> BootstrapCommand {
@@ -2567,13 +2549,6 @@ fn prepare_cargo_test(
2567
2549
cargo. arg ( "--doc" ) ;
2568
2550
}
2569
2551
DocTests :: No => {
2570
- let krate = & builder
2571
- . crates
2572
- . get ( primary_crate)
2573
- . unwrap_or_else ( || panic ! ( "missing crate {primary_crate}" ) ) ;
2574
- if krate. has_lib {
2575
- cargo. arg ( "--lib" ) ;
2576
- }
2577
2552
cargo. args ( [ "--bins" , "--examples" , "--tests" , "--benches" ] ) ;
2578
2553
}
2579
2554
DocTests :: Yes => { }
@@ -2748,15 +2723,15 @@ impl Step for Crate {
2748
2723
_ => panic ! ( "can only test libraries" ) ,
2749
2724
} ;
2750
2725
2751
- run_cargo_test (
2752
- cargo ,
2753
- & [ ] ,
2754
- & self . crates ,
2755
- & self . crates [ 0 ] ,
2756
- & * crate_description ( & self . crates ) ,
2757
- target ,
2758
- builder ,
2759
- ) ;
2726
+ let mut crates = self . crates . clone ( ) ;
2727
+ // The core crate can't directly be tested. We could silently
2728
+ // ignore it, but adding it's own test crate is less confusing
2729
+ // for users. We still keep core itself for doctests.
2730
+ if crates . iter ( ) . any ( |crate_| crate_ == "core" ) {
2731
+ crates . push ( "coretests" . to_owned ( ) ) ;
2732
+ }
2733
+
2734
+ run_cargo_test ( cargo , & [ ] , & crates , & * crate_description ( & self . crates ) , target , builder ) ;
2760
2735
}
2761
2736
}
2762
2737
@@ -2849,15 +2824,7 @@ impl Step for CrateRustdoc {
2849
2824
dylib_path. insert ( 0 , PathBuf :: from ( & * libdir) ) ;
2850
2825
cargo. env ( dylib_path_var ( ) , env:: join_paths ( & dylib_path) . unwrap ( ) ) ;
2851
2826
2852
- run_cargo_test (
2853
- cargo,
2854
- & [ ] ,
2855
- & [ "rustdoc:0.0.0" . to_string ( ) ] ,
2856
- "rustdoc" ,
2857
- "rustdoc" ,
2858
- target,
2859
- builder,
2860
- ) ;
2827
+ run_cargo_test ( cargo, & [ ] , & [ "rustdoc:0.0.0" . to_string ( ) ] , "rustdoc" , target, builder) ;
2861
2828
}
2862
2829
}
2863
2830
@@ -2914,7 +2881,6 @@ impl Step for CrateRustdocJsonTypes {
2914
2881
libtest_args,
2915
2882
& [ "rustdoc-json-types" . to_string ( ) ] ,
2916
2883
"rustdoc-json-types" ,
2917
- "rustdoc-json-types" ,
2918
2884
target,
2919
2885
builder,
2920
2886
) ;
@@ -3094,7 +3060,7 @@ impl Step for Bootstrap {
3094
3060
3095
3061
// bootstrap tests are racy on directory creation so just run them one at a time.
3096
3062
// Since there's not many this shouldn't be a problem.
3097
- run_cargo_test ( cargo, & [ "--test-threads=1" ] , & [ ] , "bootstrap" , None , host, builder) ;
3063
+ run_cargo_test ( cargo, & [ "--test-threads=1" ] , & [ ] , None , host, builder) ;
3098
3064
}
3099
3065
3100
3066
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
@@ -3219,7 +3185,7 @@ impl Step for RustInstaller {
3219
3185
bootstrap_host,
3220
3186
bootstrap_host,
3221
3187
) ;
3222
- run_cargo_test ( cargo, & [ ] , & [ ] , "installer" , None , bootstrap_host, builder) ;
3188
+ run_cargo_test ( cargo, & [ ] , & [ ] , None , bootstrap_host, builder) ;
3223
3189
3224
3190
// We currently don't support running the test.sh script outside linux(?) environments.
3225
3191
// Eventually this should likely migrate to #[test]s in rust-installer proper rather than a
@@ -3610,7 +3576,7 @@ impl Step for TestFloatParse {
3610
3576
& [ ] ,
3611
3577
) ;
3612
3578
3613
- run_cargo_test ( cargo_test, & [ ] , & [ ] , crate_name, crate_name , bootstrap_host, builder) ;
3579
+ run_cargo_test ( cargo_test, & [ ] , & [ ] , crate_name, bootstrap_host, builder) ;
3614
3580
3615
3581
// Run the actual parse tests.
3616
3582
let mut cargo_run = tool:: prepare_tool_cargo (
0 commit comments