@@ -28,6 +28,7 @@ extern crate serde_derive;
28
28
extern crate serde_json;
29
29
extern crate test;
30
30
extern crate rustfix;
31
+ extern crate walkdir;
31
32
32
33
use common:: CompareMode ;
33
34
use common:: { expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS } ;
@@ -43,6 +44,7 @@ use std::path::{Path, PathBuf};
43
44
use std:: process:: Command ;
44
45
use test:: ColorConfig ;
45
46
use util:: logv;
47
+ use walkdir:: WalkDir ;
46
48
47
49
use self :: header:: { EarlyProps , Ignore } ;
48
50
@@ -682,6 +684,15 @@ fn stamp(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> Path
682
684
output_base_dir ( config, testpaths, revision) . join ( "stamp" )
683
685
}
684
686
687
+ /// Return an iterator over timestamps of files in the directory at `path`.
688
+ fn collect_timestamps ( path : & PathBuf ) -> impl Iterator < Item =FileTime > {
689
+ WalkDir :: new ( path)
690
+ . into_iter ( )
691
+ . map ( |entry| entry. unwrap ( ) )
692
+ . filter ( |entry| entry. metadata ( ) . unwrap ( ) . is_file ( ) )
693
+ . map ( |entry| mtime ( entry. path ( ) ) )
694
+ }
695
+
685
696
fn up_to_date (
686
697
config : & Config ,
687
698
testpaths : & TestPaths ,
@@ -725,16 +736,7 @@ fn up_to_date(
725
736
for pretty_printer_file in & pretty_printer_files {
726
737
inputs. push ( mtime ( & rust_src_dir. join ( pretty_printer_file) ) ) ;
727
738
}
728
- let mut entries = config. run_lib_path . read_dir ( ) . unwrap ( ) . collect :: < Vec < _ > > ( ) ;
729
- while let Some ( entry) = entries. pop ( ) {
730
- let entry = entry. unwrap ( ) ;
731
- let path = entry. path ( ) ;
732
- if entry. metadata ( ) . unwrap ( ) . is_file ( ) {
733
- inputs. push ( mtime ( & path) ) ;
734
- } else {
735
- entries. extend ( path. read_dir ( ) . unwrap ( ) ) ;
736
- }
737
- }
739
+ inputs. extend ( collect_timestamps ( & config. run_lib_path ) ) ;
738
740
if let Some ( ref rustdoc_path) = config. rustdoc_path {
739
741
inputs. push ( mtime ( & rustdoc_path) ) ;
740
742
inputs. push ( mtime ( & rust_src_dir. join ( "src/etc/htmldocck.py" ) ) ) ;
@@ -746,6 +748,9 @@ fn up_to_date(
746
748
inputs. push ( mtime ( path) ) ;
747
749
}
748
750
751
+ // Compiletest itself.
752
+ inputs. extend ( collect_timestamps ( & rust_src_dir. join ( "src/tools/compiletest/" ) ) ) ;
753
+
749
754
inputs. iter ( ) . any ( |input| * input > stamp)
750
755
}
751
756
0 commit comments