@@ -25,15 +25,14 @@ use std::io::Read;
2525
2626use build_helper:: { self , output} ;
2727
28- use { Build , Mode } ;
29- use dist;
30- use util:: { self , dylib_path, dylib_path_var} ;
31-
28+ use builder:: { Kind , RunConfig , ShouldRun , Builder , Compiler , Step } ;
29+ use cache:: { INTERNER , Interned } ;
3230use compile;
31+ use dist;
3332use native;
34- use builder:: { Kind , RunConfig , ShouldRun , Builder , Compiler , Step } ;
3533use tool:: { self , Tool } ;
36- use cache:: { INTERNER , Interned } ;
34+ use util:: { self , dylib_path, dylib_path_var} ;
35+ use { Build , Mode } ;
3736
3837const ADB_TEST_DIR : & str = "/data/tmp/work" ;
3938
@@ -963,16 +962,31 @@ impl Step for Crate {
963962
964963 builder. ensure ( compile:: Test { compiler, target } ) ;
965964 builder. ensure ( RemoteCopyLibs { compiler, target } ) ;
966- let ( name, path, features, root) = match mode {
965+
966+ // If we're not doing a full bootstrap but we're testing a stage2 version of
967+ // libstd, then what we're actually testing is the libstd produced in
968+ // stage1. Reflect that here by updating the compiler that we're working
969+ // with automatically.
970+ let compiler = if build. force_use_stage1 ( compiler, target) {
971+ builder. compiler ( 1 , compiler. host )
972+ } else {
973+ compiler. clone ( )
974+ } ;
975+
976+ let mut cargo = builder. cargo ( compiler, mode, target, test_kind. subcommand ( ) ) ;
977+ let ( name, root) = match mode {
967978 Mode :: Libstd => {
968- ( "libstd" , "src/libstd" , build. std_features ( ) , "std" )
979+ compile:: std_cargo ( build, & compiler, target, & mut cargo) ;
980+ ( "libstd" , "std" )
969981 }
970982 Mode :: Libtest => {
971- ( "libtest" , "src/libtest" , String :: new ( ) , "test" )
983+ compile:: test_cargo ( build, & compiler, target, & mut cargo) ;
984+ ( "libtest" , "test" )
972985 }
973986 Mode :: Librustc => {
974987 builder. ensure ( compile:: Rustc { compiler, target } ) ;
975- ( "librustc" , "src/rustc" , build. rustc_features ( ) , "rustc-main" )
988+ compile:: rustc_cargo ( build, & compiler, target, & mut cargo) ;
989+ ( "librustc" , "rustc-main" )
976990 }
977991 _ => panic ! ( "can only test libraries" ) ,
978992 } ;
@@ -983,25 +997,11 @@ impl Step for Crate {
983997 println ! ( "{} {} stage{} ({} -> {})" , test_kind, name, compiler. stage,
984998 & compiler. host, target) ;
985999
986- // If we're not doing a full bootstrap but we're testing a stage2 version of
987- // libstd, then what we're actually testing is the libstd produced in
988- // stage1. Reflect that here by updating the compiler that we're working
989- // with automatically.
990- let compiler = if build. force_use_stage1 ( compiler, target) {
991- builder. compiler ( 1 , compiler. host )
992- } else {
993- compiler. clone ( )
994- } ;
995-
9961000 // Build up the base `cargo test` command.
9971001 //
9981002 // Pass in some standard flags then iterate over the graph we've discovered
9991003 // in `cargo metadata` with the maps above and figure out what `-p`
10001004 // arguments need to get passed.
1001- let mut cargo = builder. cargo ( compiler, mode, target, test_kind. subcommand ( ) ) ;
1002- cargo. arg ( "--manifest-path" )
1003- . arg ( build. src . join ( path) . join ( "Cargo.toml" ) )
1004- . arg ( "--features" ) . arg ( features) ;
10051005 if test_kind. subcommand ( ) == "test" && !build. fail_fast {
10061006 cargo. arg ( "--no-fail-fast" ) ;
10071007 }
@@ -1014,16 +1014,18 @@ impl Step for Crate {
10141014 let mut visited = HashSet :: new ( ) ;
10151015 let mut next = vec ! [ root] ;
10161016 while let Some ( name) = next. pop ( ) {
1017- // Right now jemalloc is our only target-specific crate in the
1018- // sense that it's not present on all platforms. Custom skip it
1019- // here for now, but if we add more this probably wants to get
1020- // more generalized.
1017+ // Right now jemalloc and the sanitizer crates are
1018+ // target-specific crate in the sense that it's not present
1019+ // on all platforms. Custom skip it here for now, but if we
1020+ // add more this probably wants to get more generalized.
10211021 //
1022- // Also skip `build_helper` as it's not compiled normally for
1023- // target during the bootstrap and it's just meant to be a
1024- // helper crate, not tested. If it leaks through then it ends up
1025- // messing with various mtime calculations and such.
1026- if !name. contains ( "jemalloc" ) && * name != * "build_helper" {
1022+ // Also skip `build_helper` as it's not compiled normally
1023+ // for target during the bootstrap and it's just meant to be
1024+ // a helper crate, not tested. If it leaks through then it
1025+ // ends up messing with various mtime calculations and such.
1026+ if !name. contains ( "jemalloc" ) &&
1027+ * name != * "build_helper" &&
1028+ !( name. starts_with ( "rustc_" ) && name. ends_with ( "san" ) ) {
10271029 cargo. arg ( "-p" ) . arg ( & format ! ( "{}:0.0.0" , name) ) ;
10281030 }
10291031 for dep in build. crates [ & name] . deps . iter ( ) {
0 commit comments