Skip to content

quickjs test suite fails on 32-bit systems due to size mismatches within time_t or related internal structs. #986

Open
@Ashvith10

Description

@Ashvith10

While building for i686-linux locally on x86_64-linux:

$ ./pre-inst-env guix build --no-grafts quickjs-ng -s i686-linux
...
starting phase `check'
../build/run-test262 -c tests.conf
Result: 0/33 errors, 4 excluded
tests/test_builtin.js:690: Error: assertion failed: got |29256|, expected |29312| (order of operations / precision in MakeTime)

Activity

saghul

saghul commented on Mar 19, 2025

@saghul
Contributor

If you are building for i686 how are they being ran on x86_64?

Ashvith10

Ashvith10 commented on Mar 19, 2025

@Ashvith10
Author

If you are building for i686 how are they being ran on x86_64?

@saghul Guix has a documentation on this section - Native Builds - taking x86_64 as the host architecture and i686 as the target architecture in the example.

The test results for a select few system are available here.

There's also a comment left out at:

// TODO: Fix rounding errors on Windows/Cygwin.
if (!['win32', 'cygwin'].includes(os.platform)) {
// from test262/test/built-ins/Date/UTC/fp-evaluation-order.js
assert(Date.UTC(1970, 0, 1, 80063993375, 29, 1, -288230376151711740), 29312,

Platform is "linux" in this case and that is why it continues into the assertion and then fails.

Ashvith10

Ashvith10 commented on Mar 19, 2025

@Ashvith10
Author

@saghul I've tried the flag-mpc64, but as it turns out, it fails later for the tests in run-test262 -m -c test262.conf -c test262-fast.conf -a

../build/run-test262 -m -c test262.conf -c test262-fast.conf -a
Result: 93/78324 errors, 3772 excluded, 5387 skipped, 10 new
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Atomics/pause/returns-undefined.js:22: unexpected error: TypeError: not an integral number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Atomics/pause/returns-undefined.js:22: strict mode: unexpected error: TypeError: not an integral number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum.js:11: unexpected error: TypeError: not a number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum.js:11: strict mode: unexpected error: TypeError: not a number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum-is-minus-zero.js:11: unexpected error: TypeError: not a number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum-is-minus-zero.js:11: strict mode: unexpected error: TypeError: not a number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum-is-NaN.js:10: unexpected error: TypeError: not a number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum-is-NaN.js:10: strict mode: unexpected error: TypeError: not a number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum-is-infinite.js:10: unexpected error: TypeError: not a number
/gnu/store/xqspqb4dk8fwfz7dv82lpihyc7c2w1jq-test262/test/built-ins/Math/sumPrecise/sum-is-infinite.js:10: strict mode: unexpected error: TypeError: not a number

Average memory statistics for 78324 tests:

QuickJS-ng memory usage -- 0.9.0 version, 32-bit, Little Endian, malloc limit: 0

NAME                    COUNT     SIZE
memory allocated         1128    82803  (73.4 per block)
memory used              1140    65743  (8 overhead, 15.0 average slack)
atoms                     603    23714  (39.3 per atom)
objects                   199     7973  (40.1 per object)
  properties             1011     8919  (5.1 per object)
  shapes                   71    14195  (199.9 per shape)
bytecode functions         14     6378
  bytecode                 14     1079  (77.1 per function)
  pc2line                  13      240  (18.5 per function)
C functions               118
arrays                      1
  fast arrays               1
  elements                  2       16  (2.0 per fast array)

make: *** [Makefile:129: test262-fast] Error 1
Ashvith10

Ashvith10 commented on Mar 20, 2025

@Ashvith10
Author

After a little digging, I came across this. Maybe time will have to be handled depending on the system, as written in this SO page?

bnoordhuis

bnoordhuis commented on Mar 20, 2025

@bnoordhuis
Contributor

Can you check if the patch below fixes the sumPrecise errors for you?

diff --git a/quickjs.c b/quickjs.c
index 287194d..a4a7884 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -43239,7 +43239,7 @@ static JSValue js_math_sumPrecise(JSContext *ctx, JSValueConst this_val,
             goto fail;
         if (done)
             break; // item == JS_UNDEFINED
-        switch (JS_VALUE_GET_TAG(item)) {
+        switch (JS_VALUE_GET_NORM_TAG(item)) {
         default:
             JS_FreeValue(ctx, item);
             JS_ThrowTypeError(ctx, "not a number");
changed the title [-]Assertion error while building for i686-linux[/-] [+]quickjs test suite fails on 32-bit systems due to size mismatches within `time_t` or related internal structs.[/+] on Mar 28, 2025
saghul

saghul commented on Apr 28, 2025

@saghul
Contributor

Ping?

Ashvith10

Ashvith10 commented on Apr 28, 2025

@Ashvith10
Author

@saghul @bnoordhuis kindly ignore the previous comment - I've removed it as it was misleading. I've tried the patch, but the flags were incorrect, and it kept building for x86_64.

All I know from playing around the repo is that something related to JSValue's NaN boxing may be causing this issue.

Since this is beyond my expertise, unfortunately, I'll not be pursuing this issue anymore - but I'll leave it here in the open for anyone else who may be able to resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bnoordhuis@saghul@Ashvith10

        Issue actions

          quickjs test suite fails on 32-bit systems due to size mismatches within `time_t` or related internal structs. · Issue #986 · quickjs-ng/quickjs