Skip to content

Commit

Permalink
[GR-58510] Compilation alarm test: allow delta for time difference.
Browse files Browse the repository at this point in the history
PullRequest: graal/18908
  • Loading branch information
davleopo committed Sep 27, 2024
2 parents a100db1 + 2314b5b commit 217a1e8
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ protected void run(StructuredGraph graph, LowTierContext context) {
*/
public static final int SLEEP_SECONDS = 10;

/**
* Thread.sleep is using nanoTime and compilation alarm uses System.currenTimeMillis which is a
* different timer so there can be small imprecision. We allow this amount milliseconds total
* imprecision.
*/
public static final int IMPRECISION_DELTA = 100;

@Test
public void testTimeOutRetryToString() {
// 1D will be multiplied by 2 since we are running with assertions
Expand All @@ -94,7 +101,7 @@ public void testTimeOutRetryToString() {
duration += c;
index++;
}
assert Integer.parseInt(duration) >= 2000 : String.format("Must at least wait for 2000ms but waited %s error was %s", duration, message);
assert Integer.parseInt(duration) >= 2000 - IMPRECISION_DELTA : String.format("Must at least wait for 2000ms but waited %s error was %s", duration, message);
}
}

Expand Down

0 comments on commit 217a1e8

Please sign in to comment.