Commit Graph

130 Commits

Author SHA1 Message Date
Mike Pennisi b6a4910eb5 Console Runner: Formally Deprecate
Document the console runner's "deprecated" status. Move the
documentation to a less central location in the project's file hierarchy.
2016-02-19 10:49:15 -05:00
Mike Pennisi 3771cb3acc Revert "Enable parallel test execution in console runner"
This reverts commit 7ae29d49ae.
2016-02-19 10:46:18 -05:00
Mike Pennisi 4dd257d7e6 Revert "Test runner: Avoid race condition"
This reverts commit 217812891c.
2016-02-19 10:46:17 -05:00
Mike Pennisi ccf0adfc62 Revert "Runner: Re-use lock to share access to stdout"
This reverts commit b791cc4fbe.
2016-02-19 10:46:14 -05:00
Mike Pennisi b791cc4fbe Runner: Re-use lock to share access to stdout
When executing multiple tests in parallel, each "child" thread would
write to the process's standard output buffer immediately upon test
completion. Because thread execution order and instruction interleaving
is non-deterministic, this made it possible for characters to be emitted
out-of-order.

When extended to support multiple concurrent threads, the runner was
outfitted with a "log lock" dedicated to sharing access to the output
file (when applicable). Re-use this lock when writing to standard out,
ensuring proper ordering of test result messages.
2016-02-10 17:15:49 -05:00
Mike Pennisi 217812891c Test runner: Avoid race condition
A recent extension to the test runner introduced support for running
tests in parallel using multi-threading. Following this, the runner
would incorrectly emit the "final report" before all individual test
results.

In order to emit the "final report" at the end of the output stream, the
parent thread would initialize all children and wait for availability of
a "log lock" shared by all children.

According to the documentation on the "threading" module's Lock object
[1]:

> When more than one thread is blocked in acquire() waiting for the state
> to turn to unlocked, only one thread proceeds when a release() call
> resets the state to unlocked; which one of the waiting threads proceeds
> is not defined, and may vary across implementations.

This means the primitive cannot be used by the parent thread to reliably
detect completion of all child threads.

Update the parent to maintain a reference for each child thread, and to
explicitly wait for every child thread to complete before emitting the
final result.

[1] https://docs.python.org/2/library/threading.html#lock-objects
2016-02-10 16:47:01 -05:00
Till Schneidereit 7ae29d49ae Enable parallel test execution in console runner
Adds a `-j`/`--workers-count` parameter to `tools/packaging/test262.py`, defaulting to `[number of cores] - 1`.

Speeds up running the test suite by about ~3x on my 4-core machine, with the SpiderMonkey shell. This could certainly be optimized more by just appending test results to per-thread lists and merging them at the end, but it's better than nothing.
2016-02-08 17:40:16 +01:00
André Bargull d38de8dca7 Remove links to hg.ecmascript.org (non-license content) 2015-07-17 17:43:27 +02:00
André Bargull a85f5039e0 Remove links to hg.ecmascript.org 2015-07-17 17:43:09 +02:00
Brian Terlson d9f1758ef4 Merge pull request #340 from bocoup/raw
Implement `raw` flag
2015-07-07 14:35:11 -05:00
Mike Pennisi ab7617dedd Implement `raw` flag
Some tests involving the directive prologue are invalidated by source
text transformations that insert executable code in the beginning of the
script. Implement a `raw` flag that allows these tests to opt-out of
this transformation. Update the relevant tests to use this flag (and
remove references to globals only available when code is injected).

Update the Python runner accordingly:

- Do not run tests marked as "raw" in strict mode
- Reject invalid test configurations

Update the browser runner accordingly:

- Do not modify the script body of tests marked as "raw"
2015-07-07 13:18:55 -04:00
Brian Terlson 284c30646c Merge pull request #351 from arv/fix-indentation
Unify indentation in test_monkeyYaml.py
2015-07-06 17:21:31 -05:00
Brian Terlson 26faeed5c7 Merge pull request #347 from bocoup/all-monkey-all-the-time
Use "monkeyYaml" in all environments
2015-07-06 16:51:00 -05:00
Erik Arvidsson 8dd6aa22dd Unify indentation in test_monkeyYaml.py 2015-07-06 10:09:26 -04:00
Mike Pennisi 1303ef0d05 Use "monkeyYaml" in all environments
The "monkeyYaml" parser is intended to serve as a lightweight fallback
to Python's standard YAML parser in contexts where the latter is not
available. Any intentionally-simplified implementation will necessarily
exhibit non-standard behavior for different input, so not all input
accepted by the standard parser will be accepted by "monkeyYaml". If
loaded exclusively in fallback situations, these edge cases can only be
identified (and debugged) in the environments that require the fallback.
This has allowed developers to unknowingly author tests that cause
errors.

