@@ -31,7 +31,10 @@ fn get_runners() -> Runners {
31
31
"--test-failing-rustc" ,
32
32
( "Run failing rustc tests" , test_failing_rustc) ,
33
33
) ;
34
- runners. insert ( "--projects" , ( "Run the tests of popular crates" , test_projects) ) ;
34
+ runners. insert (
35
+ "--projects" ,
36
+ ( "Run the tests of popular crates" , test_projects) ,
37
+ ) ;
35
38
runners. insert ( "--test-libcore" , ( "Run libcore tests" , test_libcore) ) ;
36
39
runners. insert ( "--clean" , ( "Empty cargo target directory" , clean) ) ;
37
40
runners. insert ( "--build-sysroot" , ( "Build sysroot" , build_sysroot) ) ;
@@ -494,16 +497,32 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<(), String> {
494
497
let rust_dir = Some ( Path :: new ( "rust" ) ) ;
495
498
// If the repository was already cloned, command will fail, so doesn't matter.
496
499
let _ = run_command_with_output_and_env (
497
- & [ & "git" , & "clone" , & "https://github.com/rust-lang/rust.git" ] ,
500
+ & [
501
+ & "git" ,
502
+ & "clone" ,
503
+ & "https://github.com/rust-lang/rust.git" ,
504
+ & "--depth" ,
505
+ & "1" ,
506
+ ] ,
498
507
None ,
499
508
Some ( env) ,
500
509
) ;
501
510
run_command ( & [ & "git" , & "checkout" , & "--" , & "tests/" ] , rust_dir) ?;
502
- run_command_with_output_and_env ( & [ & "git" , & "fetch" ] , rust_dir, Some ( env) ) ?;
503
511
let rustc_commit = match rustc_version_info ( env. get ( "RUSTC" ) . map ( |s| s. as_str ( ) ) ) ?. commit_hash {
504
512
Some ( commit_hash) => commit_hash,
505
513
None => return Err ( "Couldn't retrieve rustc commit hash" . to_string ( ) ) ,
506
514
} ;
515
+ run_command_with_output_and_env (
516
+ & [
517
+ & "git" ,
518
+ & "fetch" ,
519
+ & "https://github.com/rust-lang/rust.git" ,
520
+ & rustc_commit. as_str ( ) ,
521
+ & "--depth=1" ,
522
+ ] ,
523
+ rust_dir,
524
+ Some ( env) ,
525
+ ) ?;
507
526
if rustc_commit != "unknown" {
508
527
run_command_with_output_and_env (
509
528
& [ & "git" , & "checkout" , & rustc_commit] ,
@@ -703,7 +722,7 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
703
722
//"https://github.com/rust-lang/cargo", // TODO: very slow, only run on master?
704
723
] ;
705
724
706
- let run_tests = |projects_path, iter : & mut dyn Iterator < Item = & & str > | -> Result < ( ) , String > {
725
+ let run_tests = |projects_path, iter : & mut dyn Iterator < Item = & & str > | -> Result < ( ) , String > {
707
726
for project in iter {
708
727
let clone_result = git_clone ( project, Some ( projects_path) , true ) ?;
709
728
let repo_path = Path :: new ( & clone_result. repo_dir ) ;
@@ -727,8 +746,7 @@ fn test_projects(env: &Env, args: &TestArg) -> Result<(), String> {
727
746
let start = current_part * count;
728
747
// We remove the projects we don't want to test.
729
748
run_tests ( projects_path, & mut projects. iter ( ) . skip ( start) . take ( count) ) ?;
730
- }
731
- else {
749
+ } else {
732
750
run_tests ( projects_path, & mut projects. iter ( ) ) ?;
733
751
}
734
752
0 commit comments