Reviewers: Jakob,

Message:
PTAL

Description:
Let timer test retry for 20ms to reduce flakiness.

BUG=

Please review this at https://codereview.chromium.org/24484003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+17, -6 lines):
  M test/mjsunit/timer.js


Index: test/mjsunit/timer.js
diff --git a/test/mjsunit/timer.js b/test/mjsunit/timer.js
index 9b8dc29fe1641f1b79c538413fa00f625d765bce..65a9815b269c48cd89fe118bc3480003cc1d18aa 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.
+ for (var start = Date.now(); start - start_test < 20; 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);
+})()


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to