>>> Contribution Guidelines <<< | >>> View/Edit Test Plan <<<
Run these tests live: gpuweb.github.io/cts/standalone/
NOTE: If you are contributing tests that tentatively use GLSL instead of WGSL, develop on the glsl-dependent branch (run live at gpuweb-cts-glsl.github.io/standalone/)
The WebGPU CTS is written in TypeScript, and builds into two directories:
out/
: Built framework and test files, needed to run standalone or command line.out-wpt/
: Build directory for export into WPT. Contains WPT runner and a copy of just the needed files fromout/
.
After checking out the repository and installing node/npm, run these commands in the checkout:
npm install
npx grunt # show available grunt commands
To build and run all pre-submit checks (including type and lint checks and unittests), use:
npx grunt pre
For a quicker iterative build:
npx grunt test
To test in a browser under the standalone harness, run npx grunt serve
, then
open:
- http://localhost:8080/standalone/index.html (defaults to ?runnow=0&worker=0&debug=0&q=webgpu:)
- http://localhost:8080/standalone/index.html?runnow=1&q=unittests:
- http://localhost:8080/standalone/index.html?runnow=1&q=unittests:basic:&q=unittests:params:
To test a native WebGPU NAPI addon, build the WebGPU N-API add-on by running the
build
script in
webgpu-build and
copying the add-on to third_party/dawn/index.node.
To see debug logs in a browser, use the debug=1
query string:
To add new tests, simply imitate the pattern in neigboring tests or
neighboring files. New test files must be named ending in .spec.ts
.
For an example test file, see src/webgpu/examples.spec.ts
.
Since this project is written in TypeScript, it integrates best with Visual
Studio Code. There are also some default settings (in .vscode/settings.json
)
which will be applied automatically.
Before uploading, you should run pre-submit checks (grunt pre
).
Be sure to read CONTRIBUTING.md.
Copy (or symlink) the out-wpt/
directory as the webgpu/
directory in your
WPT checkout.