提交 684e94ca 编写于 作者: K kohsuke

made Hudson more robust to clock out of sync problem. See...

made Hudson more robust to clock out of sync problem. See http://www.nabble.com/Hudson---test-parsing-failure-tt21520694.html

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14776 71c3de6d-444a-0410-be80-ed276b4c234a
上级 ae923c1f
......@@ -308,6 +308,10 @@ public class MavenBuild extends AbstractBuild<MavenModule,MavenBuild> {
return MavenBuild.this.getTimestamp();
}
public long getMilliSecsSinceBuildStart() {
return System.currentTimeMillis()-getTimestamp().getTimeInMillis();
}
public void registerAsProjectAction(MavenReporter reporter) {
MavenBuild.this.registerAsProjectAction(reporter);
}
......
......@@ -81,6 +81,15 @@ public interface MavenBuildProxy {
*/
Calendar getTimestamp();
/**
* # of milliseconds elapsed since {@link #getTimestamp()}.
*
* Where the clock skew is involved between the master and the Maven JVM, comparing
* current time on Maven JVM with {@link #getTimestamp()} could be problematic,
* but this value is more robust.
*/
long getMilliSecsSinceBuildStart();
/**
* Nominates that the reporter will contribute a project action
* for this build by using {@link MavenReporter#getProjectAction(MavenModule)}.
......@@ -165,6 +174,10 @@ public interface MavenBuildProxy {
return core.getTimestamp();
}
public long getMilliSecsSinceBuildStart() {
return core.getMilliSecsSinceBuildStart();
}
public void registerAsProjectAction(MavenReporter reporter) {
core.registerAsProjectAction(reporter);
}
......
......@@ -67,9 +67,10 @@ public class SurefireArchiver extends MavenReporter {
// no test in this module
return true;
if(result==null)
result = new TestResult(build.getTimestamp().getTimeInMillis() - 1000/*error margin*/, ds);
else
if(result==null) {
long t = System.currentTimeMillis() - build.getMilliSecsSinceBuildStart();
result = new TestResult(t - 1000/*error margin*/, ds);
} else
result.parse(build.getTimestamp().getTimeInMillis() - 1000/*error margin*/, ds);
int failCount = build.execute(new BuildCallable<Integer, IOException>() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册