Compare commits

...

11 Commits

Author SHA1 Message Date
Nick Vatamaniuc
3bab404ff1
Merge 8b43bae10b1f5d0bd714169395e8489bf68d959a into 2d99c323a27ca9013230cfd6fb56ab37f2a0f1d4 2025-09-21 01:39:25 +08:00
Fabrice Bellard
2d99c323a2 Iterator functions:
- removed memory leak
- don't close iterator when IteratorStepValue fails
- fixed  Iterator Wrap next() and return() arguments
- fixed Iterator.from()
2025-09-20 18:30:02 +02:00
Fabrice Bellard
cf0e179263 Iterator is an abstract class (bnoordhuis) 2025-09-20 17:05:13 +02:00
Fabrice Bellard
3dcca0d1d6 fix Iterator.prototype.constructor (initial patch by bnoordhuis) 2025-09-20 17:01:52 +02:00
Fabrice Bellard
b2ed2e91f5 added Iterator.prototype.[drop,filter,flatMap,map,take,every,find,forEach,some,reduce,[Symbol.toStringTag]] (saghul) 2025-09-20 16:47:43 +02:00
Fabrice Bellard
e924173c0f added Iterator.prototype.toArray and Iterator.from (bnoordhuis) 2025-09-20 16:27:45 +02:00
Fabrice Bellard
982b7aa14f added the Iterator object 2025-09-20 16:05:36 +02:00
Fabrice Bellard
0377dab4f2 removed uninitialized values - removed useless init 2025-09-20 14:31:14 +02:00
Fabrice Bellard
0cef7f0ddb set methods: removed memory leaks - fixed ordering of property access - fixed conversion to integer of 'size' in GetSetRecord() - added missing iterator close - factorized code 2025-09-20 14:21:39 +02:00
Fabrice Bellard
a1e073e444 added set methods (bnoordhuis) 2025-09-20 12:19:50 +02:00
Nick Vatamaniuc
8b43bae10b
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.
2025-09-17 18:46:55 -04:00
7 changed files with 1555 additions and 39 deletions

View 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
@ -138,6 +142,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
@ -172,7 +180,12 @@ jobs:
- name: Build + test
uses: vmactions/freebsd-vm@v1
with:
# This VM has a tendency to get stuck in the "VM is booting" cycle
# for quite a while, so set a shorter timeout
timeout-minutes: 15
usesh: true
copyback: false
mem: 16384
prepare: |
pkg install -y gmake
run: |
@ -202,6 +215,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

View File

@ -54,6 +54,10 @@ PREFIX?=/usr/local
# use UB sanitizer
#CONFIG_UBSAN=y
# TEST262 bootstrap config: commit id and shallow "since" parameter
TEST262_COMMIT?=af3d908437b0912513a594e7167f17658e72d88b
TEST262_SINCE?=2025-09-14
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

2
TODO
View File

@ -62,5 +62,5 @@ Optimization ideas:
Test262o: 0/11262 errors, 463 excluded
Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch)
Result: 54/79414 errors, 1637 excluded, 6821 skipped
Result: 54/80760 errors, 1631 excluded, 6064 skipped
Test262 commit: e7e136756cd67c1ffcf7c09d03aeb8ad5a6cec0c

View File

@ -78,6 +78,8 @@ DEF(await, "await")
/* empty string */
DEF(empty_string, "")
/* identifiers */
DEF(keys, "keys")
DEF(size, "size")
DEF(length, "length")
DEF(fileName, "fileName")
DEF(lineNumber, "lineNumber")
@ -228,6 +230,9 @@ DEF(Map, "Map")
DEF(Set, "Set") /* Map + 1 */
DEF(WeakMap, "WeakMap") /* Map + 2 */
DEF(WeakSet, "WeakSet") /* Map + 3 */
DEF(Iterator, "Iterator")
DEF(IteratorHelper, "Iterator Helper")
DEF(IteratorWrap, "Iterator Wrap")
DEF(Map_Iterator, "Map Iterator")
DEF(Set_Iterator, "Set Iterator")
DEF(Array_Iterator, "Array Iterator")

1536
quickjs.c

File diff suppressed because it is too large Load Diff

View File

@ -116,6 +116,7 @@ for-of
generators
globalThis
hashbang
immutable-arraybuffer=skip
import-attributes
import-defer=skip
import.meta
@ -140,7 +141,7 @@ Intl.NumberFormat-v3=skip
Intl.RelativeTimeFormat=skip
Intl.Segmenter=skip
IsHTMLDDA
iterator-helpers=skip
iterator-helpers
iterator-sequencing=skip
json-modules
json-parse-with-source=skip
@ -183,7 +184,7 @@ RegExp.escape
resizable-arraybuffer=skip
rest-parameters
Set
set-methods=skip
set-methods
ShadowRealm=skip
SharedArrayBuffer
source-phase-imports-module-source=skip
@ -304,14 +305,10 @@ test262/test/built-ins/String/prototype/split/cstm-split-on-string-primitive.js
# spec updates it in this case)
test262/test/staging/sm/Array/frozen-dense-array.js
# does not match spec
test262/test/staging/sm/Iterator/from/wrap-next-not-object-throws.js
# not supported
test262/test/staging/sm/Set/difference.js
test262/test/staging/sm/Set/intersection.js
test262/test/staging/sm/Set/is-disjoint-from.js
test262/test/staging/sm/Set/is-subset-of.js
test262/test/staging/sm/Set/is-superset-of.js
test262/test/staging/sm/Set/symmetric-difference.js
test262/test/staging/sm/Set/union.js
test262/test/staging/sm/extensions/censor-strict-caller.js
test262/test/staging/sm/JSON/parse-with-source.js

View 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,
};