Commit Graph

151 Commits

Author SHA1 Message Date
Ms2ger 4986474fd1 Intl: Add an overlong language to getInvalidLocaleArguments(). 2018-10-26 16:48:40 -04:00
Rick Waldron ee3715ee56 Improve assertion handling when comparison causes failure via coercion 2018-10-23 17:25:58 -04:00
Rick Waldron f247a5fe09 Revert "Improve assertion handling when comparison causes failure via coercion"
This reverts commit c49c356744.
2018-10-23 17:21:17 -04:00
Rick Waldron c49c356744 Improve assertion handling when comparison causes failure via coercion 2018-10-23 17:00:47 -04:00
André Bargull d7d154b3bc Remove requirement that ToNumber(value) completes in less than $262.agent.MAX_TIME_EPSILON
$262.agent.MAX_TIME_EPSILON was intended to be used for callers like `Atomics.wait(typedArray, indexNumber, valueNumber, timeoutNumber)` where all parameters with the `Number` suffix denote values which are already Number values. It should not be used for `Atomics.wait(typedArray, indexObject, valueObject, timeoutObject)` where all parameters with the `Object` suffix denote values which are Object values, because in that case we'd require that `ToNumber(objectValue)` (potentially invoked multiple times) completes in less than 100 milliseconds (the default value for MAX_TIME_EPSILON).

Also removes $262.agent.MAX_TIME_EPSILON because it is now no longer used.
2018-08-19 10:29:29 -04:00
André Bargull 8879820a8f Make RegExp/CharacterClassEscapes tests faster across all engines 2018-08-17 07:48:42 -07:00
Mathias Bynens 75e8a317a2 Remove assert.throws.early
Negative tests are the better approach for early error tests.

