-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tc39/test262 tests in k6 #1747
Merged
Merged
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1d2ac19
PoC tc39/test262 tests in k6
mstoykov dd14b50
Enable tc39/test262 sec-array
mstoykov f8a4b6d
Add inline comments that tc39 code is based on dop251 work
mstoykov 6ab66b9
refactor and appease the linter
mstoykov a74227a
tc39/testdata make the directory structure match the name of the test
mstoykov c5ab1f0
tc39/test262: Enable some parallel execution
mstoykov 4039c37
Revert "tc39/test262: Enable some parallel execution"
mstoykov 3d03c8b
tc39/test262: Skip Intl and annexB/language
mstoykov 38d5fc0
Enable more tests
mstoykov 0cd1e2f
tc39/test262: small optimization
mstoykov 7b15248
half tests by just running in strict mode
mstoykov 9c557fa
tc39/test262: Run only one of non/strict versions of each test
mstoykov 268565d
update breaking changes after last change
mstoykov 01a67f0
Block by path some tests
mstoykov 45d341e
change breaking test errors based on previous commit :facepalm:
mstoykov 7eb2ee8
Disable async/promise tests by path
mstoykov e883572
Disable more tests through their path
mstoykov 11aae1b
don't run any async tests and update breaking changes
mstoykov 0de5490
Update js/tc39/README.md
mstoykov 98c189f
Move the checkout in a script for easier maitnability
mstoykov bb1d4e1
Add tc39 github workflow
mstoykov 72a1bb8
Add /js/tc39/TestTC39 to .gitignore
mstoykov 91efee8
Update js/tc39/Readme.md
mstoykov 0d03288
fix the tc39 workflow
mstoykov 0e0e97e
random not js change
mstoykov cf54873
Run on every master or tag push
mstoykov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This a WIP | ||
The point of this repo is to test k6 goja+babel+core.js combo against the tc39 test suite. | ||
|
||
Ways to use it: | ||
1. run ./checkout.sh to checkout the last commit sha of [test262](https://github.com/tc39/test262) | ||
that was tested with | ||
2. Run `go test &> out.log` | ||
|
||
if there are failures there will be a JSON with what failed. | ||
The full list of failing tests is in `breaking_test_errors.json` in order to regenerate it (in case | ||
of changes) it needs to become an empty JSON object `{}` and then the test should be rerun and the | ||
new json should be put there. | ||
|
||
TODO: | ||
1. ~Enable more test currently only es5 and es6 tests are enabled but babel supports some ES2016 and | ||
ES2017~ | ||
2. disable tests that we know won't work and .. don't care | ||
3. Make this faster and better | ||
4. ~Move it to inside k6~ | ||
|
||
|
||
This is obviously a modified version of [the code in the goja | ||
repo](https://github.com/dop251/goja/blob/master/tc39_test.go) | ||
|
||
|
||
# Reasons for recording breaking_test_errors.json | ||
|
||
Unfortunately k6 doesn't pass all the test that are currently defined as "interesting" and probably | ||
won't even more. Goja decided to just not run the ones that it knows it fails currently, but this | ||
means that if they stop failing, someone needs to go re-enable these tests. This also means that, if the | ||
previous breakage was something a user can work around in a certain way, it now might be something | ||
else that the user can't workaround or have another problem. For this reasons I decided that | ||
actually recording what breaks and checking that it doesn't change is a better idea. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
sha=72154b17fc99a26e79b2586960f059360d4ce43d # this is just the commit it was last tested with | ||
mkdir -p ./TestTC39/test262 | ||
cd ./TestTC39/test262 | ||
imiric marked this conversation as resolved.
Show resolved
Hide resolved
|
||
git init | ||
git remote add origin https://github.com/tc39/test262.git | ||
git fetch origin --depth=1 "${sha}" | ||
git reset --hard "${sha}" | ||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// +build !race | ||
// Heavily influenced by the fantastic work by @dop251 for https://github.com/dop251/goja | ||
|
||
package tc39 | ||
|
||
import "testing" | ||
|
||
func (ctx *tc39TestCtx) runTest(name string, f func(t *testing.T)) { | ||
ctx.t.Run(name, func(t *testing.T) { | ||
// t.Parallel() | ||
f(t) | ||
}) | ||
} | ||
|
||
func (ctx *tc39TestCtx) flush() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// +build race | ||
// Heavily influenced by the fantastic work by @dop251 for https://github.com/dop251/goja | ||
|
||
package tc39 | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
const ( | ||
tc39MaxTestGroupSize = 1000 // to prevent race detector complaining about too many goroutines | ||
) | ||
|
||
func (ctx *tc39TestCtx) runTest(name string, f func(t *testing.T)) { | ||
ctx.testQueue = append(ctx.testQueue, tc39Test{name: name, f: f}) | ||
if len(ctx.testQueue) >= tc39MaxTestGroupSize { | ||
ctx.flush() | ||
} | ||
} | ||
|
||
func (ctx *tc39TestCtx) flush() { | ||
ctx.t.Run("tc39", func(t *testing.T) { | ||
for _, tc := range ctx.testQueue { | ||
tc := tc | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() | ||
tc.f(t) | ||
}) | ||
} | ||
}) | ||
ctx.testQueue = ctx.testQueue[:0] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to run this on every commit? We might be OK with just running them on each release (version tag), especially if they're flaky, and we should probably exclude it from the requirements for a successful build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move this to its own job, and have it run only when files in
js
were changed with https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpathsThat said, if it takes less than 10 minutes, this is probably good enough...