Skip to content

Commit 233a25c

Browse files
Update to the latest CTS; run it on all platforms and on all PRs (gfx-rs#7752)
1 parent dcada3d commit 233a25c

6 files changed

Lines changed: 84 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ env:
2929
DXC_RELEASE: "v1.8.2502"
3030
DXC_FILENAME: "dxc_2025_02_20.zip"
3131

32+
# These Mesa version definitions are duplicated in the CTS job.
3233
# Sourced from https://archive.mesa3d.org/. Bumping this requires
3334
# updating the mesa build in https://github.com/gfx-rs/ci-build and creating a new release.
3435
MESA_VERSION: "24.3.4"
@@ -626,6 +627,7 @@ jobs:
626627
sudo apt-get update
627628
sudo apt install -y vulkan-sdk
628629
630+
# This step is duplicated in the CTS job.
629631
- name: (Linux) Install Mesa
630632
if: matrix.os == 'ubuntu-24.04'
631633
shell: bash

.github/workflows/cts.yml

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ env:
1313
RUST_BACKTRACE: full
1414
MSRV: "1.84"
1515

16+
# These Mesa version definitions are duplicated in the CI job.
17+
# Sourced from https://archive.mesa3d.org/. Bumping this requires
18+
# updating the mesa build in https://github.com/gfx-rs/ci-build and creating a new release.
19+
MESA_VERSION: "24.3.4"
20+
# Corresponds to https://github.com/gfx-rs/ci-build/releases
21+
CI_BINARY_BUILD: "build20"
22+
1623
jobs:
1724
cts:
18-
# For pull requests, only run if we add the "PR: run CTS" label
19-
if: "github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'PR: run CTS')"
20-
2125
strategy:
2226
fail-fast: false
2327
matrix:
@@ -26,28 +30,23 @@ jobs:
2630
- name: Windows x86_64
2731
os: windows-2022
2832
target: x86_64-pc-windows-msvc
29-
backends: dx12
33+
34+
# Mac
35+
- name: Mac aarch64
36+
os: macos-14
37+
target: x86_64-apple-darwin
3038

3139
# Linux
32-
#- name: Linux x86_64
33-
# os: ubuntu-20.04
34-
# target: x86_64-unknown-linux-gnu
35-
# backends: vulkan # gl
40+
- name: Linux x86_64
41+
os: ubuntu-24.04
42+
target: x86_64-unknown-linux-gnu
3643

3744
name: CTS ${{ matrix.name }}
3845
runs-on: ${{ matrix.os }}
3946

4047
steps:
4148
- name: checkout repo
4249
uses: actions/checkout@v4
43-
with:
44-
path: wgpu
45-
46-
- name: checkout cts
47-
run: |
48-
git clone https://github.com/gpuweb/cts.git
49-
cd cts
50-
git checkout $(cat ../wgpu/cts_runner/revision.txt)
5150

5251
- name: Install Repo MSRV toolchain
5352
run: |
@@ -58,31 +57,47 @@ jobs:
5857
- name: caching
5958
uses: Swatinem/rust-cache@v2
6059
with:
61-
key: cts-b # suffix for cache busting
62-
workspaces: wgpu
60+
prefix-key: v1-rust # Increment version for cache busting
61+
cache-directories: cts
6362

6463
# We enable line numbers for panics, but that's it
6564
- name: disable debug
6665
shell: bash
6766
run: |
68-
mkdir -p wgpu/.cargo
69-
echo """[profile.dev]
70-
debug = 1" > wgpu/.cargo/config.toml
67+
mkdir -p .cargo
68+
cat <<EOF >> .cargo/config.toml
69+
[profile.dev]
70+
debug = 1
71+
EOF
7172
72-
- name: build CTS runner
73+
# This step is duplicated in the CI job.
74+
- name: (Linux) Install Mesa
75+
if: matrix.os == 'ubuntu-24.04'
76+
shell: bash
7377
run: |
74-
cargo build --manifest-path wgpu/cts_runner/Cargo.toml
78+
set -e
79+
80+
curl -L --retry 5 https://github.com/gfx-rs/ci-build/releases/download/$CI_BINARY_BUILD/mesa-$MESA_VERSION-linux-x86_64.tar.xz -o mesa.tar.xz
81+
mkdir mesa
82+
tar xpf mesa.tar.xz -C mesa
83+
84+
# The ICD provided by the mesa build is hardcoded to the build environment.
85+
#
86+
# We write out our own ICD file to point to the mesa vulkan
87+
cat <<- EOF > icd.json
88+
{
89+
"ICD": {
90+
"api_version": "1.1.255",
91+
"library_path": "$PWD/mesa/lib/x86_64-linux-gnu/libvulkan_lvp.so"
92+
},
93+
"file_format_version": "1.0.0"
94+
}
95+
EOF
96+
97+
echo "VK_DRIVER_FILES=$PWD/icd.json" >> "$GITHUB_ENV"
98+
echo "LD_LIBRARY_PATH=$PWD/mesa/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH" >> "$GITHUB_ENV"
99+
echo "LIBGL_DRIVERS_PATH=$PWD/mesa/lib/x86_64-linux-gnu/dri" >> "$GITHUB_ENV"
75100
76101
- name: run CTS
77102
shell: bash
78-
run: |
79-
cd cts;
80-
for backend in ${{ matrix.backends }}; do
81-
echo "======= CTS TESTS $backend ======";
82-
grep -v '^//' ../wgpu/cts_runner/test.lst | while IFS=$' \t\r\n' read test; do
83-
echo "=== Running $test ===";
84-
DENO_WEBGPU_BACKEND=$backend cargo run --manifest-path ../wgpu/cts_runner/Cargo.toml --frozen -- ./tools/run_deno --verbose "$test";
85-
done
86-
done
87-
echo;
88-
echo "Note: Summary reflects only the last test suite, not the entire run."
103+
run: cargo xtask cts

cts_runner/revision.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
049916a6191725aad5a5692e5a22df47d45c88fa
1+
ccd84d9943abc01b0421c48080280e9e940336b4

cts_runner/test.lst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ webgpu:api,operation,rendering,color_target_state:blending,formats:*
1616
webgpu:api,operation,rendering,color_target_state:blend_constant,setting:*
1717
webgpu:api,operation,rendering,depth:*
1818
webgpu:api,operation,rendering,draw:*
19-
webgpu:api,operation,uncapturederror:*
19+
webgpu:api,operation,uncapturederror:iff_uncaptured:*
20+
//FAIL: webgpu:api,operation,uncapturederror:onuncapturederror_order_wrt_addEventListener
21+
// There are also two unimplemented SKIPs in uncapturederror not enumerated here.
2022
webgpu:shader,execution,flow_control,return:*

deno_webgpu/webidl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ pub fn feature_names_to_features(names: Vec<GPUFeatureName>) -> wgpu_types::Feat
487487
GPUFeatureName::Multiview => Features::MULTIVIEW,
488488
GPUFeatureName::VertexAttribute64Bit => Features::VERTEX_ATTRIBUTE_64BIT,
489489
GPUFeatureName::ShaderF64 => Features::SHADER_F64,
490-
GPUFeatureName::ShaderI16 => Features::SHADER_F16,
490+
GPUFeatureName::ShaderI16 => Features::SHADER_I16,
491491
GPUFeatureName::ShaderPrimitiveIndex => Features::SHADER_PRIMITIVE_INDEX,
492492
GPUFeatureName::ShaderEarlyDepthTest => Features::SHADER_EARLY_DEPTH_TEST,
493493
};

xtask/src/cts.rs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
3838
}))
3939
}
4040

41-
let wgpu_cargo_toml = shell.current_dir().join("Cargo.toml").canonicalize()?;
41+
let wgpu_cargo_toml = std::path::absolute(shell.current_dir().join("Cargo.toml"))
42+
.context("Failed to get path to Cargo.toml")?;
4243

4344
let cts_revision = shell
4445
.read_file(CTS_REVISION_PATH)
@@ -59,9 +60,32 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
5960
.quiet()
6061
.run()
6162
.context("Failed to clone CTS")?;
62-
}
6363

64-
shell.change_dir(CTS_CHECKOUT_PATH);
64+
shell.change_dir(CTS_CHECKOUT_PATH);
65+
} else if !skip_checkout {
66+
shell.change_dir(CTS_CHECKOUT_PATH);
67+
68+
// If we don't have the CTS commit we want, try to fetch it.
69+
if shell
70+
.cmd("git")
71+
.args(["cat-file", "commit", &cts_revision])
72+
.quiet()
73+
.ignore_stdout()
74+
.ignore_stderr()
75+
.run()
76+
.is_err()
77+
{
78+
log::info!("Fetching CTS");
79+
shell
80+
.cmd("git")
81+
.args(["fetch", "--quiet"])
82+
.quiet()
83+
.run()
84+
.context("Failed to fetch CTS")?;
85+
}
86+
} else {
87+
shell.change_dir(CTS_CHECKOUT_PATH);
88+
}
6589

6690
if !skip_checkout {
6791
log::info!("Checking out CTS");
@@ -77,6 +101,7 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
77101

78102
log::info!("Running CTS");
79103
for test in &tests {
104+
log::info!("Running {}", test.to_string_lossy());
80105
shell
81106
.cmd("cargo")
82107
.args(["run"])

0 commit comments

Comments
 (0)