Skip to content

Commit 42e7c2b

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 42e7c2b

File tree

4 files changed

+49
-17
lines changed

4 files changed

+49
-17
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525
with:
2626
submodules: true
2727
- name: Build
@@ -36,14 +36,18 @@ 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
4246
runs-on: ubuntu-latest
4347
strategy:
4448
fail-fast: false
4549
steps:
46-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
4751
with:
4852
submodules: true
4953
- name: Build
@@ -62,11 +66,12 @@ jobs:
6266
strategy:
6367
fail-fast: false
6468
steps:
65-
- uses: actions/checkout@v4
69+
- uses: actions/checkout@v5
6670
with:
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: |
@@ -78,7 +83,7 @@ jobs:
7883
linux-asan:
7984
runs-on: ubuntu-latest
8085
steps:
81-
- uses: actions/checkout@v4
86+
- uses: actions/checkout@v5
8287
with:
8388
submodules: true
8489
- name: Build
@@ -93,7 +98,7 @@ jobs:
9398
linux-msan:
9499
runs-on: ubuntu-latest
95100
steps:
96-
- uses: actions/checkout@v4
101+
- uses: actions/checkout@v5
97102
with:
98103
submodules: true
99104
- name: Build
@@ -110,7 +115,7 @@ jobs:
110115
linux-ubsan:
111116
runs-on: ubuntu-latest
112117
steps:
113-
- uses: actions/checkout@v4
118+
- uses: actions/checkout@v5
114119
with:
115120
submodules: true
116121
- name: Build
@@ -128,7 +133,7 @@ jobs:
128133
strategy:
129134
fail-fast: false
130135
steps:
131-
- uses: actions/checkout@v4
136+
- uses: actions/checkout@v5
132137
- name: Build
133138
run: |
134139
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y
@@ -138,11 +143,15 @@ 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
144153
steps:
145-
- uses: actions/checkout@v4
154+
- uses: actions/checkout@v5
146155
- name: Build
147156
run: |
148157
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_ASAN=y
@@ -155,7 +164,7 @@ jobs:
155164
macos-ubsan:
156165
runs-on: macos-latest
157166
steps:
158-
- uses: actions/checkout@v4
167+
- uses: actions/checkout@v5
159168
- name: Build
160169
run: |
161170
make -j$(getconf _NPROCESSORS_ONLN) CONFIG_WERROR=y CONFIG_UBSAN=y
@@ -168,11 +177,16 @@ jobs:
168177
freebsd:
169178
runs-on: ubuntu-latest
170179
steps:
171-
- uses: actions/checkout@v4
180+
- uses: actions/checkout@v5
172181
- name: Build + test
173182
uses: vmactions/freebsd-vm@v1
174183
with:
184+
# This VM has a tendency to get stuck in the "VM is booting" cycle
185+
# for quite a while, so set a shorter timeout
186+
timeout-minutes: 15
175187
usesh: true
188+
copyback: false
189+
mem: 16384
176190
prepare: |
177191
pkg install -y gmake
178192
run: |
@@ -186,7 +200,7 @@ jobs:
186200
strategy:
187201
fail-fast: false
188202
steps:
189-
- uses: actions/checkout@v4
203+
- uses: actions/checkout@v5
190204
with:
191205
submodules: true
192206
- name: Install Cosmopolitan
@@ -202,14 +216,18 @@ jobs:
202216
- name: Run built-in tests
203217
run: |
204218
make CONFIG_COSMO=y test
219+
- name: Run test262
220+
run: |
221+
make test2-bootstrap
222+
make CONFIG_COSMO=y test2
205223
206224
mingw-windows:
207225
name: MinGW Windows target
208226
runs-on: ubuntu-latest
209227
strategy:
210228
fail-fast: false
211229
steps:
212-
- uses: actions/checkout@v4
230+
- uses: actions/checkout@v5
213231
with:
214232
submodules: true
215233
- name: Install MinGW and Wine
@@ -240,7 +258,7 @@ jobs:
240258
run:
241259
shell: msys2 {0}
242260
steps:
243-
- uses: actions/checkout@v4
261+
- uses: actions/checkout@v5
244262
- uses: msys2/setup-msys2@v2
245263
with:
246264
msystem: UCRT64
@@ -276,7 +294,7 @@ jobs:
276294
- linux/ppc64le
277295

278296
steps:
279-
- uses: actions/checkout@v4
297+
- uses: actions/checkout@v5
280298
with:
281299
submodules: recursive
282300
- name: Get qemu

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)