Compare commits

...

6 Commits

Author SHA1 Message Date
Nick Vatamaniuc
8b5422e8d8
Merge 8b43bae10b1f5d0bd714169395e8489bf68d959a into 8807fedec55bc4dbdf7b4780d36bfc4b4fd6e5e2 2025-09-23 01:07:10 +08:00
Fabrice Bellard
8807fedec5 - added Atomics.pause (bnoordhuis)
- use the pause instruction for x86 and ARM64 in Atomics.pause()
2025-09-22 18:58:18 +02:00
Fabrice Bellard
f021d7714f - added resizable array buffers (bnoordhuis)
- fixed Atomics.wait, Atomics.notify, TypedArray.prototype.lastIndexOf
- fixed JS_PreventExtensions() with resizable typed arrays
2025-09-22 18:37:41 +02:00
Fabrice Bellard
44d03a823d fixed parsing of computed property name 2025-09-22 14:48:43 +02:00
Fabrice Bellard
1e19893c82 - added ArrayBuffer.prototype.transfer (Divy Srivastava)
- fixed transfer when the ArrayBuffer was allocated with a custom allocator
2025-09-21 16:41:02 +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
9 changed files with 886 additions and 323 deletions

View File

@ -36,6 +36,10 @@ jobs:
- name: Run microbench - name: Run microbench
run: | run: |
make microbench make microbench
- name: Run test262
run: |
make test2-bootstrap
make test2
linux-lto: linux-lto:
name: Linux LTO name: Linux LTO
@ -138,6 +142,10 @@ jobs:
- name: Run built-in tests - name: Run built-in tests
run: | run: |
make test make test
- name: Run test262
run: |
make test2-bootstrap
make test2
macos-asan: macos-asan:
runs-on: macos-latest runs-on: macos-latest
@ -172,7 +180,12 @@ jobs:
- name: Build + test - name: Build + test
uses: vmactions/freebsd-vm@v1 uses: vmactions/freebsd-vm@v1
with: 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 usesh: true
copyback: false
mem: 16384
prepare: | prepare: |
pkg install -y gmake pkg install -y gmake
run: | run: |
@ -202,6 +215,10 @@ jobs:
- name: Run built-in tests - name: Run built-in tests
run: | run: |
make CONFIG_COSMO=y test make CONFIG_COSMO=y test
- name: Run test262
run: |
make test2-bootstrap
make CONFIG_COSMO=y test2
mingw-windows: mingw-windows:
name: MinGW Windows target name: MinGW Windows target

View File

@ -54,6 +54,10 @@ PREFIX?=/usr/local
# use UB sanitizer # use UB sanitizer
#CONFIG_UBSAN=y #CONFIG_UBSAN=y
# TEST262 bootstrap config: commit id and shallow "since" parameter
TEST262_COMMIT?=af3d908437b0912513a594e7167f17658e72d88b
TEST262_SINCE?=2025-09-14
OBJDIR=.obj OBJDIR=.obj
ifdef CONFIG_ASAN ifdef CONFIG_ASAN
@ -464,6 +468,15 @@ stats: qjs$(EXE)
microbench: qjs$(EXE) microbench: qjs$(EXE)
$(WINE) ./qjs$(EXE) --std tests/microbench.js $(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),) ifeq ($(wildcard test262o/tests.txt),)
test2o test2o-update: test2o test2o-update:
@echo test262o tests not installed @echo test262o tests not installed

2
TODO
View File

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

View File

@ -191,6 +191,7 @@ DEF(timed_out, "timed-out")
DEF(ok, "ok") DEF(ok, "ok")
/* */ /* */
DEF(toJSON, "toJSON") DEF(toJSON, "toJSON")
DEF(maxByteLength, "maxByteLength")
/* class names */ /* class names */
DEF(Object, "Object") DEF(Object, "Object")
DEF(Array, "Array") DEF(Array, "Array")

1003
quickjs.c

File diff suppressed because it is too large Load Diff

View File

@ -64,12 +64,12 @@ Array.prototype.flatMap
Array.prototype.includes Array.prototype.includes
Array.prototype.values Array.prototype.values
ArrayBuffer ArrayBuffer
arraybuffer-transfer=skip arraybuffer-transfer
arrow-function arrow-function
async-functions async-functions
async-iteration async-iteration
Atomics Atomics
Atomics.pause=skip Atomics.pause
Atomics.waitAsync=skip Atomics.waitAsync=skip
BigInt BigInt
caller caller
@ -116,6 +116,7 @@ for-of
generators generators
globalThis globalThis
hashbang hashbang
immutable-arraybuffer=skip
import-attributes import-attributes
import-defer=skip import-defer=skip
import.meta import.meta
@ -180,7 +181,7 @@ regexp-named-groups
regexp-unicode-property-escapes regexp-unicode-property-escapes
regexp-v-flag regexp-v-flag
RegExp.escape RegExp.escape
resizable-arraybuffer=skip resizable-arraybuffer
rest-parameters rest-parameters
Set Set
set-methods set-methods

