Commit Graph

67 Commits

Author SHA1 Message Date
Richard Gibson bcb5a2cbdd Use consistent ordering for documenting test frontmatter keys 2019-03-29 14:30:00 -04:00
Leo Balter 9558093416 Document raw negative test reqs 2019-02-14 15:06:08 -05:00
Leo Balter 7054805941
rename whitelist to exceptions in the linter tool (#2004) 2018-12-18 15:39:57 -02:00
Mathias Bynens 65f679e3d4 Update CONTRIBUTING.md per @bakkot’s feedback 2018-11-26 10:23:43 -05:00
Mathias Bynens c59f671bda Update {CONTRIBUTING,INTERPRETING}.md per @jugglinmike's feedback 2018-10-23 13:51:17 +02:00
Mathias Bynens b9daa57dcb Rename to $DONOTEVALUATE per @leobalter's suggestion 2018-10-23 13:51:17 +02:00
Mathias Bynens e3feffb01e Move `throw "…"` for negative parsing errors to a helper function
Closes #1634.
2018-10-23 13:51:16 +02:00
Rick Waldron 31ee9221b4
CONTRIBUTING.md: Fix code block 2018-09-12 14:54:31 -04:00
jugglinmike 9c3518a7e2 Improve documentation for Python usage (#1703)
Update the recommended invocation of `pip` to use the `python` command,
avoiding discrepancies on systems where the `pip` and `python` commands
are not provided by the same Python installation. In the interest of
consistency, also update the configuration for the project's continuous
integration service.

Recommend additional tooling for users with more advanced needs.
2018-09-04 10:56:51 -04:00
Kevin Gibbons 8ae2a51e29 Docs: have CONTRIBUTING.md link to referenced file 2018-08-13 10:19:38 -04: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
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
Valerie R Young 40883f4c6a Update filename character restriction in documention, linter and a few filenames 2018-05-11 22:19:01 -04:00
Steve Fink ecf176d5ad
Update CONTRIBUTING.md
typo in constructor Test252Error
2018-05-09 15:42:56 -07:00
Mike Pennisi e6d674ef7a Rename negative test "phase" for module resolution 2018-01-05 15:17:51 -05:00
Mike Pennisi 136110378b Rename negative test "phase" for parsing
Early errors may result from parsing the source text of a test file, but
they may also result from parsing some other source text as referenced
through the ES2015 module syntax. The latter form of early error is not
necessarily detectable by ECMAScript parsers, however. Because of this,
the label "early" is not sufficiently precise for all Test262 consumers
to correctly interpret all tests.

Update the "phase" name of "early" to "parse" for all those negative
tests that describe errors resulting from parsing of the file's source
text directly. A forthcoming commit will update the remaining tests to
use a "phase" name that is more specific to module resolution.
2018-01-05 15:17:50 -05:00
Adrian Heine 60ecff7c99 Fix typo 2018-01-05 12:10:13 -05:00
Ivan Vyshnevskyi 77b60b191c Correct path to helper files directory in "contributing" docs 2017-12-21 16:40:03 -05:00
Rick Waldron dc2596e80d
Merge pull request #1374 from jugglinmike/contributing-typo
Correct metadata reference in "contributing" docs
2017-12-19 15:44:18 -05:00
Mike Pennisi f3bb0de6b2 Correct metadata reference in "contributing" docs 2017-12-10 14:24:16 -05:00
Mike Pennisi 4ff280f1fb Document steps for satisfying tool dependencies 2017-12-02 23:09:24 -05:00
Rick Waldron 93568a9554 Merge pull request #1296 from rwaldron/more-about-features
CONTRIBUTING.md: More detail about "features"
2017-10-26 11:27:08 -04:00
Valerie R Young 297502b2fc Fix mistake in test generation section 2017-10-20 20:48:48 -04:00
Rick Waldron 4da4400380 CONTRIBUTING.md: More detail about "features" 2017-10-17 16:47:42 -04:00
Rick Waldron 1282e842fe CONTRIBUTING.md: Link #handling-errors-and-negative-test-cases (#1295) 2017-10-17 16:45:37 -04:00
Valerie R Young 6c41ddde40 Fix generate test explination 2017-10-17 12:57:44 -04:00
Valerie R Young b93f7a88cd very WIP notes about autogenerate files 2017-10-12 18:50:30 -04:00
Valerie R Young a5f7e2c2df update CONTRIBUTING.md to reflect current practices 2017-10-12 18:50:30 -04:00
Valerie R Young 22391e518a Fix CONTRIBUTING.md description of the info frontmatter tag 2017-10-04 17:45:03 -04:00
deathbearbrown 6236cd2868 add note to list that esid is required for new tests only 2017-06-28 13:08:28 -04:00
deathbearbrown 61214ef2e0 update contributing.md to make esid required for new feature tests 2017-06-28 13:08:28 -04:00
Mike Pennisi 53842533b7 Enforce use of `throw` stmt in early error tests
Previously, test consumers were encouraged to insert a `throw` statement
as the first statement of tests for early errors. This recommendation
made tests harder to consume, and as an optional transformation,
consumers may have ignored it or simply been unaware it was made. By
explicitly including such a `throw` statement, the tests become more
literal, making them easier to consume and more transparent in their
expectations.

Document expectation for all tests for early errors to include an
explicit `throw` statement. Extend linting script to verify that
contributors are automatically notified of violations and to ensure that
future contributions satisfy this expectation.
2017-06-28 11:24:36 -04:00
Rick Waldron c59afa3bd7 CONTRIBUTING.md: Adds 'Source Material' section with 'needs tests' pr list (#1054) 2017-06-12 19:29:58 -03:00
jugglinmike 66bd632bae Lint test `features` tag (#1060)
A recent commit introduced a document that enumerated acceptable values
for the test "features" metadata tag. However, this list was incomplete,
and maintaining it placed extra burden on the project owners.

Restructure the document into a machine-readable format. Add entries for
all previously-omitted values. Add in-line documentation with
recommendations for maintenance of the file. Extend the project's
linting tool to validate tests according to the document's contents.
2017-06-12 18:59:14 -03:00
Mathias Bynens 09f01de87e CONTRIBUTING: Fix typo (#1013) 2017-05-01 13:22:49 -04:00
Leo Balter 666f0e920a
Add assert.throws.early 2017-05-01 12:29:52 -04:00
jugglinmike 74954bfa91 Introduce automated validation for test format (#994)
This script is intended to identify common test file formatting errors
prior to their acceptance into the project. It is designed to support
future extensions for additional validation rules.
2017-05-01 12:04:05 -04:00
Mathias Bynens 5f81c02e3f CONTRIBUTING: Link to the latest spec draft (#978) 2017-04-14 12:19:39 -04:00
jugglinmike bcb7651529 Automate deployment (#546)
Introduce configuration to allow build servers provided by the Travis CI
service to execute the test generation tool and commit the resultant
files to the canonical upstream repository.

Enabling this workflow required additional administrative work:

1. Create an account with TravisCI
2. Install the `travis` command-line utility
3. Create a "deploy key" and an encrypted version using the command
   `./make.py github_deploy_key_enc`
4. Register the deploy key with the project's GitHub account
5. Check the encrypted deploy key to the repository
6. Configure the TravisCI service to automatically build this project
2017-04-10 15:31:19 -04:00
jugglinmike 56fd7712d2 Document test flag: `generated` (#886)
Resolves gh-885
2017-03-06 12:12:42 -05:00
Mike Pennisi ade6d2e384 Remove "NotEarlyError" object
Because expectations regarding error "phase" are now expressed via test
meta-data, the test runner may now enforce this requirement on negative
tests.

Remove the "NotEarlyError" from the project source. This reduces the
amount of domain knowledge required to author tests and lessens the
potential for inconsistencies between tests.
2016-10-19 15:24:22 -04:00
Mike Pennisi 0d4a07ba8c Update documentation 2016-10-19 15:24:21 -04:00
Tim Disney 3707a85705 Fix markdown typo (#763) 2016-09-27 17:05:08 -04:00
Aleksey Shvayka 8fbe992e6e Fix operator precedence (#754)
Unlike PHP, in JavaScript ! has higher precedence than instanceof, thus !smth instanceof TypeError will never (unless @@hasInstance is defined) be true.
2016-09-01 17:50:25 -07:00
Leo Balter 3723e7caeb Merge pull request #545 from bocoup/generation
Introduce test generation tool
2016-04-15 17:56:36 -04:00
Mike Pennisi 3a3ced170e Correct example in contribution guidelines
As written, the example for asserting runtime errors is written with an
early error. Because the error is expected to be reported prior to
program execution, the `assert.throws` function cannot be used to detect
it.

Demonstrate the usage of the helper function with a runtime error.
2016-03-22 09:53:56 -04:00
Leo Balter 5357b1585b Merge pull request #504 from bocoup/explicit-async
Make asynchronous test configuration explicit
2016-03-17 15:28:08 -04:00
Mike Pennisi 74bff6b3d5 Add initial set of generated test sources 2016-03-16 15:29:30 -04:00
Leonardo Balter bf782c8421 s/id/esid
Fixes #477
2016-02-22 09:47:42 -05:00
Mike Pennisi 23d566209a Make asynchronous test configuration explicit
For asynchronous tests, the contract between test file and test runner
is implicit: runners are expected to inspect the source code for
references to a global `$DONE` identifier.

Promote a more explicit contract between test file and test runner by
introducing a new frontmatter "tag", `async`. This brings asynchronous
test configuration in-line with other configuration mechanisms and also
provides a more natural means of test filtering.

The modifications to test files was made programatically using the
`grep` and `sed` utilities:

    $ grep "\$DONE" test/ -r --files-with-match --null | \
        xargs -0 sed -i 's/^\(flags:\s*\)\[/\1[async, /g'
    $ grep "\$DONE" test/ -rl --null | \
        xargs -0 grep -E '^flags:' --files-without-match --null | \
        xargs -0 sed -i 's/^---\*\//flags: [async]\n---*\//'
2016-02-12 13:03:19 -05:00