Skip to content

Commit 6960dd5

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 bb986e5 commit 6960dd5

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ PREFIX?=/usr/local
5454
# use UB sanitizer
5555
#CONFIG_UBSAN=y
5656

57+
# TEST262 bootstrap config: commit id and shallow "since" parameter
58+
TEST262_COMMIT?=3316c0aaf676d657f5a6b33364fa7e579c78ac7f
59+
TEST262_SINCE?=2025-05-21
60+
5761
OBJDIR=.obj
5862

5963
ifdef CONFIG_ASAN
@@ -464,6 +468,10 @@ stats: qjs$(EXE)
464468
microbench: qjs$(EXE)
465469
$(WINE) ./qjs$(EXE) --std tests/microbench.js
466470

471+
test2-bootstrap:
472+
git clone --single-branch --shallow-since=$(TEST262_SINCE) https://github.com/tc39/test262.git
473+
(cd test262 && git checkout -q $(TEST262_COMMIT) && patch -p1 < ../tests/test262.patch && cd ..)
474+
467475
ifeq ($(wildcard test262o/tests.txt),)
468476
test2o test2o-update:
469477
@echo test262o tests not installed

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)