Skip to content

Commit bf0105a

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 f10ef29 commit bf0105a

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
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

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?=4b5d36ab6ef2f59d0a8902cd383762547a3a74c4
468+
469+
test2-bootstrap:
470+
git clone --single-branch --shallow-since=2025-05-16 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
@@ -228,6 +228,7 @@ Uint32Array
228228
Uint8Array
229229
uint8array-base64=skip
230230
Uint8ClampedArray
231+
upsert=skip
231232
WeakMap
232233
WeakRef
233234
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/built-ins/RegExp/property-escapes/special-property-value-Script_Extensions-Unknown.js:14: SyntaxError: unknown unicode script
4+
test262/test/built-ins/RegExp/property-escapes/special-property-value-Script_Extensions-Unknown.js:14: strict mode: SyntaxError: unknown unicode script
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)