Skip to content

Commit 24e9e37

Browse files
committed
Run test262 tests in CI
Run test262 tests for Linux, macOS and Cosmopolitan Add a Makefile `test2-bootstrap` helper to clone and patch test262 tests at a particular commit. Running with the latest commit noticed a few tests were failing and added them to the errors list. Noticed a few flaky staging math tests (acosh and cbrt) and made a PR to test262 to fix those. The CI environment, especially for macOS, was a bit more unpredictable and was failing in atomics tests due to lower timeouts in the `atomicsHelper` so double the timeouts. The time didn't worsen too much. It still takes about 2-3 min.
1 parent 9bce51e commit 24e9e37

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ jobs:
3636
- name: Run microbench
3737
run: |
3838
make microbench
39+
- name: Run test262
40+
run: |
41+
make test2-bootstrap
42+
make test2
3943
4044
linux-lto:
4145
name: Linux LTO
@@ -138,6 +142,10 @@ jobs:
138142
- name: Run built-in tests
139143
run: |
140144
make test
145+
- name: Run test262
146+
run: |
147+
make test2-bootstrap
148+
make test2
141149
142150
macos-asan:
143151
runs-on: macos-latest
@@ -202,6 +210,10 @@ jobs:
202210
- name: Run built-in tests
203211
run: |
204212
make CONFIG_COSMO=y test
213+
- name: Run test262
214+
run: |
215+
make test2-bootstrap
216+
make CONFIG_COSMO=y test2
205217
206218
mingw-windows:
207219
name: MinGW Windows target
@@ -258,7 +270,6 @@ jobs:
258270
run: |
259271
make microbench
260272
261-
262273
qemu-alpine:
263274
runs-on: ubuntu-latest
264275

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ stats: qjs$(EXE)
464464
microbench: qjs$(EXE)
465465
$(WINE) ./qjs$(EXE) --std tests/microbench.js
466466

467+
TEST262_COMMIT?=c6251c64b10800c53cc535adbedd92674dc87806
468+
469+
test2-bootstrap:
470+
git clone --single-branch --shallow-since=2025-05-12 https://github.com/tc39/test262.git
471+
(cd test262 && git checkout -q $(TEST262_COMMIT) && patch -p1 < ../tests/test262.patch && cd ..)
472+
467473
ifeq ($(wildcard test262o/tests.txt),)
468474
test2o test2o-update:
469475
@echo test262o tests not installed

test262.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ Uint32Array
230230
Uint8Array
231231
uint8array-base64=skip
232232
Uint8ClampedArray
233+
upsert=skip
233234
WeakMap
234235
WeakRef
235236
WeakSet

test262_errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
test262/test/built-ins/Atomics/notify/retrieve-length-before-index-coercion-non-shared-detached.js:34: TypeError: ArrayBuffer is detached
2+
test262/test/built-ins/Atomics/notify/retrieve-length-before-index-coercion-non-shared-detached.js:34: strict mode: TypeError: ArrayBuffer is detached
3+
test262/test/harness/verifyProperty-value-error.js:33: Error: The error thrown did not define the specified message
4+
test262/test/harness/verifyProperty-value-error.js:33: strict mode: Error: The error thrown did not define the specified message
15
test262/test/language/module-code/top-level-await/module-graphs-does-not-hang.js:10: TypeError: $DONE() not called
26
test262/test/staging/sm/Date/UTC-convert-all-arguments.js:75: Test262Error: index 1: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true
37
test262/test/staging/sm/Date/constructor-convert-all-arguments.js:75: Test262Error: index undefined: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true
@@ -12,7 +16,6 @@ test262/test/staging/sm/Function/function-toString-builtin.js:14: Test262Error:
1216
}' Expected SameValue(«null», «null») to be false
1317
test262/test/staging/sm/Function/implicit-this-in-parameter-expression.js:13: Test262Error: Expected SameValue(«[object Object]», «undefined») to be true
1418
test262/test/staging/sm/Function/invalid-parameter-list.js:35: Error: Assertion failed: expected exception SyntaxError, no exception thrown
15-
test262/test/staging/sm/Math/cbrt-approx.js:26: Error: got 1.39561242508609, expected a number near 1.3956124250860895 (relative error: 2)
1619
test262/test/staging/sm/RegExp/constructor-ordering-2.js:15: Test262Error: Expected SameValue(«false», «true») to be true
1720
test262/test/staging/sm/RegExp/regress-613820-1.js:13: Test262Error: Expected SameValue(«"aaa"», «"aa"») to be true
1821
test262/test/staging/sm/RegExp/regress-613820-2.js:13: Test262Error: Expected SameValue(«"f"», «undefined») to be true

tests/test262.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ index 9828b15..4a5919d 100644
1414
+// small: 200,
1515
+// long: 1000,
1616
+// huge: 10000,
17-
+ yield: 20,
18-
+ small: 20,
19-
+ long: 100,
17+
+ yield: 40,
18+
+ small: 40,
19+
+ long: 200,
2020
+ huge: 1000,
2121
};
2222

0 commit comments

Comments
 (0)