Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Unified Diff: test/mjsunit/timer.js

Issue 24484003: Let timer test retry for 20ms to reduce flakiness. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+})()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698