version = "0.0.0"
dependencies = [
"env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
#[macro_use]
extern crate log;
extern crate env_logger;
+extern crate filetime;
use std::env;
use std::ffi::OsString;
use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;
+use filetime::FileTime;
use getopts::{optopt, optflag, reqopt};
use common::Config;
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Mode};
};
// Debugging emscripten code doesn't make sense today
- let mut ignore = early_props.ignore;
+ let mut ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props);
if (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) &&
config.target.contains("emscripten") {
ignore = true;
}
}
+fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
+ let stamp_name = format!("{}-H-{}-T-{}-S-{}.stamp",
+ testpaths.file.file_name().unwrap()
+ .to_str().unwrap(),
+ config.host,
+ config.target,
+ config.stage_id);
+ config.build_base.canonicalize()
+ .unwrap_or(config.build_base.clone())
+ .join(stamp_name)
+}
+
+fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool {
+ let stamp = mtime(&stamp(config, testpaths));
+ let mut inputs = vec![
+ mtime(&testpaths.file),
+ mtime(&config.rustc_path),
+ ];
+ for aux in props.aux.iter() {
+ inputs.push(mtime(&testpaths.file.parent().unwrap()
+ .join("auxiliary")
+ .join(aux)));
+ }
+ for lib in config.run_lib_path.read_dir().unwrap() {
+ let lib = lib.unwrap();
+ inputs.push(mtime(&lib.path()));
+ }
+ inputs.iter().any(|input| *input > stamp)
+}
+
+fn mtime(path: &Path) -> FileTime {
+ fs::metadata(path).map(|f| {
+ FileTime::from_last_modification_time(&f)
+ }).unwrap_or(FileTime::zero())
+}
+
pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName {
// Convert a complete path to something like
//