Closes #1622.
2018-08-07 14:35:13 +02:00
Rick Waldron 4314e2cab3 Make doneprinthandle.js accept the input and produce the output expected by test262-harness. (#1650)
This is not a breaking change, it simply adds explicit handling to the function
2018-07-25 17:06:52 -07:00
Leo Balter afe2647d19 Add harness files to the renaming party 2018-07-24 15:03:54 -04:00
André Bargull 8bc4e38a48 Make Atomics tests more resilient against intermittent failures (#1617)
Also fixes multiple issues and bugs in various Atomics tests.

CONTRIBUTING.md and INTERPRETING.md:
- Add missing description for `CanBlockIsFalse` flag and also introduce `CanBlockIsTrue` flag which is needed for some tests (see below).

harness/atomicsHelper.js:
- Updated `$262.agent.waitUntil` to clarify it can also be called with BigInt64Array objects.
- Added `$262.agent.timeouts` constants to unify the various, inconsistently used timeouts in the Atomics tests. Each timeout constant has a brief description and a usage example to clarify when it should or should not be used. The default values were tested in SpiderMonkey (locally and CI) under various system load levels and should hopefully also be valid for other engines. 
- Added `$262.agent.tryYield` to yield control from the main thread. The default implementation simply calls `$262.agent.sleep`, but test262 hosts could theoretically provide a different implementation.
- Added `$262.agent.trySleep` to replace direct calls to `$262.agent.sleep` from the main thread. Motivation for this function: Some test262 hosts (like browsers) may be able to pause and sleep on the main thread, so they could provide their implementation for `trySleep` which performs a busy-wait or something do nothing.

harness/testAtomics.js:
- Replace `let`, `arrow-functions`, and `for-of` loops to avoid creating extremely long `features` lists in tests using this helper. Removed `Map`, `WeakMap`, `Set`, and `WeakSet` (these weren't even listed in features.yaml) for the same reason and added the missing `Symbol` entry for this file to features.yaml.
- Updated all files including "harness/testAtomics.js" to match the new feature requirements.


test/built-ins/Atomics/store/good-views.js and test/built-ins/Atomics/store/bigint/good-views.js:
- Replace `arrow-functions` and `for-of` loops with ES5 alternatives.


test/built-ins/Atomics/wait/bigint/*.js and test/built-ins/Atomics/wake/bigint/*.js
- Some tests were using `BigInt64Array.BYTES_PER_ELEMENT * 8` for the SharedArrayBuffer length, but their non-BigInt counterparts are using `Int32Array.BYTES_PER_ELEMENT * 4`. For consistency and to make it easier to compare the BigInt against the non-BigInt versions, I've changed it to `BigInt64Array.BYTES_PER_ELEMENT * 4`.
- Also aligned formatting and statement placement when they differed between the non-BigInt and the BigInt version of a test file. (I've diffed some of the non-BigInt and BigInt files against each other and different formatting was a nuisance.)

Test files using `$262.agent.monotonicNow()`:
- Moved `$262.agent.report()` calls outside of the block of code measured `$262.agent.monotonicNow()` to avoid measuring how long it takes to execute `$262.agent.report()`. 
- Without this change some tests failed intermittently in certain test configurations in SpiderMonkey. For example with the flags `--ion-eager -- ion-offthread-compile=off` which forces early Ion compilation on the main thread. The `$262.agent.report()` implementation in the SpiderMonkey test262 host embedding uses a for-loop which was forcefully Ion compiled under these settings. And because Ion compilation can take some time, the test case ran longer than `$262.agent.MAX_TIME_EPSILON` which lead to intermittent failures.

Test files using `CanBlockIsFalse` / `CanBlockIsTrue`:
- Some of these tests actually expected that the main thread can wait and [[CanBlock]] is `true` for the agent record executing the test. Therefore I've added a new `CanBlockIsTrue` flag and replaced the flags where needed.

test/built-ins/Atomics/wait/**/*.js and test/built-ins/Atomics/wake/**/*.js:
- Use an atomic counter `RUNNING` in more tests to have better control when a worker agent was actually started.
- Replace the various `$262.agent.sleep(/* Sleep X ms to ensure worker actually sleeps */)` calls with the new `$262.agent.tryYield()` function. This `X` was sometimes as low as 10 milliseconds, which is definitely too short for CI systems under heavy load (observed by intermittent CI failures for SpiderMonkey) and sometimes as high as 500 milliseconds, which is probably much longer than needed even when the system is under heavy load. 
- Removed duplicate strings in assertion messages, presumably from copy-pasting the messages between different files.
- Removed extra empty lines at the end of multiple files.

test/built-ins/Atomics/wake/bad-range.js, test/built-ins/Atomics/wake/bigint/bad-range.js, and test/built-ins/Atomics/wait/bigint/non-bigint64-typedarray-throws.js:
- Removed unnecessary `features` and `includes` from this file.

test/built-ins/Atomics/wait/waiterlist-order-of-operations-is-fifo.js and test/built-ins/Atomics/wait/bigint/waiterlist-order-of-operations-is-fifo.js:
- The test was actually broken and didn't test what it said it does. This probably explains #1530.
- The test wants to ensure the waiterlist is implemented as a FIFO structure. This requires that the waiting agents all wait on the same index position, because the waiterlists are defined by each index. But if the agents wait on different indices, each agent is inserted into a different FIFO structure and therefore we can't observe any FIFO ordering between the agents when they're woken up.
- All this requires a bit of synchronization between the main agent and the waiting agent, I hope the added comments help to review these changes.

test/built-ins/Atomics/wait/good-views.js:
- The agent sends multiple reports to the main agent, but only the first one was read.
- This error was introduced during previous refactorings. I've changed it to back to use a while-loop as used in the first version of this file.

test/built-ins/Atomics/wait/no-spurious-wakeup-no-operation.js:
- Only the BigInt version of this test was present, copied it so we also get code coverage for the non-BigInt case.

test/built-ins/Atomics/wait/waiterlist-block-indexedposition-wake.js:
- Added extra while loops to avoid intermittent failures when the agent worker haven't started to wait.
- This should help to avoid some of the intermittent failures we saw for SpiderMonkey.

test/built-ins/Atomics/wake/wake-all-on-loc.js and test/built-ins/Atomics/wake/bigint/wake-all-on-loc.js:
- This test was also no longer after previous refactoring sessions.
- The "B" agent only waited for 10 milliseconds, which made it likely that it already timed out before the main agent was able to call `Atomics.wake`, which in turn rendered the test useless, because the test case wants to ensure that `Atomics.wake` cannot wake "B". But if "B" was already timed out, it can trivially not be woken by `Atomics.wake`.
- Added some safety measure to catch the case when "B" timed out before `Atomics.wake` was called and made it a test error if that happens.

test/built-ins/Atomics/wake/count-defaults-to-infinity-missing.js, test/built-ins/Atomics/wake/count-defaults-to-infinity-undefined.js, and test/built-ins/Atomics/wake/undefined-index-defaults-to-zero.js:
- Changed the `$262.agent.start()` calls to use a for-loop to avoid code duplication.
- (Forgot to undo the code formatting around `assert.sameValue`, still need to change it back.)
- Also more while-loops around `Atomics.wake`.
- These changes should fix #1529 and #1566.

test/built-ins/Atomics/wake/wake-all.js:
- Removed "B" worker agent.
- Without this removal the test case would be exactly equal to test/built-ins/Atomics/wake/wake-all-on-loc.js.

test/built-ins/Atomics/wake/wake-in-order-one-time.js:
- Add for-loops to avoid code duplication and make the test more readable.
- Make the `Atomics.wake` assertion messages unique by adding the current loop counter.
- Add `$262.agent.tryYield()` to give the worker agents enough time to actually start waiting.

test/built-ins/Atomics/wake/wake-in-order.js:
- Removed the outer loop `attempt < 10` because it uses `$262.agent` in a way currently not required to work. And which actually also doesn't work in SpiderMonkey's implementation of `$262.agent`.
- According to INTERPRETING.md `$262.agent.broadcast()` broadcasts its message to all agents ever started by `$262.agent.start()` and then blocks until all agents received the broadcast. It is not required that the agents started by the first `$262.agent.broadcast()` call will all be disabled/destroyed/whatever when the second `$262.agent.broadcast()` call occurs, which then means the second `$262.agent.broadcast()` call still tries to reach the agents started in the first loop iteration, but these may no longer accept broadcasts and therefore won't acknowledge they've received the broadcast. Which then means the second `$262.agent.broadcast()` call waits forever.
2018-07-03 12:34:54 -04:00
Leo Balter 56091a0c5f
Merge pull request #1533 from rwaldron/1527
Atomics: various corrections, nit-picking and BigInt variants
2018-06-27 13:49:18 -04:00
Rick Waldron c29ae8effb Atomics: refactor atomicsHelper.js to extend $262.agent.* 2018-06-27 11:13:23 -04:00
Rick Waldron be21156542 Atomics: simplify harness/atomicsHelper.js: waitUntil 2018-06-27 10:30:46 -04:00
Rick Waldron d9084b98e7 Atomics: fix documentation in atomicsHelper.js 2018-06-26 14:53:49 -04:00
Ms2ger b4efa8c938 Add tests for the shape of the Intl.RelativeTimeFormat API. (#1596)
* Add Intl.RelativeTimeFormat feature.

* Add tests for the shape of the Intl.RelativeTimeFormat API.

* fixup! Add tests for the shape of the Intl.RelativeTimeFormat API.
2018-06-26 14:02:29 -04:00
Rick Waldron 73be21272d Atomics: wake/wake-in-order.js, capture waiterlist order for wake comparison 2018-06-25 17:02:40 -04:00
jugglinmike 330733eaf3 Correct licensing (#1608)
In order to satisfy the project's formatting rules, license information
was inserted into a number of files where it had been mistakenly omitted
by the original contributors [1]. In many cases, the license information
did not accurately describe the contributor or the time of contribution.
Update the information according to the information provided by the
contributors at the time each file was authored:

- atomicsHelper.js - a72ee6d912
- detachArrayBuffer.js - 70c7375be8
- nans.js - b17ffc0298
- nativeFunctionMatcher.js - 6b7cbb5035
- proxyTrapsHelper.js d530c87b41
- regexpUtils.js - 44b40e083e
- tcoHelper.js - 4dc81d3788

[1] 4ea2931f16
2018-06-25 10:30:11 -04:00
Rick Waldron 84f448f060 Atomics: fix buffer sizes 2018-06-22 16:35:15 -04:00
Rick Waldron 7f3a1c1be9 Atomics: moves getReport and waitUntil into atomicsHelper.js; broad updates to all Atomics.wait tests 2018-06-22 15:14:11 -04:00
Rick Waldron 253bc87bc5
Merge pull request #1560 from tc39/intl-update-iana-subtags-2018-04-23
Intl: Update language subtag data to "IANA language subtag registry, file date 2018-04-23"
2018-06-04 16:22:01 -04:00
Ms2ger 501a9a674f Various additions to the Intl.Locale test coverage. 2018-06-04 14:08:28 +02:00
Mike Pennisi 51bbcf59be Formalize asynchronous failure conditions
Previously, the error message generated by failed asynchronous tests was
generic and underspecified. Improve the format and explicitly document
it in project's interpreting guidelines.
2018-05-20 15:24:55 -04:00
Rick Waldron 560d9e519c Intl: Update language subtag data to "IANA language subtag registry, file date 2018-04-23"
https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
2018-05-18 11:54:44 -04:00
Ms2ger 190cf5c730 Extract list of structurally invalid tags from invalid-tags.js. 2018-05-03 14:20:39 -04:00
Rick Waldron c55d2ab7c3 Extensive Function toString updates for "Function.prototype.toString revision" proposal. (#1510)
Fixes gh-1453
2018-04-19 16:44:52 -04:00
Rick Waldron ac65ecab7c Atomics: updates to tests 2018-04-19 15:09:39 -04:00
peterwmwong f1e45d9e5e
Fleshed out tests for Symbol.matchAll, String.p.matchAll, RegExp.p[@@matchAll], and %RegExpStringIteratorPrototype%
Tests were updated and assuming https://github.com/tc39/proposal-string-matchall/pull/33 will be merged.
2018-03-17 22:48:31 -05:00
André Bargull ea6c18c5e2 Don't compute NaN values in functions (#1503)
`function nan() { return /* expression to compute NaN */ }` may not return the same implementation-distinguishable NaN value before and after JIT compilation.
2018-03-22 20:20:29 -04:00
André Bargull 500e48e6ce Fix various test bugs (#1502)
Fixes #1492
2018-03-22 16:36:57 -04:00
Rick Waldron 2975694f86 Weaken tests about NaN canonicalization.
Fixes gh-1476
Closes gh-1484
2018-03-13 12:53:39 -04:00
Leo Balter 222b86cac5
improve propertyHelper for failure messages (#1480)
Example:
Before: descriptor value should be 42 Expected SameValue(«1», «0») to be true
After: descriptor value should be 42
2018-03-08 12:12:15 -05:00
Michael Ficarra 83ffb4bbf2 allow any function to report its toString as a NativeFunction
related: https://github.com/tc39/Function-prototype-toString-revision/pull/26
2018-03-07 14:09:45 -05:00
Rick Waldron 4efdb83ae9 Updates a portion of the BigInt tests that need work. Ref gh-1461 (#1462) 2018-02-27 17:45:25 -05:00
Leo Balter 2712807027
Fix errors recently introduced. (#1448)
* Fix bad references on tests for BigInt TypedArrays

* Remove bad conversions for BigInt TypedArray

* Cleanup the BigInt TypedArray harness file

Remove non used code (testBigIntTypedArrayConversions)

Move the constructors list to inside the exposed function, this prevents early implementations to fail before the function is called.

* Fix bad references in TypedArrays.of (BigInt)

* Remove BigInt tests from typedarray harness test

* Use BigInt for BigInt typedArrays

* Apply last fixings on BigInt TypedArray tests

* Apply fixes to last revision from @anba
2018-02-27 14:58:56 -05:00
Leo Balter c6cd535940 Last cases of convertToBigInt 2018-02-15 16:45:10 -05:00
Leo Balter 098c69540e Remove N() 2018-02-15 16:45:08 -05:00
Leo Balter 3f3f2faa8e whitespace 2018-02-15 16:45:08 -05:00
Leo Balter c1bc43b1b1 Restore original tests for TypedArrays and optimize files
- optimize file names
- BigInt folder for TAs.from and of
- copy tests preparing for bigint
- copy ta prototype methods for bigint
- Use an exclusive harness for bigint typedarrays
- add features
- use proper harness
- use preper harness
- Restore original tests for TypedArrays
- final fixes
- fix includes
2018-02-15 16:45:06 -05:00
Robin Templeton 9232d65b30 BigInt TypedArray tests
- add @jakobkummerow's changes
- remove EOL whitespace
- use 'Array.isArray' instead of 'instanceof Array'
- check for BigInt type in toLocaleString tests
- specify TypedArray constructor list for non-BigInt tests
- update TypedArray harness test for BigInt
- add a missing type coercion
- disable more tests for Big(U)Int64Array
- check for BigInt before using BigInt TypedArray constructors
2018-02-15 16:45:05 -05:00
André Bargull 40a7bd2401 Add test cases for tc39/ecma402#194 2018-01-25 14:04:44 -05:00
André Bargull 266e0ffb66 Remove harness/testBuiltInObject.js file 2017-12-21 16:46:56 -05:00
André Bargull 60692bb6e0 Move remaining testBuiltInObject callers to use normal assert calls 2017-12-21 16:46:56 -05:00
André Bargull c81370348d No longer use testBuiltInObject for built-in objects 2017-12-21 16:46:56 -05:00
André Bargull ecf814bb4c No longer use testBuiltInObject for built-in constructors 2017-12-21 16:46:56 -05:00
André Bargull 4337b396bd Add separate test files for property attributes of Intl properties 2017-12-21 16:46:56 -05:00
André Bargull 513a3056fb Add separate test files to test the length property of Intl functions 2017-12-21 16:46:56 -05:00
André Bargull 72db5f1ec1 Replace mustHaveProperty with verifyProperty 2017-12-21 16:46:56 -05:00
André Bargull ce3c3d7dbd Replace mustNotHaveProperty with verifyProperty 2017-12-21 16:46:56 -05:00
André Bargull 20ea611db7 Replace mayHaveProperty with verifyProperty 2017-12-21 16:46:56 -05:00
André Bargull d249979bc9 Update language tag mapping data 2017-12-21 16:46:55 -05:00