Update the test runner to use "monkeyYaml" in all cases, ensuring more
consistent behavior across contexts and precluding this class of
regression.
2015-07-01 14:49:54 -04:00
Erik Arvidsson 37b1d7a7a8 monkeyYaml: Add support for line folding
Fixes #345
2015-07-01 11:09:08 -04:00
Mike Pennisi b974c13751 Move website scripts to a dedicated directory
Some JavaScript source files are only relevant in the context of the
Test262 website. They should not be explicitly included by individual
tests, so their presence in the `harness/` directory alongside "include"
files is misleading.

Move the scripts to a location within the `website/` directory to
better-reflect their intended use. Update the relevant HTML templates
with the new locations.
2015-06-26 13:29:07 -04:00
Mike Pennisi 86c7e272a6 Remove support for legacy `$INCLUDE` syntax
Although test files once expressed dependencies on external files using
a global `$INCLUDE` function, that pattern was removed in favor of
declarative meta-data [1].

Remove the associated logic from the Python runner and the browser.

[1] See commit d4354d14d5.
2015-06-26 13:29:07 -04:00
Mike Pennisi 73aa06275a Update browser runner to inject `assert.js`
Since the Python runner was updated to include `assert.js` in all tests
unconditionally, a number of tests have been written that implicitly
rely on its presence. The browser runner does not currently provide this
file's contents to these tests, so they fail unconditionally.

Update the browser runner to inject that file's contents into every test
context.

Note: the existing approach to file retrieval (namely loading via
synchronous XHR requests) is inefficient and deprecated in some
browsers. It is honored here for the sake of consistency and to minimize
the changeset necessary to fix the browser runner.
2015-06-18 13:53:09 -04:00
Erik Arvidsson be26179719 Fix monkey yaml's handling of carriage return
monkeyYaml didn't split lines correctly leading to \r in resulting
values.

Fixes #295
2015-06-10 10:45:23 -04:00
Mike Pennisi 7c4b2e9ef5 Update contribution information
Test262 now accepts community contributions. Update the copy on the
website to reflect this.
2015-05-25 17:41:13 -04:00
Brian Terlson 5ce9712be0 Python harness: run tests in both modes by default 2015-05-13 18:52:01 -07:00
smikes 107d786ec5 candidate fix for #215
additional test, tests should have unique names
improve python style thx to arv
2015-03-30 15:37:59 -06:00
Gregory Brail 41ed1257d7 Fix JUnit output so that it can be actually be parsed by JUnit and
Jenkins. Wrap XML output correctly and
post-process failure messages to avoid invalid XML characters.
2015-02-26 16:46:59 -08:00
Brian Terlson b81b71eac2 Fix packager.py for updated locations 2014-12-09 14:52:12 -08:00
Brian Terlson 47821a8bd0 Update python scripts for new paths 2014-12-07 15:42:12 -08:00
Brian Terlson 3883a2e906 Merge pull request #127 from smikes/asserts
add "assert.js" to python, website runners too
2014-12-01 20:14:47 -08:00
smikes e0fdc30078 add "assert.js" to python, website runners too 2014-12-01 20:04:35 -07:00
Domenic Denicola 2a01b54bb4 Fix whitespace for async test detection
Presumably since Python is whitespace-sensitive, this is actually quite important?
2014-12-01 15:53:27 -05:00
Domenic Denicola dd243a757c Remove trailing whitespace from the Python 2014-12-01 15:52:19 -05:00
smikes 64093f79d3 add some unit tests
add test to repro #114
fix issue #114
factor out PercentFormat function
new fn write; start factoring summary output
fix tests to match
consolidate "Failed Tests" message
add test for successful run
consolidate all_succeeded message
consolidate summary line
consolidate ntests
failing negative tests
squeeze whitespace
2014-11-11 17:07:48 -07:00
Brian Terlson 1f2812adeb Merge pull request #104 from smikes/monkeyYaml-loadfix
load monkeyYaml without assuming it is on path
2014-10-24 14:41:40 -07:00
Sam Mikes 9dc29da897 load monkeyYaml without assuming it is on path
use imp to import monkeyYaml locally
make monkeyYaml the backup again
2014-10-24 22:36:03 +01:00
Sam Mikes 89d71f56b2 additional fixes suggested by @anba 2014-10-24 15:18:37 +01:00
Sam Mikes 4f9cec2fa8 provide fallback parser if YAML not installed
parseTestRecord.py:
- recover from ImportError when YAML not defined
- use monkeyYaml as backup

