Bug 1361526 - Merge from upstream test262 to kill intermittents. r=me, a=test-only
authorLars T Hansen <lhansen@mozilla.com>
Wed, 11 Oct 2017 11:16:49 +0200
changeset 432430 10279b6ebdf8f0547d786ceda1f5e5d368991f6c
parent 432429 39d11cbd38ebc6f4a6d9a58dd80ccec094944cf8
child 432431 c2c10508ec8d9e50eba1db0137d4509fe7d9af19
push id7953
push userryanvm@gmail.com
push dateThu, 12 Oct 2017 14:05:58 +0000
treeherdermozilla-beta@f4ba99b41183 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme, test-only
bugs1361526
milestone57.0
Bug 1361526 - Merge from upstream test262 to kill intermittents. r=me, a=test-only
js/src/tests/test262/built-ins/Atomics/wait/did-timeout.js
js/src/tests/test262/built-ins/Atomics/wait/no-spurious-wakeup.js
--- a/js/src/tests/test262/built-ins/Atomics/wait/did-timeout.js
+++ b/js/src/tests/test262/built-ins/Atomics/wait/did-timeout.js
@@ -1,35 +1,36 @@
 // Copyright (C) 2017 Mozilla Corporation.  All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.
 
 /*---
+esid: sec-atomics.wait
 description: >
   Test that Atomics.wait returns the right result when it timed out and that
   the time to time out is reasonable.
 includes: [atomicsHelper.js]
 ---*/
 
 $262.agent.start(
 `
 $262.agent.receiveBroadcast(function (sab, id) {
   var ia = new Int32Array(sab);
   var then = Date.now();
   $262.agent.report(Atomics.wait(ia, 0, 0, 500)); // Timeout 500ms
-  $262.agent.report(Date.now() - then);
+  $262.agent.report(Date.now() - then);           // Actual time can be more than 500ms
   $262.agent.leaving();
 })
 `);
 
 var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
 
 $262.agent.broadcast(ia.buffer);
 assert.sameValue(getReport(), "timed-out");
-assert.sameValue(Math.abs((getReport()|0) - 500) < $ATOMICS_MAX_TIME_EPSILON, true);
+assert.sameValue((getReport()|0) >= 500 - $ATOMICS_MAX_TIME_EPSILON, true);
 
 function getReport() {
     var r;
     while ((r = $262.agent.getReport()) == null)
-	$262.agent.sleep(100);
+        $262.agent.sleep(100);
     return r;
 }
 
 reportCompare(0, 0);
--- a/js/src/tests/test262/built-ins/Atomics/wait/no-spurious-wakeup.js
+++ b/js/src/tests/test262/built-ins/Atomics/wait/no-spurious-wakeup.js
@@ -1,38 +1,39 @@
 // Copyright (C) 2017 Mozilla Corporation.  All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.
 
 /*---
+esid: sec-atomics.wait
 description: >
   Test that Atomics.wait actually waits and does not spuriously wake
   up when the memory value is changed.
 includes: [atomicsHelper.js]
 ---*/
 
 $262.agent.start(
 `
 $262.agent.receiveBroadcast(function (sab, id) {
   var ia = new Int32Array(sab);
   var then = Date.now();
   Atomics.wait(ia, 0, 0);
-  var diff = Date.now() - then;        // Should be about 1000 ms
+  var diff = Date.now() - then;        // Should be about 1000 ms but can be more
   $262.agent.report(diff);
   $262.agent.leaving();
 })
 `);
 
 var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
 
 $262.agent.broadcast(ia.buffer);
 $262.agent.sleep(500);                // Give the agent a chance to wait
-Atomics.store(ia, 0, 1);        // Change the value, should not wake the agent
+Atomics.store(ia, 0, 1);              // Change the value, should not wake the agent
 $262.agent.sleep(500);                // Wait some more so that we can tell
-Atomics.wake(ia, 0);                // Really wake it up
-assert.sameValue(Math.abs((getReport()|0) - 1000) < $ATOMICS_MAX_TIME_EPSILON, true);
+Atomics.wake(ia, 0);                  // Really wake it up
+assert.sameValue((getReport()|0) >= 1000 - $ATOMICS_MAX_TIME_EPSILON, true);
 
 function getReport() {
     var r;
     while ((r = $262.agent.getReport()) == null)
         $262.agent.sleep(100);
     return r;
 }