Commit Graph

105 Commits

Author SHA1 Message Date
Richard Gibson 8ca5bdd44c CONTRIBUTING.md: Improve asyncHelpers documentation
* Only mention `$DONE` after `asyncTest`.
* Document that `asyncTest` is not intended to be called multiple times per file.
2024-08-01 11:38:06 -04:00
Anthony Frehner e5a7450095 Remove backtick from CONTRIBUTING.md 2023-04-11 15:18:17 -07:00
José Julián Espina 4a6439e4a7
Add `Array.prototype.includes` and `exponentiation` features (#3799) 2023-03-23 10:51:08 +01:00
Cam d216cc1972 asyncHelpers implementation: Apply suggestions from code review
Co-authored-by: Philip Chimento <philip.chimento@gmail.com>
2023-02-21 11:04:09 -08:00
Cam Tenny e0d5b780e7 Update CONTRIBUTING.md to suggest using asyncHelpers 2023-02-21 11:04:09 -08:00
Richard Gibson 3d939ef566
Fix typo in CONTRIBUTING.md (#3743) 2022-12-02 13:23:29 -05:00
Richard Gibson 421764fbac
Update test case style to match current patterns (#3742) 2022-12-02 12:53:49 -05:00
Philip Chimento 29f321a4e9 Document staging folder
Most of the information taken from the discussion in the issue.

Closes: #3649
2022-11-02 10:02:12 +01:00
Richard Gibson d59d28defa Meta: Add GraalJS issue reporting link 2022-10-19 15:32:19 -07:00
Richard Gibson 29c36b0561 Meta: Link to engine262 instructions 2022-08-09 11:55:18 -07:00
Philip Chimento 0b0fbdb04b Fix path example in generated test instructions
We should not have an absolute path (starting with a slash) in this
field, because that will mess up the test generation program.
2022-02-16 09:56:59 -05:00
Csaba Osztrogonác 00f682e746 tools: enforce restriction on YAML negative key
The phase field must precede the type field for negative tests
to have a consistent style and be able to parse easier.
Related to the goal of https://github.com/tc39/test262/issues/1997

Added this check to the linting script and updated tests accordingly.
2022-01-10 13:50:38 -05:00
Csaba Osztrogonác bd1acb51a4 tools: enforce restriction on YAML includes key
Includes key should use flow notation to be able parsed easier
as suggested in https://github.com/tc39/test262/issues/1997

Added this check to the linting script and updated tests accordingly.
2022-01-05 17:27:58 -05:00
Mike Pennisi 74b12b3777 Improve documentation of harness files & raw flag
Prior to this commit, the term "harness" was used to refer both to the
like-named directory in the repository and the external projects which
consume the tests. Reserve the term "harness" to refer solely to the
files maintained within this project's `harness/` directory, and use
the term "runner" to refer to the external projects.

Prior to this commit, the term "helper" was not defined and therefore
introduced ambiguity in text that described harness files. Replace the
term with more explicit wording in terms of the harness files.

Because test runners have some leeway in how they include harness files,
the requirement that "[t]he test source code must not be modified in any
way" does not necessarily preclude the use of harness files. Update the
instructions for interpreting the `raw` frontmatter flag to explicitly
disallow harness files.
2021-12-03 19:45:24 -05:00
arai-a 9f2814f00f
Mention raw flag in test environment section (#3317) 2021-11-19 14:12:59 -05:00
Mike Pennisi 23a4181a26 Document more test metadata in contribution guide 2021-11-16 17:05:11 -05:00
Richard Gibson f1bad717e2 Explain the purpose of `assert` helper message parameters
The convention in some testing libraries is an explanation of what went wrong;
in this one it is an explanation of what should happen.
2021-09-13 10:09:42 -04:00
Mike Pennisi c4e54648c0 tools: enforce restriction on YAML
Some consumers have reported difficulty parsing an uncommon YAML
construction [1] [2] [3]. Extend the linter to help ensure that
construction is not used in future contributions.

[1] https://github.com/tc39/test262/issues/1997
[2] https://github.com/tc39/test262/pull/2505
[3] https://github.com/tc39/test262/issues/3171
2021-09-07 17:41:36 -04:00
Richard Gibson 20e06a147f Improve "Procedurally-generated tests" documentation 2021-07-28 12:43:25 -04:00
rwaldron 44aac8eadd CONTRIBUTING.md: remove $ERROR from docs 2021-07-21 15:15:55 -04:00
Kartik Kapoor 21f07ead19
Update CONTRIBUTING.md (#3005) 2021-06-10 11:36:04 -04:00
Aaryan Porwal 20a089566e
Update CONTRIBUTING.md (#3004)
Fixed some grammatical issues in the document.
2021-06-10 11:34:28 -04:00
Mike Pennisi 56ca8add7d Update project structure to support non-JS files
This change is in service of forthcoming tests for the "JSON modules"
language proposal [1]. Verifying the semantics of that proposal requires
modules whose source text is not valid ECMAScript; this change updates
the guidelines for contributing and interpreting tests so that such test
material can be handled consistently.

Differentiating JSON files with a distinct file name suffice will assist
consumers which require special handling of such files (e.g. web
browsers).

Change the pattern used to designate "fixture" files so that it may be
applied to files used for JSON modules.

Increment the project version number to alert consumers of this change
in interpreting instructions.

[1] https://github.com/tc39/proposal-json-modules
2021-05-28 20:02:59 -04:00
Mike Pennisi 4f50cbfc77 Remove docs for unused frontmatter key, `timeout`
This metadata was not in use when it was first documented in 2014 [1],
and it has not been referenced since that time. It has never been
referenced by `INTERPRETING.md`.

[1] 5b8879b951
2021-05-11 17:43:23 -04:00
Rick Waldron 5b54058ad7 Enable configuration of templates for generated tests. Fixes gh-1049 2020-09-25 13:16:06 -04:00
Rick Waldron 9e88ec1354 Contributing: add list of links to implementation bug trackers. Fixes gh-2121 2020-09-14 13:29:08 -04:00
Rick Waldron 3429f714d9 Acceptable Tests, Unacceptable Tests 2020-09-14 13:26:11 -04:00
Rick Waldron d6fba2035b
Interpreting: explain $DONOTEVALUATE. (#2735)
No version change is necessary, this is purely informative.
2020-08-20 14:11:10 -07:00
Leo Balter 2e127ec40e Rename usage of master to main
Ref #2699
2020-07-15 15:47:15 -04:00
André Bargull d8c20b423b Call $DONE function exactly once per test
Also make a note in CONTRIBUTING.md that `$DONE` shouldn't be called multiple times.
2019-07-22 02:12:24 -07:00
Leo Balter 26a2268436 Update contributing file to describe current requirements for the copyright header 2019-07-15 14:03:25 -04:00
Richard Gibson 9b95d46e7d Fix typo (#2224) 2019-07-08 15:32:59 -04:00
Ross Kirsling 1859ec66f4 Test update for letting all early errors be SyntaxErrors 2019-06-12 14:09:03 -04:00
Aleksey Shvayka 8cc85b875d Fix docs for using make.py (#2181) 2019-05-29 14:51:20 -04:00
Rick Waldron cfe59eec64 INTERPRETING.md/CONTRIBUTING.md: revised rules for _FIXTURE.js files (#2135) 2019-04-24 10:59:54 -04:00
Richard Gibson ca8e292310 Provide more useful and realistic test examples in CONTRIBUTING.md
Per advice from @leobalter, based upon content from test/language/expressions/dynamic-import
2019-03-29 14:30:36 -04:00
Richard Gibson 409c598faf Improve CONTRIBUTING.md formatting 2019-03-29 14:30:27 -04:00
Richard Gibson 35c7cb11de Update CONTRIBUTING.md vocabulary for consistency with YAML
"tag" has a specific and different meaning; the proper term for this page is "key"
cf. https://yaml.org/spec/1.2/spec.html#id2761292
2019-03-29 14:30:14 -04:00
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