Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update FileAPI wpt #55194

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RedYetiDev
Copy link
Member

git node wpt FileAPI

Note one new failure:
Passing a Float16Array as element of the blobParts array should work.

Note that several tests now pass that previously failed.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Sep 30, 2024
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.40%. Comparing base (89a2f56) to head (b1c015c).
Report is 195 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55194      +/-   ##
==========================================
+ Coverage   88.39%   88.40%   +0.01%     
==========================================
  Files         652      652              
  Lines      186565   186565              
  Branches    36046    36038       -8     
==========================================
+ Hits       164916   164936      +20     
+ Misses      14908    14902       -6     
+ Partials     6741     6727      -14     

see 22 files with indirect coverage changes

@RedYetiDev RedYetiDev added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 18, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 18, 2024
@nodejs-github-bot
Copy link
Collaborator

@aduh95
Copy link
Contributor

aduh95 commented Oct 22, 2024

Seemingly related test failures:

    [EXPECTED_FAILURE][FAIL] Getters and value conversions should happen in order until an exception is thrown.
    assert_array_equals: lengths differ, expected array ["Symbol.iterator", "length getter", "length valueOf", "0 getter", "0 toString", "length getter", "length valueOf", "1 getter"] length 8, got ["Symbol.iterator", "Symbol.iterator", "length getter", "length valueOf", "0 getter", "0 toString", "length getter", "length valueOf", "1 getter"] length 9
        at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js:179:3)
        at Test.step (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/resources/testharness.js:2599:25)
        at test (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/resources/testharness.js:628:30)
        at /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js:142:1
        at Script.runInThisContext (node:vm:137:12)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    
    [PASS] ToString should be called on elements of the blobParts array and any exceptions should be propagated.
    [EXPECTED_FAILURE][FAIL] options properties should be accessed in lexicographic order.
    assert_array_equals: expected property 0 to be "endings" but got "type" (expected array ["endings", "type"] got ["type", "endings"])
        at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js:398:3)
        at Test.step (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/resources/testharness.js:2599:25)
        at test (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/resources/testharness.js:628:30)
        at /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js:386:1
        at Script.runInThisContext (node:vm:137:12)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    
    [EXPECTED_FAILURE][FAIL] Arguments should be evaluated from left to right.
    assert_unreached: type getter should not be called. Reached unreachable code
        at get type (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js:407:22)
        at new Blob (node:internal/blob:152:7)
        at /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js:404:5
        at assert_throws_exactly_impl (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/resources/testharness.js:2332:18)
        at assert_throws_exactly (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/resources/testharness.js:2319:9)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    
    [PASS] Passing 123 for options should throw
    [PASS] Passing 123.4 for options should throw
    [PASS] Passing true for options should throw
    [PASS] Passing "abc" for options should throw
    [PASS] Blob with type ""
    [PASS] Blob with type "a"
    [PASS] Blob with type "A"
    [PASS] Blob with type "text/html"
    [PASS] Blob with type "TEXT/HTML"
    [PASS] Blob with type "text/plain;charset=utf-8"
    [PASS] Blob with type "å"
    [PASS] Blob with type "𐑾"
    [PASS] Blob with type " image/gif "
    [PASS] Blob with type "\timage/gif\t"
    [PASS] Blob with type "image/gif;�"
    [PASS] Blob with type "İmage/gif"
    [PASS] Blob with type "ımage/gif"
    [PASS] Blob with type "image/gif\0"
    [PASS] Blob with type "unknown/unknown"
    [PASS] Blob with type "text/plain"
    [PASS] Blob with type "image/png"
    [PASS] A plain object with @@iterator should be treated as a sequence for the blobParts argument.
    [PASS] A plain object with @@iterator and a length property should be treated as a sequence for the blobParts argument.
    [PASS] A String object should be treated as a sequence for the blobParts argument.
    [PASS] A Uint8Array object should be treated as a sequence for the blobParts argument.
    [PASS] Changes to the blobParts array should be reflected in the returned Blob (pop).
    [PASS] Changes to the blobParts array should be reflected in the returned Blob (unshift).
    [PASS] ToString should be called on elements of the blobParts array.
    [PASS] ArrayBuffer elements of the blobParts array should be supported.
    [UNEXPECTED_FAILURE][FAIL] Passing typed arrays as elements of the blobParts array should work.
    assert_equals: expected "PASSPASSPASSPASSPASSPASSPASS" but got "PASSPASSAPSSAPSSSSAPSSAPSSAP"
        at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/support/Blob.js:16:5)
        at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    
    [EXPECTED_FAILURE][FAIL] Passing a Float16Array as element of the blobParts array should work.
    promise_test: Unhandled rejection with value: object "ReferenceError: Float16Array is not defined"
        at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    
    [UNEXPECTED_FAILURE][FAIL] Passing a Float64Array as element of the blobParts array should work.
    assert_equals: expected "PASSPASS" but got "SSAPSSAP"
        at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/support/Blob.js:16:5)
        at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    

