Skip to content

Commit 44d52ea

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 638ec8c commit 44d52ea

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

.github/workflows/ci.yml

Lines changed: 18 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
@@ -172,7 +180,12 @@ jobs:
172180
- name: Build + test
173181
uses: vmactions/freebsd-vm@v1
174182
with:
183+
# This VM has a tendency to get stuck in the "VM is booting" cycle
184+
# for quite a while, so set a shorter timeout
185+
timeout-minutes: 15
175186
usesh: true
187+
copyback: false
188+
mem: 16384
176189
prepare: |
177190
pkg install -y gmake
178191
run: |
@@ -202,6 +215,10 @@ jobs:
202215
- name: Run built-in tests
203216
run: |
204217
make CONFIG_COSMO=y test
218+
- name: Run test262
219+
run: |
220+
make test2-bootstrap
221+
make CONFIG_COSMO=y test2
205222
206223
mingw-windows:
207224
name: MinGW Windows target
@@ -214,6 +231,7 @@ jobs:
214231
submodules: true
215232
- name: Install MinGW and Wine
216233
run: |
234+
sudo apt update
217235
sudo apt install -y wine mingw-w64
218236
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll .
219237
- name: Setup Wine

Makefile

Lines changed: 13 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,15 @@ stats: qjs$(EXE)
464468
microbench: qjs$(EXE)
465469
$(WINE) ./qjs$(EXE) --std tests/microbench.js
466470

471+
ifeq ($(wildcard test262/features.txt),)
472+
test2-bootstrap:
473+
git clone --single-branch --shallow-since=$(TEST262_SINCE) https://github.com/tc39/test262.git
474+
(cd test262 && git checkout -q $(TEST262_COMMIT) && patch -p1 < ../tests/test262.patch && cd ..)
475+
else
476+
test2-bootstrap:
477+
(cd test262 && git fetch && git reset --hard $(TEST262_COMMIT) && patch -p1 < ../tests/test262.patch && cd ..)
478+
endif
479+
467480
ifeq ($(wildcard test262o/tests.txt),)
468481
test2o test2o-update:
469482
@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)