monkeyYaml.py:
- parser for subset of YAML used in test262 frontmatter

test_monkeyYaml.py:
- unit tests
2014-08-28 12:47:58 +01:00
Sam Mikes 6b7e5d7747 bestPractice: supply error names to negative
pilot directory for replacing flags: [negative] with
negative: errorname

ch07-7.2,7.3: add error names
ch07-rest: insert error names rest of ch07
ch08: add expected error name
ch11: add error name to negative
ch12: put error name in negative

ch13: add error name to negative
only one test, did it manually

ch15: add error name to negative:

ch07: add error name to negative

these tests used flags: \n - negative and so
were not caught by the earlier naive grep for flags: [negative]

--- changes suggested by @anba

bestPractice - remove added NotEarlyError
ch07,ch11 - expect ReferenceError (req'd by ES6)
correct test descriptions to expect ReferenceError only
enforce parsing as block statement by adding `;`
remove needless include of $FAIL.js

effectively, a rebase of all changes onto master

    Merge branch 'negative-addErrorName-work' into negative-addErrorName-bestPractice

    Merge branch 'saved-bestPractice-negative' into negative-addErrorName-work

    Conflicts:
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T2.js
    	test/suite/ch12/12.1/S12.1_A4_T1.js
    	test/suite/ch12/12.5/S12.5_A2.js

    incorporate changes made on PR branch

    re-remove added NotEarlyError

    Merge branch 'negative-addErrorName-work' into negative-addErrorName-bestPractice

    Conflicts:
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T2.js
    	test/suite/ch12/12.1/S12.1_A4_T1.js
    	test/suite/ch12/12.5/S12.5_A2.js

    ch15: correct negative regexes

    ch10: avoid use of not-NotEarlyError regex

    ch14 error regexps

    ch13 error regexps

    ch12: negative error matching

    Merge branch 'console-runner-checkError' into negative-addErrorName-work

    test262.py: check negative tests with regex

    implement checking of negative tests =>

    negative: SyntaxError

    means that /SyntaxError/ must match stderr
    or test is reported as failure

    Fixes #78

    expect real errors

    bestPractice: supply error names to negative

    pilot directory for replacing flags: [negative] with
    negative: errorname

    ch07-7.2,7.3: add error names
    ch07-rest: insert error names rest of ch07
    ch08: add expected error name
    ch11: add error name to negative
    ch12: put error name in negative

    ch13: add error name to negative
    only one test, did it manually

    ch15: add error name to negative:

    ch07: add error name to negative

    these tests used flags: \n - negative and so
    were not caught by the earlier naive grep for flags: [negative]

    --- changes suggested by @anba

    bestPractice - remove added NotEarlyError
    ch07,ch11 - expect ReferenceError (req'd by ES6)
    correct test descriptions to expect ReferenceError only
    enforce parsing as block statement by adding `;`
    remove needless include of $FAIL.js

    Merge branch 'negative-addErrorName-work' into negative-addErrorName-bestPractice

    resolved Conflicts:
    	test/suite/ch07/7.9/S7.9_A5.7_T1.js
    	test/suite/ch11/11.13/11.13.1/S11.13.1_A2.1_T3.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T1.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T10.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T11.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T2.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T3.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T4.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T5.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T6.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T7.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T8.js
    	test/suite/ch11/11.13/11.13.2/S11.13.2_A2.2_T9.js
    	test/suite/ch11/11.3/11.3.1/S11.3.1_A2.1_T3.js
    	test/suite/ch11/11.3/11.3.2/S11.3.2_A2.1_T3.js
    	test/suite/ch11/11.4/11.4.4/S11.4.4_A2.1_T3.js
    	test/suite/ch11/11.4/11.4.5/S11.4.5_A2.1_T3.js
    	test/suite/ch12/12.5/S12.5_A2.js
    	test/suite/ch12/12.6/12.6.3/S12.6.3_A4_T2.js

    negative: second half of @anba notes

    correct test descriptions to expect ReferenceError only
    enforce parse as block statement by adding `;`
    remove needless include of $FAIL.js

    ch12: specify type

    negative: @anba fixes

    bestPractice - remove added NotEarlyError
    ch07,ch11 - expect ReferenceError (req'd by ES6)

    bestPractice: supply error names to negative

    pilot directory for replacing flags: [negative] with
    negative: errorname

    ch07-7.2,7.3: add error names
    ch07-rest: insert error names rest of ch07
    ch08: add expected error name
    ch11: add error name to negative
    ch12: put error name in negative

    ch13: add error name to negative
    only one test, did it manually

    ch15: add error name to negative:

    ch07: add error name to negative

    these tests used flags: \n - negative and so
    were not caught by the earlier naive grep for flags: [negative]

    expect a SyntaxError

    ch07: add error name to negative

    these tests used flags: \n - negative and so
    were not caught by the earlier naive grep for flags: [negative]

    ch15: add error name to negative:

    ch13: add error name to negative

    only one test, did it manually

    ch12: put error name in negative

    ch11: add error name to negative

    ch08: add expected error name
    ch07-rest: insert error names rest of ch07

    ch07-7.2,7.3: add error names

    negative-errorname: pilot

    pilot directory for replacing flags: [negative] with
    negative: errorname

    bestPractice: supply error names to negative

bestPractice: supply error names to negative

pilot directory for replacing flags: [negative] with
negative: errorname

ch07-7.2,7.3: add error names
ch07-rest: insert error names rest of ch07
ch08: add expected error name
ch11: add error name to negative
ch12: put error name in negative

ch13: add error name to negative
only one test, did it manually

ch15: add error name to negative:

ch07: add error name to negative

these tests used flags: \n - negative and so
were not caught by the earlier naive grep for flags: [negative]

bestPractice: supply error names to negative

negative-errorname: pilot

pilot directory for replacing flags: [negative] with
negative: errorname

ch07-7.2,7.3: add error names

ch07-rest: insert error names rest of ch07

ch08: add expected error name

ch11: add error name to negative

ch12: put error name in negative

ch13: add error name to negative

only one test, did it manually

ch15: add error name to negative:

ch07: add error name to negative

these tests used flags: \n - negative and so
were not caught by the earlier naive grep for flags: [negative]

expect a SyntaxError

negative: @anba fixes

bestPractice - remove added NotEarlyError
ch07,ch11 - expect ReferenceError (req'd by ES6)

ch12: specify type

negative: second half of @anba notes

correct test descriptions to expect ReferenceError only
enforce parse as block statement by adding `;`
remove needless include of $FAIL.js

expect real errors

ch12: negative error matching

ch13 error regexps

ch14 error regexps

add "description" header back

remove now-unused includes

remove needless include
2014-08-13 00:19:11 +01:00
Sam Mikes 4205a1da64 harness: remove unused code
sta.js:
slight change to Test262Error() semantics; message property now always set (default "")
make $ERROR a var
set $ERROR to function $ERROR so it can be overridden if needed
remove 2009 copyright in favor of 2012 copyright
REVERTED: remove never-used fn testFailed
testFailed actually used by $FAIL
remove obsolete fn $INCLUDE

ed.js:
remove commented-out obsolete code

test262.py:
remove always-included harness file that provides no functions used by any extant test
add comment line to nonstrict

cth.js: define `print` for node, cscript

use cth (console test harness) to define functions
for console runner.  V8, Spidermonkey (js) and JavaScriptCore (jsc)
provide a function `print`.  Provide a default `print` for node
and cscript

set print_handle to 'print' by default (can still override)
for cscript: wrap tests in try/catch so we get syntax errors
2014-08-03 00:33:08 +01:00
Sam Mikes c33bf0e043 tools, harness: support new YAML frontmatter
parseTestRecord: add support for YAML frontmatter
parseTestRecord: initial unit test for test record parser
parseTestRecord: refactor for testing

factor old parsing; add YAML parsing

runner: support "includes" from YAML frontmatter

support frontmatter "includes" in python runner
use test.includes if present instead of scanning test code with regex

harness: factor individual functions out into files

tools: handle YAML errors

tolerate missing keys in dictionary (flags, includes)
report filename when empty frontmatter block
new option --list-includes to test262.py

harness: factor helper functions into separate files

sth: remove extra close-paren (syntax error)

test_common: TDD; failing parse of YAML

common: use parseTestRecord (YAML-aware)
2014-07-30 15:39:04 -07:00
Sam Mikes d4a3479a1e test262.py: only include helper scripts when needed
test262.py: only supply async helper scripts when test is async
sth.js: factor out function isAsyncTest()
timer.js: improve workaround for async tests when Promise is defined but setTimeout is noot

timer.js emulates setTimeout using Promise by doing a busy loop that checks
if `timeout` milliseconds have elapsed.  Modified check to (timeLeft > 0) instead
of (!timeLeft) to prevent infinite loop when check does not happen to run
at precise millisecond timeout expires.

Because test262.py did not support the $INCLUDE directive, some helper
scripts were added to every test -- notably testIntl, timer, and donePrintHandle
Now that $INCLUDE is supported, these can be dropped, speeding overall test run time
2014-07-21 15:15:04 +01:00
Brian Terlson 33c8399de8 Merge pull request #31 from Constellation/fix-error-code
Propagate error code when test cases are failed
2014-07-18 11:38:31 -07:00
Brian Terlson 96c6efe0ef Merge pull request #43 from smikes/initial-Promise-tests
Initial promise tests
2014-07-18 11:22:48 -07:00
smikes 7032af4db8 packager: make packager runnable
packager.py cannot run due to syntax errors in a few script files

packagerConfig: use git instead of hg
test262: use pop instead of delete to avoid throw if property missing
S22.1.2.1_T*: fix docString header comment: s/b /**
S22.1.2.1_T3: fix docString header comment: s/b /**, fix end of docstring * / => */
2014-07-18 08:53:29 +01:00
Sam Mikes 7e07cc138d async,promises: initial tests of Promises
doneprintHandle.js: make $DONE accept any falsy argument as meaning 'pass'
PromiseHelper.js: checkSequence: new helper fn for async tests
.gitignore: port .hgignore to .gitignore syntax
test262.py: support $INCLUDE directive in python test runner

S25.4.4.1*: tests to cover Section 25.4.4.1, Promise.all( iterable )
A1.1: Promise.all is callable
A1.2: Promise.all expects 1 argument
A2.1: Promise.all([]) is a Promise
A2.2: Promise.all([]) is resolved immediately
A2.3: Promise.all([]) is resolved with a new empty array
A3.1: Promise.all expects an iterable argument
2014-07-18 05:37:08 +01:00
NikSurya 9aa6b917fa Adding Support for Async Tests 2014-07-15 13:47:59 -07:00
Yusuke Suzuki d83a16f46c Propagate error code when test cases are failed 2014-03-03 03:32:26 +09:00
Prashanth Srinivasan 87605ba3b5 Bug 1472: Adding JUnit Compatible XML and Logfile support for Python test runner 2013-06-10 11:51:24 -04:00
Dan Schaffer 06879c044f Bug 1466: add test262.py parameter to set loglevel 2013-05-10 16:19:32 -04:00
Dan Schaffer 1cb9ed439f Bug 1457: fix for Windows to remove quotes in test262.py 2013-05-10 16:16:51 -04:00
Norbert Lindenberg 46359091c7 Updated test402 main page to reflect that ECMA-402 is now an approved standard.
Fixed a property access in 6.4_c so that the error message shows the correct expected value.
2012-12-17 23:49:06 -08:00
Norbert Lindenberg 1ba4238d9a Made web site packager insert line breaks into JSON files for saner diffs. 2012-09-12 15:09:36 -07:00