about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVytautas Astrauskas <vastrauskas@gmail.com>2018-12-10 15:59:55 +0100
committerVytautas Astrauskas <vastrauskas@gmail.com>2018-12-17 12:18:35 +0100
commit91bfbb968751ae8441ebccefed7cd63ca00b43dd (patch)
tree71c3247efbdb6a9525dee2b33f16e3243ec895dc /src
parent7fb479c92b6358590a0180b00a416bb055b6548e (diff)
downloadrust-91bfbb968751ae8441ebccefed7cd63ca00b43dd.tar.gz
rust-91bfbb968751ae8441ebccefed7cd63ca00b43dd.zip
Use compiletest timestamp to check if the tests should be rerun.
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/main.rs28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 9aefd15765d..68db2402213 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -682,6 +682,20 @@ fn stamp(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> Path
     output_base_dir(config, testpaths, revision).join("stamp")
 }
 
+/// Walk the directory at `path` and collect timestamps of all files into `inputs`.
+fn collect_timestamps(path: &PathBuf, inputs: &mut Vec<FileTime>) {
+    let mut entries = path.read_dir().unwrap().collect::<Vec<_>>();
+    while let Some(entry) = entries.pop() {
+        let entry = entry.unwrap();
+        let path = entry.path();
+        if entry.metadata().unwrap().is_file() {
+            inputs.push(mtime(&path));
+        } else {
+            entries.extend(path.read_dir().unwrap());
+        }
+    }
+}
+
 fn up_to_date(
     config: &Config,
     testpaths: &TestPaths,
@@ -725,16 +739,7 @@ fn up_to_date(
     for pretty_printer_file in &pretty_printer_files {
         inputs.push(mtime(&rust_src_dir.join(pretty_printer_file)));
     }
-    let mut entries = config.run_lib_path.read_dir().unwrap().collect::<Vec<_>>();
-    while let Some(entry) = entries.pop() {
-        let entry = entry.unwrap();
-        let path = entry.path();
-        if entry.metadata().unwrap().is_file() {
-            inputs.push(mtime(&path));
-        } else {
-            entries.extend(path.read_dir().unwrap());
-        }
-    }
+    collect_timestamps(&config.run_lib_path, &mut inputs);
     if let Some(ref rustdoc_path) = config.rustdoc_path {
         inputs.push(mtime(&rustdoc_path));
         inputs.push(mtime(&rust_src_dir.join("src/etc/htmldocck.py")));
@@ -746,6 +751,9 @@ fn up_to_date(
         inputs.push(mtime(path));
     }
 
+    // Compiletest itself.
+    collect_timestamps(&rust_src_dir.join("src/tools/compiletest/"), &mut inputs);
+
     inputs.iter().any(|input| *input > stamp)
 }