@RedYetiDev
Copy link
Member Author

I can't reproduce the failures locally

@richardlau
Copy link
Member

Removing [EXPECTED_FAILURE] and [PASS]:

Seemingly related test failures:

    [UNEXPECTED_FAILURE][FAIL] Passing typed arrays as elements of the blobParts array should work.
    assert_equals: expected "PASSPASSPASSPASSPASSPASSPASS" but got "PASSPASSAPSSAPSSSSAPSSAPSSAP"
        at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/support/Blob.js:16:5)
        at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    
...
    
    [UNEXPECTED_FAILURE][FAIL] Passing a Float64Array as element of the blobParts array should work.
    assert_equals: expected "PASSPASS" but got "SSAPSSAP"
        at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/fixtures/wpt/FileAPI/support/Blob.js:16:5)
        at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    Command: /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/out/Release/node  /home/iojs/build/workspace/node-test-commit-aix/nodes/aix72-ppc64/test/wpt/test-blob.js 'Blob-constructor.any.js'
    

These look very much like endianness issues, especially since they're failing on AIX and LinuxONE which are both big endian platforms.

@RedYetiDev RedYetiDev marked this pull request as draft October 25, 2024 22:09
@RedYetiDev
Copy link
Member Author

I don't have a big endian machine to test this one, but it's likely, there may be a bug 🤔. Drafting until whatever this is is resolved.

@RedYetiDev RedYetiDev added wip Issues and PRs that are still a work in progress. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Oct 29, 2024
@richardlau
Copy link
Member

richardlau commented Oct 31, 2024

I don't have a big endian machine to test this one, but it's likely, there may be a bug 🤔. Drafting until whatever this is is resolved.

I think it's a bug in WPT. Taking, for example,

test_blob(function() {
return new Blob([
new Uint8Array([0x50, 0x41, 0x53, 0x53]),
new Int8Array([0x50, 0x41, 0x53, 0x53]),
new Uint16Array([0x4150, 0x5353]),
new Int16Array([0x4150, 0x5353]),
new Uint32Array([0x53534150]),
new Int32Array([0x53534150]),
new Float32Array([0xD341500000])
]);
}, {
expected: "PASSPASSPASSPASSPASSPASSPASS",
type: "",
desc: "Passing typed arrays as elements of the blobParts array should work."
});

Typed arrays are by definition

Typed arrays always use the platform's native byte order.

which means, e.g. that the bytes for new Uint16Array([0x4150, 0x5353]) will be different on little endian vs big endian platforms.

@KhafraDev
Copy link
Member

This is a bug in node. I will give some more context in a little bit.

@KhafraDev
Copy link
Member

I forgot to follow up, but here are the steps (this follows through multiple specs so I will link each one).

  1. The Blob constructor calls process blob parts.
  2. process blob parts calls get a copy of the bytes held by the buffer source
  3. which calls GetValueFromBuffer for each element in a webidl BufferSource (a TypedArray, DataView, or ArrayBuffer)
  4. which calls RawBytesToNumeric (note the isLittleEndian flag
  5. which is where we FINALLY get the step
  1. If isLittleEndian is false, reverse the order of the elements of rawBytes.

@RedYetiDev
Copy link
Member Author

Thanks for the details! I'll update these files later today, and if this is still the case, I'll open an issue in the WPT repository

@richardlau
Copy link
Member

Thanks for the details! I'll update these files later today, and if this is still the case, I'll open an issue in the WPT repository

@KhafraDev 's analysis is that this is a Node.js bug, not a WPT one.

@RedYetiDev
Copy link
Member Author

Oh, I misunderstood. Got it, keeping this is a draft until that's fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. wip Issues and PRs that are still a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants