 Chromium Code Reviews
 Chromium Code Reviews Issue 24484003:
  Let timer test retry for 20ms to reduce flakiness.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 24484003:
  Let timer test retry for 20ms to reduce flakiness.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: test/mjsunit/timer.js | 
| diff --git a/test/mjsunit/timer.js b/test/mjsunit/timer.js | 
| index 9b8dc29fe1641f1b79c538413fa00f625d765bce..be7a561429878abbf68ccdee01e8b8d8cf22c839 100644 | 
| --- a/test/mjsunit/timer.js | 
| +++ b/test/mjsunit/timer.js | 
| @@ -27,9 +27,20 @@ | 
| // Tests timer milliseconds granularity. | 
| -var start = Date.now(); | 
| -var end = Date.now(); | 
| -while (end - start == 0) { | 
| - end = Date.now(); | 
| -} | 
| -assertTrue(end - start <= 2); | 
| +(function run() { | 
| + var start_test = Date.now(); | 
| + // Let the retry run for maximum 20ms to reduce flakiness. | 
| 
Jakob Kummerow
2013/09/25 17:11:55
Should have updated this comment (and the CL descr
 | 
| + for (var start = Date.now(); start - start_test < 100; start = Date.now()) { | 
| + var end = Date.now(); | 
| + while (end - start == 0) { | 
| + end = Date.now(); | 
| + } | 
| + if (end - start == 1) { | 
| + // Found milliseconds granularity. | 
| + return; | 
| + } else { | 
| + print("Timer difference too big: " + (end - start) + "ms"); | 
| + } | 
| + } | 
| + assertTrue(false); | 
| +})() |