// files older than this timestamp is considered stale
long localBuildTime = buildTime + (nowSlave - nowMaster);
FilePath[] paths = new FilePath(dir).list(testResultLocations);
if (paths.length==0)
throw new AbortException("No test reports that matches "+testResultLocations+" found. Configuration error?");
// since dir is local, paths all point to the local files
List<File> files = new ArrayList<File>(paths.length);
for (FilePath path : paths) {
File report = new File(path.getRemote());
if (ignoreTimestampCheck || localBuildTime - 3000 /*error margin*/ < report.lastModified()) {
// this file is created during this build
files.add(report);
}
}
if (files.isEmpty()) {
// none of the files were new
throw new AbortException(
String.format(
"Test reports were found but none of them are new. Did tests run? %n"+
"For example, %s is %s old%n", paths[0].getRemote(),
Util.getTimeSpanString(localBuildTime-paths[0].lastModified())));
}