View File

@ -5,8 +5,6 @@ test262/test/annexB/language/expressions/assignmenttargettype/callexpression-in-
test262/test/annexB/language/expressions/assignmenttargettype/callexpression-in-prefix-update.js:27: SyntaxError: invalid increment/decrement operand test262/test/annexB/language/expressions/assignmenttargettype/callexpression-in-prefix-update.js:27: SyntaxError: invalid increment/decrement operand
test262/test/annexB/language/expressions/assignmenttargettype/callexpression.js:33: SyntaxError: invalid assignment left-hand side test262/test/annexB/language/expressions/assignmenttargettype/callexpression.js:33: SyntaxError: invalid assignment left-hand side
test262/test/annexB/language/expressions/assignmenttargettype/cover-callexpression-and-asyncarrowhead.js:20: SyntaxError: invalid assignment left-hand side test262/test/annexB/language/expressions/assignmenttargettype/cover-callexpression-and-asyncarrowhead.js:20: SyntaxError: invalid assignment left-hand side
test262/test/built-ins/Atomics/notify/retrieve-length-before-index-coercion-non-shared-detached.js:34: TypeError: ArrayBuffer is detached
test262/test/built-ins/Atomics/notify/retrieve-length-before-index-coercion-non-shared-detached.js:34: strict mode: TypeError: ArrayBuffer is detached
test262/test/staging/sm/Date/UTC-convert-all-arguments.js:75: Test262Error: index 1: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true test262/test/staging/sm/Date/UTC-convert-all-arguments.js:75: Test262Error: index 1: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true
test262/test/staging/sm/Date/constructor-convert-all-arguments.js:75: Test262Error: index undefined: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true test262/test/staging/sm/Date/constructor-convert-all-arguments.js:75: Test262Error: index undefined: expected 42, got Error: didn't throw Expected SameValue(«Error: didn't throw», «42») to be true
test262/test/staging/sm/Date/non-iso.js:76: Test262Error: Expected SameValue(«NaN», «-40071559730000») to be true test262/test/staging/sm/Date/non-iso.js:76: Test262Error: Expected SameValue(«NaN», «-40071559730000») to be true
@ -26,19 +24,15 @@ test262/test/staging/sm/RegExp/regress-613820-3.js:12: Test262Error: Actual [aab
test262/test/staging/sm/RegExp/regress-613820-3.js:12: strict mode: Test262Error: Actual [aab, a, undefined, ab] and expected [aa, undefined, a, undefined] should have the same contents. test262/test/staging/sm/RegExp/regress-613820-3.js:12: strict mode: Test262Error: Actual [aab, a, undefined, ab] and expected [aa, undefined, a, undefined] should have the same contents.
test262/test/staging/sm/TypedArray/constructor-buffer-sequence.js:73: Error: Assertion failed: expected exception ExpectedError, got Error: Poisoned Value test262/test/staging/sm/TypedArray/constructor-buffer-sequence.js:73: Error: Assertion failed: expected exception ExpectedError, got Error: Poisoned Value
test262/test/staging/sm/TypedArray/prototype-constructor-identity.js:17: Test262Error: Expected SameValue(«2», «6») to be true test262/test/staging/sm/TypedArray/prototype-constructor-identity.js:17: Test262Error: Expected SameValue(«2», «6») to be true
test262/test/staging/sm/TypedArray/set-detached-bigint.js:27: Error: Assertion failed: expected exception SyntaxError, got RangeError: invalid array length
test262/test/staging/sm/TypedArray/set-detached.js:112: RangeError: invalid array length
test262/test/staging/sm/TypedArray/sort_modifications.js:12: Test262Error: Int8Array at index 0 for size 4 Expected SameValue(«0», «1») to be true test262/test/staging/sm/TypedArray/sort_modifications.js:12: Test262Error: Int8Array at index 0 for size 4 Expected SameValue(«0», «1») to be true
test262/test/staging/sm/async-functions/async-contains-unicode-escape.js:45: Error: Assertion failed: expected exception SyntaxError, no exception thrown test262/test/staging/sm/async-functions/async-contains-unicode-escape.js:45: Error: Assertion failed: expected exception SyntaxError, no exception thrown
test262/test/staging/sm/async-functions/await-error.js:12: Test262Error: Expected SameValue(«false», «true») to be true test262/test/staging/sm/async-functions/await-error.js:12: Test262Error: Expected SameValue(«false», «true») to be true
test262/test/staging/sm/async-functions/await-in-arrow-parameters.js:33: Error: Assertion failed: expected exception SyntaxError, no exception thrown - AsyncFunction:(a = (b = await/r/g) => {}) => {} test262/test/staging/sm/async-functions/await-in-arrow-parameters.js:33: Error: Assertion failed: expected exception SyntaxError, no exception thrown - AsyncFunction:(a = (b = await/r/g) => {}) => {}
test262/test/staging/sm/class/boundFunctionSubclassing.js:12: Test262Error: Expected SameValue(«false», «true») to be true test262/test/staging/sm/class/boundFunctionSubclassing.js:12: Test262Error: Expected SameValue(«false», «true») to be true
test262/test/staging/sm/class/compPropNames.js:26: Error: Expected syntax error: ({[1, 2]: 3})
test262/test/staging/sm/class/strictExecution.js:32: Error: Assertion failed: expected exception TypeError, no exception thrown test262/test/staging/sm/class/strictExecution.js:32: Error: Assertion failed: expected exception TypeError, no exception thrown
test262/test/staging/sm/class/superPropOrdering.js:83: Error: Assertion failed: expected exception TypeError, no exception thrown test262/test/staging/sm/class/superPropOrdering.js:83: Error: Assertion failed: expected exception TypeError, no exception thrown
test262/test/staging/sm/expressions/short-circuit-compound-assignment-const.js:97: TypeError: 'a' is read-only test262/test/staging/sm/expressions/short-circuit-compound-assignment-const.js:97: TypeError: 'a' is read-only
test262/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js:23: Error: Assertion failed: expected exception ReferenceError, got TypeError: 'a' is read-only test262/test/staging/sm/expressions/short-circuit-compound-assignment-tdz.js:23: Error: Assertion failed: expected exception ReferenceError, got TypeError: 'a' is read-only
test262/test/staging/sm/extensions/TypedArray-set-object-funky-length-detaches.js:55: RangeError: invalid array length
test262/test/staging/sm/generators/syntax.js:30: Error: Assertion failed: expected SyntaxError, but no exception thrown - function* g() { (function* yield() {}); } test262/test/staging/sm/generators/syntax.js:30: Error: Assertion failed: expected SyntaxError, but no exception thrown - function* g() { (function* yield() {}); }
test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-arguments.js:14: Test262Error: Expected SameValue(«"object"», «"function"») to be true test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-arguments.js:14: Test262Error: Expected SameValue(«"object"», «"function"») to be true
test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-eval.js:12: Test262Error: Expected SameValue(«"outer-gouter-geval-gtruefalseq"», «"outer-geval-gwith-gtruefalseq"») to be true test262/test/staging/sm/lexical-environment/block-scoped-functions-annex-b-eval.js:12: Test262Error: Expected SameValue(«"outer-gouter-geval-gtruefalseq"», «"outer-geval-gwith-gtruefalseq"») to be true

View File

@ -14,9 +14,9 @@ index 9828b15..4a5919d 100644
+// small: 200, +// small: 200,
+// long: 1000, +// long: 1000,
+// huge: 10000, +// huge: 10000,
+ yield: 20, + yield: 40,
+ small: 20, + small: 40,
+ long: 100, + long: 200,
+ huge: 1000, + huge: 1000,
}; };

