Add tests for mapping behavior around device.destroy()#4295
Draft
kainino0x wants to merge 2 commits intogpuweb:mainfrom
Draft
Add tests for mapping behavior around device.destroy()#4295kainino0x wants to merge 2 commits intogpuweb:mainfrom
kainino0x wants to merge 2 commits intogpuweb:mainfrom
Conversation
kainino0x
commented
Mar 14, 2025
| async executeAfterDestroy(fn: () => void | Promise<void>, awaitLost: boolean): Promise<void> { | ||
| this.expectDeviceLost('destroyed'); | ||
|
|
||
| this.expectValidationError(fn, false); |
Collaborator
Author
There was a problem hiding this comment.
Also fix a bug where some test code was running twice unintentionally.
fn is already called below, it should not be called twice. We don't need to capture validation errors anymore because there are never any (and test teardown will check this). (Likely when this test was written, sometimes there were validation errors here.)
Collaborator
Author
|
I'll revisit this after the WG discusses gpuweb/gpuweb#5102. |
lokokung
reviewed
Mar 24, 2025
| const b1 = t.createBufferTracked({ size: 16, usage, mappedAtCreation: true }); | ||
| t.expect(b1.mapState === 'mapped', 'b1 before destroy 1'); | ||
|
|
||
| await t.executeAfterDestroy(() => { |
Contributor
There was a problem hiding this comment.
We are still pending this decision right?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test mappedAtCreation and mapAsync behavior around device.destroy(). Searching for references to
GPUDevice.destroy, I can't seem to find any other tests for this, except formap_detachwhich I've also enhanced a tiny bit here.Spec: https://gpuweb.github.io/gpuweb/#dom-gpubuffer-mapasync
This tests the behavior currently written in the spec (modulo uncertainty around gpuweb/gpuweb#5101), but the specced behavior is weird; see gpuweb/gpuweb#5102.
Also fix a bug where some test code was running twice unintentionally.
Issue: None filed except for the spec issue
Requirements for PR author:
.unimplemented()./** documented */and new helper files are found inhelper_index.txt.Requirements for reviewer sign-off:
When landing this PR, be sure to make any necessary issue status updates.