Skip to content

Commit 0df111b

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. 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 8807fed commit 0df111b

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

.github/workflows/ci.yml

Lines changed: 15 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
@@ -67,6 +71,7 @@ jobs:
6771
submodules: true
6872
- name: Install gcc-multilib
6973
run: |
74+
sudo apt update
7075
sudo apt install -y gcc-multilib
7176
- name: Build
7277
run: |
@@ -138,6 +143,10 @@ jobs:
138143
- name: Run built-in tests
139144
run: |
140145
make test
146+
- name: Run test262
147+
run: |
148+
make test2-bootstrap
149+
make test2
141150
142151
macos-asan:
143152
runs-on: macos-latest
@@ -173,6 +182,8 @@ jobs:
173182
uses: vmactions/freebsd-vm@v1
174183
with:
175184
usesh: true
185+
copyback: false
186+
mem: 16384
176187
prepare: |
177188
pkg install -y gmake
178189
run: |
@@ -202,6 +213,10 @@ jobs:
202213
- name: Run built-in tests
203214
run: |
204215
make CONFIG_COSMO=y test
216+
- name: Run test262
217+
run: |
218+
make test2-bootstrap
219+
make CONFIG_COSMO=y test2
205220
206221
mingw-windows:
207222
name: MinGW Windows target

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?=af3d908437b0912513a594e7167f17658e72d88b
59+
TEST262_SINCE?=2025-09-14
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

test262.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ for-of
116116
generators
117117
globalThis
118118
hashbang
119+
immutable-arraybuffer=skip
119120
import-attributes
120121
import-defer=skip
121122
import.meta

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)