Run CTS test suites and investigate failures
When working on a category of CTS tests, follow this systematic process to identify issues, prioritize fixes, and document findings.
List all the tests matching a selector:
cargo xtask cts -- --list 'webgpu:api,validation,*' 2>&1 | wc -l
If there is a reasonable number of tests matching the selector (less than a couple hundred or so, but this isn't a hard cutoff), then you can proceed with triage. Otherwise, make a list of more detailed wildcards that match fewer tests, verify that each wildcard matches a reasonable number of tests, and triage each wildcard separately.
Run the full test suite for the category to understand the scope:
cargo xtask cts 'webgpu:api,validation,category:*' 2>&1 | grep -E "(Summary|Passed|Failed)" | tail -5
This gives you the pass rate and number of failures. Document this as your baseline.
Review the output from the running the CTS (with or without --list) to
identify any subcategories that may exist within the suite being analyzed.
Subcategories typically have an additional :- or ,-delimited word in the
test name. Running tests by subcategory may be more manageable than running
with the entire suite at once or running individual tests.
Test each subcategory individually to identify which ones are passing vs failing:
cargo xtask cts 'webgpu:api,validation,category:subcategory:*' 2>&1 | grep -E "(Passed|Failed|Skipped)" | tail -3
Track the pass rate for each subcategory. This helps you identify:
For failing subcategories, look at what tests are failing:
cargo xtask cts 'webgpu:api,validation,category:subcategory:*' 2>&1 | grep "\[fail\]" | head -20
Look for patterns:
Pick a representative failing test and run it individually to see the error:
cargo xtask cts 'webgpu:api,validation,category:subcategory:specific_test' 2>&1 | tail -30
Look for:
To understand what the test expects, read the TypeScript source:
grep -A 40 "test_name" cts/src/webgpu/api/validation/path/file.spec.ts
The test source shows:
Group failures into categories:
High Priority - Validation Gaps:
Medium Priority - Spec Compliance:
Low Priority - Minor Gaps:
Known Issues - Skip:
For validation gaps, find where validation should happen:
Search for existing validation:
grep -n "relevant_keyword" wgpu-core/src/device/resource.rs
Look for render/compute pipeline creation:
wgpu-core/src/device/resource.rs around create_render_pipelineCheck for helper functions:
grep "fn is_" wgpu-types/src/texture/format.rs
Find error enums:
grep "pub enum.*Error" wgpu-core/src/pipeline.rs
When implementing fixes:
wgpu-core/src/pipeline.rs)wgpu-types if checking properties)wgpu-core/src/device/resource.rs)Create or update a triage document (e.g., category_triage.md).
Do not write information about changes you have made to the triage document. Only capture the state of the tests and any investigation into open issues.
# Category CTS Tests - Triage Report
**Overall Status:** XP/YF/ZS (%/%/%)
## Passing Sub-suites ✅
[List sub-suites that have no failures (all pass or skip)]
## Remaining Issues ⚠️
[List sub-suites that have failures and if it can be stated concisely, a summary of the issue]
## Issue Detail
[List detail of any investigation into failures. Do not go into detail about passed suites, just list the failures.]
### 1. title, e.g. a distinguishing word from the test selector
**Test selector:** `webgpu:api,validation,render_pipeline,depth_stencil_state:format:*`
**What it tests:** [Description]
**Example failure:**
[a selector for a single failing test, e.g.:]
```
webgpu:api,validation,render_pipeline,depth_stencil_state:depthCompare_optional:isAsync=false;format="stencil8"
```
**Error:**
[error message from the failing tests, e.g.:]
```
Unexpected validation error occurred: Depth/stencil state is invalid:
Format Stencil8 does not have a depth aspect, but depth test/write is enabled
```
**Root cause:**
[Your analysis of the root cause. Do not speculate. Only include the results of specific investigation you have done.]
The validation is triggering incorrectly. When `depthCompare` is undefined/missing in JavaScript, it's getting translated to a default value that makes `is_depth_enabled()` return true, even for stencil-only formats.
**Fix needed:**
[Your proposed fix. Again, do not speculate. Only state the fix if it is obvious from the root cause analysis, or if you have done specific investigation into how to fix it.]
### 2. title
[repeat as needed for additional issues]
The result lists have these purposes:
cts_runner/test.lst contains sets of tests with no failures. It is not an
exhaustive list of passing sets of tests.cts_runner/fail.lst contains sets of tests with failures. A comment can record
the pass rate, especially when the pass rate is high.cts_runner/skip.lst contains sets of tests in which at least 90% of the tests
are skipped.If you fix a set of tests, add it to cts_runner/test.lst only when all of its
tests pass or skip. Do not add a set of tests that has any failures.
Use wildcards to minimize the number of selectors:
webgpu:api,validation,category:subcategory:isAsync=false;*
Use a higher-level wildcard only when all tests that it matches belong in the same result list. Do not use a wildcard that also matches tests from another result list.
Keep the selectors in the order that the lst_files_are_sorted integration
test requires. This rule also applies to selectors in comments.
Before finishing:
# Format code
cargo fmt
# Check for errors
cargo clippy --tests
# Build to ensure no compilation errors
cargo build
# Run the tests you added to test.lst
cargo xtask cts 'webgpu:api,validation,category:subcategory:isAsync=false;*'
If the user asked to investigate a failure, and the cause of the failure is noted here with "do not attempt to fix", then stop and ask the user before attempting to fix.
Pattern: Format-specific failures
is_depth_stencil_format(), is_color_format() etc.Pattern: Aspect-related failures
hal::FormatAspects::from(format) to checkPattern: Optional field failures
Pattern: Atomics accepted incorrectly
atomicLoad, atomicStore, etc.Pattern: Error reporting for destroyed resources
wgpu often reports these errors later than WebGPU requires, causing the tests to fail.wgpu may report these errors earlier than it should, causing the test to fail with an unexpected validation error.state="destroyed" parameterwebgpu:api,validation,encoding,cmds,compute_pass:indirect_dispatch_buffer_state: with state="destroyed" subcases