View File

@ -115,6 +115,41 @@ function bjson_test(a)
} }
} }
function bjson_test_arraybuffer()
{
var buf, array_buffer;
array_buffer = new ArrayBuffer(4);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, false);
buf = bjson.write(array_buffer);
array_buffer = bjson.read(buf, 0, buf.byteLength);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, false);
array_buffer = new ArrayBuffer(4, {maxByteLength: 4});
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, true);
buf = bjson.write(array_buffer);
array_buffer = bjson.read(buf, 0, buf.byteLength);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 4);
assert(array_buffer.resizable, true);
array_buffer = new ArrayBuffer(4, {maxByteLength: 8});
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 8);
assert(array_buffer.resizable, true);
buf = bjson.write(array_buffer);
array_buffer = bjson.read(buf, 0, buf.byteLength);
assert(array_buffer.byteLength, 4);
assert(array_buffer.maxByteLength, 8);
assert(array_buffer.resizable, true);
}
/* test multiple references to an object including circular /* test multiple references to an object including circular
references */ references */
function bjson_test_reference() function bjson_test_reference()
@ -171,6 +206,7 @@ function bjson_test_all()
assert(e instanceof TypeError); assert(e instanceof TypeError);
} }
bjson_test_arraybuffer();
bjson_test_reference(); bjson_test_reference();
} }