@@ -563,10 +563,10 @@ impl Step for Miri {
563563 cargo. add_rustc_lib_path ( builder, compiler) ;
564564
565565 // miri tests need to know about the stage sysroot
566- cargo. env ( "MIRI_SYSROOT" , miri_sysroot) ;
566+ cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
567567 cargo. env ( "MIRI_HOST_SYSROOT" , sysroot) ;
568568 cargo. env ( "RUSTC_LIB_PATH" , builder. rustc_libdir ( compiler) ) ;
569- cargo. env ( "MIRI" , miri) ;
569+ cargo. env ( "MIRI" , & miri) ;
570570 // propagate --bless
571571 if builder. config . cmd . bless ( ) {
572572 cargo. env ( "MIRI_BLESS" , "Gesundheit" ) ;
@@ -579,6 +579,40 @@ impl Step for Miri {
579579
580580 let mut cargo = Command :: from ( cargo) ;
581581 builder. run ( & mut cargo) ;
582+
583+ // # Run `cargo miri test`.
584+ // This is just a smoke test (Miri's own CI invokes this in a bunch of different ways and ensures
585+ // that we get the desired output), but that is sufficient to make sure that the libtest harness
586+ // itself executes properly under Miri.
587+ let mut cargo = tool:: prepare_tool_cargo (
588+ builder,
589+ compiler,
590+ Mode :: ToolRustc ,
591+ host,
592+ "run" ,
593+ "src/tools/miri/cargo-miri" ,
594+ SourceType :: Submodule ,
595+ & [ ] ,
596+ ) ;
597+ cargo. add_rustc_lib_path ( builder, compiler) ;
598+ cargo. arg ( "--" ) . arg ( "miri" ) . arg ( "test" ) ;
599+ cargo
600+ . arg ( "--manifest-path" )
601+ . arg ( builder. src . join ( "src/tools/miri/test-cargo-miri/Cargo.toml" ) ) ;
602+ cargo. arg ( "--target" ) . arg ( target. rustc_target_arg ( ) ) ;
603+ cargo. arg ( "--tests" ) ; // don't run doctests, they are too confused by the staging
604+ cargo. arg ( "--" ) . args ( builder. config . cmd . test_args ( ) ) ;
605+
606+ // Tell `cargo miri` where to find things.
607+ cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
608+ cargo. env ( "MIRI_HOST_SYSROOT" , sysroot) ;
609+ cargo. env ( "RUSTC_LIB_PATH" , builder. rustc_libdir ( compiler) ) ;
610+ cargo. env ( "MIRI" , & miri) ;
611+ // Debug things.
612+ cargo. env ( "RUST_BACKTRACE" , "1" ) ;
613+
614+ let mut cargo = Command :: from ( cargo) ;
615+ builder. run ( & mut cargo) ;
582616 }
583617}
584618
0 commit comments