]> git.kaiwu.me - quickjs.git/commitdiff
Run test262 tests in CI
authorNick Vatamaniuc <vatamane@gmail.com>
Tue, 13 May 2025 03:35:22 +0000 (23:35 -0400)
committerNick Vatamaniuc <vatamane@gmail.com>
Mon, 29 Sep 2025 18:02:31 +0000 (14:02 -0400)
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.

.github/workflows/ci.yml
Makefile
test262.conf
tests/test262.patch

index c9ccf6249da3efd94ffd43df45c912980da4d5d5..9ee75ec46b2be4799a898cecb312c4bc0d3e9514 100644 (file)
@@ -36,6 +36,10 @@ jobs:
       - name: Run microbench
         run: |
           make microbench
+      - name: Run test262
+        run: |
+          make test2-bootstrap
+          make test2
 
   linux-lto:
     name: Linux LTO
@@ -67,6 +71,7 @@ jobs:
           submodules: true
       - name: Install gcc-multilib
         run: |
+          sudo apt update
           sudo apt install -y gcc-multilib
       - name: Build
         run: |
@@ -74,6 +79,10 @@ jobs:
       - name: Run built-in tests
         run: |
           make CONFIG_M32=y test
+      - name: Run test262
+        run: |
+          make test2-bootstrap
+          make CONFIG_M32=y test2
 
   linux-asan:
     runs-on: ubuntu-latest
@@ -138,6 +147,10 @@ jobs:
       - name: Run built-in tests
         run: |
           make test
+      - name: Run test262
+        run: |
+          make test2-bootstrap
+          make test2
 
   macos-asan:
     runs-on: macos-latest
@@ -173,6 +186,8 @@ jobs:
         uses: vmactions/freebsd-vm@v1
         with:
           usesh: true
+          copyback: false
+          mem: 16384
           prepare: |
             pkg install -y gmake
           run: |
@@ -202,6 +217,10 @@ jobs:
       - name: Run built-in tests
         run: |
           make CONFIG_COSMO=y test
+      - name: Run test262
+        run: |
+          make test2-bootstrap
+          make CONFIG_COSMO=y test2
 
   mingw-windows:
     name: MinGW Windows target
index 3b1c745947f11de9747ab2b1141a13b153b5e0d6..9dab23a1e5b00265bb250af71f3aa2c74e60f59f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,10 @@ PREFIX?=/usr/local
 # use UB sanitizer
 #CONFIG_UBSAN=y
 
+# TEST262 bootstrap config: commit id and shallow "since" parameter
+TEST262_COMMIT?=a5e69a1534de88d1eb29b76657d84c8541b72df7
+TEST262_SINCE?=2025-09-01
+
 OBJDIR=.obj
 
 ifdef CONFIG_ASAN
@@ -464,6 +468,15 @@ stats: qjs$(EXE)
 microbench: qjs$(EXE)
        $(WINE) ./qjs$(EXE) --std tests/microbench.js
 
+ifeq ($(wildcard test262/features.txt),)
+test2-bootstrap:
+       git clone --single-branch --shallow-since=$(TEST262_SINCE) https://github.com/tc39/test262.git
+       (cd test262 && git checkout -q $(TEST262_COMMIT) && patch -p1 < ../tests/test262.patch && cd ..)
+else
+test2-bootstrap:
+       (cd test262 && git fetch && git reset --hard $(TEST262_COMMIT) && patch -p1 < ../tests/test262.patch && cd ..)
+endif
+
 ifeq ($(wildcard test262o/tests.txt),)
 test2o test2o-update:
        @echo test262o tests not installed
index 892af040f6c30ff4c30e0d231a8016fdcecbc36a..73cfa9cd09395129686158deb8272c793c95ab1d 100644 (file)
@@ -116,6 +116,7 @@ for-of
 generators
 globalThis
 hashbang
+immutable-arraybuffer=skip
 import-attributes
 import-defer=skip
 import.meta
index 6956d15b1d5f1d4737d05d7a64cb72fd83f63706..e488df829245a671ac83f5e8b4e0dd59d76b59c1 100644 (file)
@@ -14,9 +14,9 @@ index 9828b15..4a5919d 100644
 +//  small: 200,
 +//  long: 1000,
 +//  huge: 10000,
-+  yield: 20,
-+  small: 20,
-+  long: 100,
++  yield: 40,
++  small: 40,
++  long: 200,
 +  huge: 1000,
  };