mirror-webgpu-cts/src/webgpu/api/validation/queue_submit.spec.ts
Kai Ninomiya 9cbb800a96
Make test cases hierarchical, and refactor/cleanup a lot in the process (#181)
* update tests, approximately

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* unittests:loading:* now passes

* passes 63 unittests, but not all are running...

* typechecks!!

* 58 unittests passing

* reenable getStackTrace tests

* wip

* finally all tests and checks pass!

* fixups

* wip

* replace all spaces with underscores in test names

* wip

* wip

* wip

* Dissolve TestLoader (now just use DefaultTestFileLoader)

* tighten ParamSpec type

* rename ParamSpec -> CaseParams

* make kParamSeparator ";", now standalone runner is working!

* add separate icon for leaf run buttons

* file renames

* remove user-select:all (not really needed anymore, triple click works fine now)

* cleanup some tests, add tests for test queries

* split interface for defining and running TestGroups

* more cleanup, fix URL encoding stuff, and standalone HTML

* fix readmes for parents of query

* clean up unused ReadmeFile interface

* dissolve id.ts

* test_suite_listing.ts

* split params_utils into param_utils + stringify_params

* rename encodeURLSelectively again

* add query.isMulti{File,Test,Case}

* fix gen_wpt_cts_html (at least for the simple mode; advanced mode probably still broken

* better run-one icon

* standalone: always make the url bar show the complete url

* revert tasks.json

* fix number out of bounds

* don't drop worker results, report input string on all query parse errors

* update docs/terms.md

* revisions

* more revisions

* make comparePublicParamsPaths order-agnostic (now allows queries against params out of order, but tree will not reorder itself accordingly)

* revise compareQueries, part 1

* revise compareQueries, part 2: compareOneLevel

* remove incorrect comment

* undo fast-glob dependency

* address Austin's comments

* address comments

* pass debug flag into test worker

* typo fixes
2020-05-18 15:33:41 -07:00

42 lines
1.2 KiB
TypeScript

export const description = `
queue submit validation tests.
`;
import { makeTestGroup } from '../../../common/framework/test_group.js';
import { ValidationTest } from './validation_test.js';
export const g = makeTestGroup(ValidationTest);
g.test('submitting_with_a_mapped_buffer_is_disallowed').fn(async t => {
const buffer = t.device.createBuffer({
size: 4,
usage: GPUBufferUsage.MAP_WRITE | GPUBufferUsage.COPY_SRC,
});
const targetBuffer = t.device.createBuffer({
size: 4,
usage: GPUBufferUsage.COPY_DST,
});
const getCommandBuffer = (): GPUCommandBuffer => {
const commandEncoder = t.device.createCommandEncoder();
commandEncoder.copyBufferToBuffer(buffer, 0, targetBuffer, 0, 4);
return commandEncoder.finish();
};
// Submitting when the buffer has never been mapped should succeed
t.queue.submit([getCommandBuffer()]);
// Map the buffer, submitting when the buffer is mapped should fail
await buffer.mapWriteAsync();
t.queue.submit([]);
t.expectValidationError(() => {
t.queue.submit([getCommandBuffer()]);
});
// Unmap the buffer, queue submit should succeed
buffer.unmap();
t.queue.submit([getCommandBuffer()]);
});