-
Notifications
You must be signed in to change notification settings - Fork 0
Improve timestamps #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
54c96f1
f1c4fd6
5ddc1a7
79f461d
d551d51
9e46cd9
e27d302
0ed6a28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonUnwrapped; | ||
import de.rub.nds.anvilcore.annotation.AnvilTest; | ||
import de.rub.nds.anvilcore.context.AnvilContext; | ||
import de.rub.nds.anvilcore.junit.Utils; | ||
import de.rub.nds.anvilcore.model.ParameterCombination; | ||
|
@@ -89,6 +90,13 @@ private boolean hasVaryingAdditionalResultInformation() { | |
@JsonProperty("DisabledReason") | ||
private String disabledReason; | ||
|
||
private Date startInputGenerationTime; | ||
|
||
private Date endInputGenerationTime; | ||
|
||
@JsonProperty("ElapsedGenerationTimeSeconds") | ||
private long elapsedGenerationTimeSeconds; | ||
|
||
@JsonProperty("FailedReason") | ||
private String failedReason; | ||
|
||
|
@@ -202,10 +210,28 @@ public void finish() { | |
LOGGER.info("{} is disable because {}", getTestMethodName(), getDisabledReason()); | ||
} | ||
scoreContainer.updateForResult(result); | ||
// AnvilContext.getInstance().testFinished(uniqueId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete uncommented code |
||
if (result != TestResult.DISABLED && testMethod.getAnnotation(AnvilTest.class) != null) { | ||
try { | ||
Date startInputGenerationTimes = | ||
AnvilContext.getInstance() | ||
.getStartInputGenerationTimes() | ||
.get(this.testMethod.toString()); | ||
Date endInputGenerationTimes = | ||
AnvilContext.getInstance() | ||
.getEndInputGenerationTimes() | ||
.get(this.testMethod.toString()); | ||
this.setStartInputGenerationTime(startInputGenerationTimes); | ||
this.setEndInputGenerationTime(endInputGenerationTimes); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you change it from date to seconds elapsed? Attrbutes could be named like "generationTimeSeconds" and "executionTimeSeconds" |
||
} catch (NullPointerException e) { | ||
LOGGER.warn("Cannot read GenerationTimes"); | ||
} | ||
} | ||
scoreContainer.updateForResult(result); | ||
AnvilContext.getInstance() | ||
.addTestResult(result, testClass.getName() + "." + testMethod.getName()); | ||
AnvilContext.getInstance().getMapper().saveTestRunToPath(this); | ||
AnvilContext.getInstance().testFinished(uniqueId); | ||
AnvilContext.getInstance().getMapper().saveTestRunToPath(this); | ||
} | ||
|
||
public TestResult resolveFinalResult() { | ||
|
@@ -333,4 +359,34 @@ public boolean isReadyForCompletion() { | |
public void setReadyForCompletion(boolean readyForCompletion) { | ||
this.readyForCompletion = readyForCompletion; | ||
} | ||
|
||
public Date getStartInputGenerationTime() { | ||
return startInputGenerationTime; | ||
} | ||
|
||
public void setStartInputGenerationTime(Date startInputGenerationTime) { | ||
this.startInputGenerationTime = startInputGenerationTime; | ||
} | ||
|
||
public Date getEndInputGenerationTime() { | ||
return endInputGenerationTime; | ||
} | ||
|
||
public void setEndInputGenerationTime(Date endInputGenerationTime) { | ||
this.endInputGenerationTime = endInputGenerationTime; | ||
this.updateElapsedGenerationTimeSeconds(); | ||
} | ||
|
||
private void updateElapsedGenerationTimeSeconds() { | ||
this.elapsedGenerationTimeSeconds = | ||
(this.endInputGenerationTime.getTime() - startInputGenerationTime.getTime()) / 1000; | ||
} | ||
|
||
public long getElapsedGenerationTimeSeconds() { | ||
return elapsedGenerationTimeSeconds; | ||
} | ||
|
||
public void setElapsedGenerationTimeSeconds(long elapsedGenerationTimeSeconds) { | ||
this.elapsedGenerationTimeSeconds = elapsedGenerationTimeSeconds; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use descirptive parameter names