@@ -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
@@ -1330,15 +1322,7 @@ impl Step for CrateRunMakeSupport {
1330
1322
& [ ] ,
1331
1323
) ;
1332
1324
cargo. allow_features ( "test" ) ;
1333
- run_cargo_test (
1334
- cargo,
1335
- & [ ] ,
1336
- & [ ] ,
1337
- "run-make-support" ,
1338
- "run-make-support self test" ,
1339
- host,
1340
- builder,
1341
- ) ;
1325
+ run_cargo_test ( cargo, & [ ] , & [ ] , "run-make-support self test" , host, builder) ;
1342
1326
}
1343
1327
}
1344
1328
@@ -1375,7 +1359,7 @@ impl Step for CrateBuildHelper {
1375
1359
& [ ] ,
1376
1360
) ;
1377
1361
cargo. allow_features ( "test" ) ;
1378
- run_cargo_test ( cargo, & [ ] , & [ ] , "build_helper" , "build_helper self test", host, builder) ;
1362
+ run_cargo_test ( cargo, & [ ] , & [ ] , "build_helper self test" , host, builder) ;
1379
1363
}
1380
1364
}
1381
1365
@@ -2585,13 +2569,12 @@ fn run_cargo_test<'a>(
2585
2569
cargo : builder:: Cargo ,
2586
2570
libtest_args : & [ & str ] ,
2587
2571
crates : & [ String ] ,
2588
- primary_crate : & str ,
2589
2572
description : impl Into < Option < & ' a str > > ,
2590
2573
target : TargetSelection ,
2591
2574
builder : & Builder < ' _ > ,
2592
2575
) -> bool {
2593
2576
let compiler = cargo. compiler ( ) ;
2594
- let mut cargo = prepare_cargo_test ( cargo, libtest_args, crates, primary_crate , target, builder) ;
2577
+ let mut cargo = prepare_cargo_test ( cargo, libtest_args, crates, target, builder) ;
2595
2578
let _time = helpers:: timeit ( builder) ;
2596
2579
let _group = description. into ( ) . and_then ( |what| {
2597
2580
builder. msg_sysroot_tool ( Kind :: Test , compiler. stage , what, compiler. host , target)
@@ -2615,7 +2598,6 @@ fn prepare_cargo_test(
2615
2598
cargo : builder:: Cargo ,
2616
2599
libtest_args : & [ & str ] ,
2617
2600
crates : & [ String ] ,
2618
- primary_crate : & str ,
2619
2601
target : TargetSelection ,
2620
2602
builder : & Builder < ' _ > ,
2621
2603
) -> BootstrapCommand {
@@ -2645,13 +2627,6 @@ fn prepare_cargo_test(
2645
2627
cargo. arg ( "--doc" ) ;
2646
2628
}
2647
2629
DocTests :: No => {
2648
- let krate = & builder
2649
- . crates
2650
- . get ( primary_crate)
2651
- . unwrap_or_else ( || panic ! ( "missing crate {primary_crate}" ) ) ;
2652
- if krate. has_lib {
2653
- cargo. arg ( "--lib" ) ;
2654
- }
2655
2630
cargo. args ( [ "--bins" , "--examples" , "--tests" , "--benches" ] ) ;
2656
2631
}
2657
2632
DocTests :: Yes => { }
@@ -2826,15 +2801,15 @@ impl Step for Crate {
2826
2801
_ => panic ! ( "can only test libraries" ) ,
2827
2802
} ;
2828
2803
2829
- run_cargo_test (
2830
- cargo ,
2831
- & [ ] ,
2832
- & self . crates ,
2833
- & self . crates [ 0 ] ,
2834
- & * crate_description ( & self . crates ) ,
2835
- target ,
2836
- builder ,
2837
- ) ;
2804
+ let mut crates = self . crates . clone ( ) ;
2805
+ // The core crate can't directly be tested. We could silently
2806
+ // ignore it, but adding it's own test crate is less confusing
2807
+ // for users. We still keep core itself for doctests.
2808
+ if crates . iter ( ) . any ( |crate_| crate_ == "core" ) {
2809
+ crates . push ( "coretests" . to_owned ( ) ) ;
2810
+ }
2811
+
2812
+ run_cargo_test ( cargo , & [ ] , & crates , & * crate_description ( & self . crates ) , target , builder ) ;
2838
2813
}
2839
2814
}
2840
2815
@@ -2927,15 +2902,7 @@ impl Step for CrateRustdoc {
2927
2902
dylib_path. insert ( 0 , PathBuf :: from ( & * libdir) ) ;
2928
2903
cargo. env ( dylib_path_var ( ) , env:: join_paths ( & dylib_path) . unwrap ( ) ) ;
2929
2904
2930
- run_cargo_test (
2931
- cargo,
2932
- & [ ] ,
2933
- & [ "rustdoc:0.0.0" . to_string ( ) ] ,
2934
- "rustdoc" ,
2935
- "rustdoc" ,
2936
- target,
2937
- builder,
2938
- ) ;
2905
+ run_cargo_test ( cargo, & [ ] , & [ "rustdoc:0.0.0" . to_string ( ) ] , "rustdoc" , target, builder) ;
2939
2906
}
2940
2907
}
2941
2908
@@ -2992,7 +2959,6 @@ impl Step for CrateRustdocJsonTypes {
2992
2959
libtest_args,
2993
2960
& [ "rustdoc-json-types" . to_string ( ) ] ,
2994
2961
"rustdoc-json-types" ,
2995
- "rustdoc-json-types" ,
2996
2962
target,
2997
2963
builder,
2998
2964
) ;
@@ -3172,7 +3138,7 @@ impl Step for Bootstrap {
3172
3138
3173
3139
// bootstrap tests are racy on directory creation so just run them one at a time.
3174
3140
// Since there's not many this shouldn't be a problem.
3175
- run_cargo_test ( cargo, & [ "--test-threads=1" ] , & [ ] , "bootstrap" , None , host, builder) ;
3141
+ run_cargo_test ( cargo, & [ "--test-threads=1" ] , & [ ] , None , host, builder) ;
3176
3142
}
3177
3143
3178
3144
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
@@ -3297,7 +3263,7 @@ impl Step for RustInstaller {
3297
3263
bootstrap_host,
3298
3264
bootstrap_host,
3299
3265
) ;
3300
- run_cargo_test ( cargo, & [ ] , & [ ] , "installer" , None , bootstrap_host, builder) ;
3266
+ run_cargo_test ( cargo, & [ ] , & [ ] , None , bootstrap_host, builder) ;
3301
3267
3302
3268
// We currently don't support running the test.sh script outside linux(?) environments.
3303
3269
// Eventually this should likely migrate to #[test]s in rust-installer proper rather than a
@@ -3688,7 +3654,7 @@ impl Step for TestFloatParse {
3688
3654
& [ ] ,
3689
3655
) ;
3690
3656
3691
- run_cargo_test ( cargo_test, & [ ] , & [ ] , crate_name, crate_name , bootstrap_host, builder) ;
3657
+ run_cargo_test ( cargo_test, & [ ] , & [ ] , crate_name, bootstrap_host, builder) ;
3692
3658
3693
3659
// Run the actual parse tests.
3694
3660
let mut cargo_run = tool:: prepare_tool_cargo (
0 commit comments