@@ -369,6 +369,69 @@ impl Step for RustAnalyzer {
369
369
}
370
370
}
371
371
372
+ /// Compiletest is implicitly "checked" when it gets built in order to run tests,
373
+ /// so this is mainly for people working on compiletest to run locally.
374
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
375
+ pub struct Compiletest {
376
+ pub target : TargetSelection ,
377
+ }
378
+
379
+ impl Step for Compiletest {
380
+ type Output = ( ) ;
381
+ const ONLY_HOSTS : bool = true ;
382
+ const DEFAULT : bool = false ;
383
+
384
+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
385
+ run. path ( "src/tools/compiletest" )
386
+ }
387
+
388
+ fn make_run ( run : RunConfig < ' _ > ) {
389
+ run. builder . ensure ( Compiletest { target : run. target } ) ;
390
+ }
391
+
392
+ fn run ( self , builder : & Builder < ' _ > ) {
393
+ let mode = if builder. config . compiletest_use_stage0_libtest {
394
+ Mode :: ToolBootstrap
395
+ } else {
396
+ Mode :: ToolStd
397
+ } ;
398
+
399
+ let compiler = builder. compiler (
400
+ if mode == Mode :: ToolBootstrap { 0 } else { builder. top_stage } ,
401
+ builder. config . build ,
402
+ ) ;
403
+
404
+ if mode != Mode :: ToolBootstrap {
405
+ builder. ensure ( Rustc :: new ( self . target , builder) ) ;
406
+ }
407
+
408
+ let mut cargo = prepare_tool_cargo (
409
+ builder,
410
+ compiler,
411
+ mode,
412
+ self . target ,
413
+ builder. kind ,
414
+ "src/tools/compiletest" ,
415
+ SourceType :: InTree ,
416
+ & [ ] ,
417
+ ) ;
418
+
419
+ cargo. allow_features ( "test" ) ;
420
+
421
+ // For ./x.py clippy, don't run with --all-targets because
422
+ // linting tests and benchmarks can produce very noisy results
423
+ if builder. kind != Kind :: Clippy {
424
+ cargo. arg ( "--all-targets" ) ;
425
+ }
426
+
427
+ let stamp = BuildStamp :: new ( & builder. cargo_out ( compiler, mode, self . target ) )
428
+ . with_prefix ( "compiletest-check" ) ;
429
+
430
+ let _guard = builder. msg_check ( "compiletest artifacts" , self . target ) ;
431
+ run_cargo ( builder, cargo, builder. config . free_args . clone ( ) , & stamp, vec ! [ ] , true , false ) ;
432
+ }
433
+ }
434
+
372
435
macro_rules! tool_check_step {
373
436
(
374
437
$name: ident {
@@ -464,7 +527,3 @@ tool_check_step!(Bootstrap { path: "src/bootstrap", default: false });
464
527
// `run-make-support` will be built as part of suitable run-make compiletest test steps, but support
465
528
// check to make it easier to work on.
466
529
tool_check_step ! ( RunMakeSupport { path: "src/tools/run-make-support" , default : false } ) ;
467
-
468
- // Compiletest is implicitly "checked" when it gets built in order to run tests,
469
- // so this is mainly for people working on compiletest to run locally.
470
- tool_check_step ! ( Compiletest { path: "src/tools/compiletest" , default : false } ) ;
0 commit comments