Update cts to 20d2805 (#8201)

This commit is contained in:
Andy Leiserson 2025-09-10 17:50:25 -07:00 committed by GitHub
parent 3902b0c11c
commit 3758b08be9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 101 additions and 21 deletions

View File

@ -1 +1 @@
f164473e801f80c0e560e67a9abb356b09e06506
20d2805a255a3ea41227200a61405ddb2871bcc0

View File

@ -1,3 +1,7 @@
// The following may be useful to generate lists of tests for this file:
// ```
// cargo xtask cts -- --list <selector>
// ```
unittests:*
webgpu:api,operation,command_buffer,basic:*
webgpu:api,operation,command_buffer,copyBufferToBuffer:*
@ -102,7 +106,13 @@ webgpu:api,validation,image_copy,layout_related:copy_end_overflows_u64:*
fails-if(dx12) webgpu:api,validation,image_copy,layout_related:offset_alignment:*
webgpu:api,validation,image_copy,texture_related:format:dimension="1d";*
webgpu:api,validation,queue,submit:command_buffer,*
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,*
// `GPUTexture` as `GPUTextureView` not supported by Deno. https://github.com/gfx-rs/wgpu/issues/8200
//FAIL: webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_color_attachment:
//FAIL: webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_depth_stencil_attachment:
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,same_size:
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,color_depth_mismatch:
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,layer_count:*
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,mip_level_count:*
webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,*
webgpu:api,validation,texture,rg11b10ufloat_renderable:*
webgpu:api,operation,render_pipeline,overrides:*

View File

@ -62,7 +62,11 @@ struct TestLine {
pub fails_if: Option<String>,
}
pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
pub fn run_cts(
shell: Shell,
mut args: Arguments,
passthrough_args: Option<Vec<OsString>>,
) -> anyhow::Result<()> {
let skip_checkout = args.contains("--skip-checkout");
let llvm_cov = args.contains("--llvm-cov");
let release = args.contains("--release");
@ -89,8 +93,12 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
.collect::<Vec<_>>();
if tests.is_empty() && list_files.is_empty() {
log::info!("Reading default test list from {CTS_DEFAULT_TEST_LIST}");
list_files.push(OsString::from(CTS_DEFAULT_TEST_LIST));
if passthrough_args.is_none() {
log::info!("Reading default test list from {CTS_DEFAULT_TEST_LIST}");
list_files.push(OsString::from(CTS_DEFAULT_TEST_LIST));
}
} else if passthrough_args.is_some() {
bail!("Test(s) and test list(s) are incompatible with passthrough arguments.");
}
for file in list_files {
@ -208,6 +216,25 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
&["run"][..]
};
if let Some(passthrough_args) = passthrough_args {
let mut cmd = shell
.cmd("cargo")
.args(run_flags)
.args(["--manifest-path".as_ref(), wgpu_cargo_toml.as_os_str()])
.args(["-p", "cts_runner"])
.args(["--bin", "cts_runner"]);
if release {
cmd = cmd.arg("--release")
}
cmd.args(["--", "./tools/run_deno", "--verbose"])
.args(&passthrough_args)
.run()?;
return Ok(());
}
log::info!("Running CTS");
for test in &tests {
match (&test.fails_if, &running_on_backend) {

View File

@ -17,11 +17,15 @@ const HELP: &str = "\
Usage: xtask <COMMAND>
Commands:
cts [--skip-checkout] [<test selector> | -f <test list file>]...
cts [<options>] [<test selector...> | -f <test list file...> | -- <args...>]
Check out, build, and run CTS tests
--skip-checkout Don't check out the pinned CTS version, use whatever is
already checked out.
--skip-checkout Don't check out the pinned CTS version, use whatever
is already checked out.
--release Build and run in release mode
--llvm-cov Run with LLVM code coverage
--backend <backend> Specify the backend (metal, dx12, or vulkan). Used
to evaluate `fails-if` conditions in the test list.
run-wasm
Build and run web examples
@ -75,7 +79,12 @@ fn main() -> anyhow::Result<ExitCode> {
.format_indent(Some(0))
.init();
let mut args = Arguments::from_env();
let mut args = std::env::args_os().skip(1).collect::<Vec<_>>();
let passthrough_args = args
.iter()
.position(|arg| arg == "--")
.map(|pos| args.drain(pos..).skip(1).collect());
let mut args = Arguments::from_vec(args);
if args.contains(["-h", "--help"]) {
eprint!("{HELP}");
@ -92,10 +101,10 @@ fn main() -> anyhow::Result<ExitCode> {
shell.change_dir(String::from(env!("CARGO_MANIFEST_DIR")) + "/..");
match subcommand.as_deref() {
Some("cts") => cts::run_cts(shell, args)?,
Some("run-wasm") => run_wasm::run_wasm(shell, args)?,
Some("cts") => cts::run_cts(shell, args, passthrough_args)?,
Some("run-wasm") => run_wasm::run_wasm(shell, args, passthrough_args)?,
Some("miri") => miri::run_miri(shell, args)?,
Some("test") => test::run_tests(shell, args)?,
Some("test") => test::run_tests(shell, args, passthrough_args)?,
Some("vendor-web-sys") => vendor_web_sys::run_vendor_web_sys(shell, args)?,
Some(subcommand) => {
bad_arguments!("Unknown subcommand: {}", subcommand)

View File

@ -1,13 +1,19 @@
use anyhow::Context;
use std::ffi::OsString;
use anyhow::Context;
use pico_args::Arguments;
use xshell::Shell;
use crate::util::{check_all_programs, Program};
use crate::util::{check_all_programs, flatten_args, Program};
pub(crate) fn run_wasm(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
pub(crate) fn run_wasm(
shell: Shell,
mut args: Arguments,
passthrough_args: Option<Vec<OsString>>,
) -> anyhow::Result<()> {
let should_serve = !args.contains("--no-serve");
let release = args.contains("--release");
let cargo_args = flatten_args(args, passthrough_args);
let mut programs_needed = vec![Program {
crate_name: "wasm-bindgen-cli",
@ -28,8 +34,6 @@ pub(crate) fn run_wasm(shell: Shell, mut args: Arguments) -> anyhow::Result<()>
log::info!("building webgpu examples");
let cargo_args = args.finish();
xshell::cmd!(
shell,
"cargo build --target wasm32-unknown-unknown -p wgpu-examples --no-default-features --features webgpu {release_flag...}"

View File

@ -1,10 +1,19 @@
use std::ffi::OsString;
use anyhow::Context;
use pico_args::Arguments;
use xshell::Shell;
pub fn run_tests(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
use crate::util::flatten_args;
pub fn run_tests(
shell: Shell,
mut args: Arguments,
passthrough_args: Option<Vec<OsString>>,
) -> anyhow::Result<()> {
let llvm_cov = args.contains("--llvm-cov");
let list = args.contains("--list");
let cargo_args = flatten_args(args, passthrough_args);
// Retries handled by cargo nextest natively
// These needs to match the command in "run wgpu-info" in `.github/workflows/ci.yml`
@ -58,7 +67,7 @@ pub fn run_tests(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
.cmd("cargo")
.args(llvm_cov_nextest_flags)
.args(["-v", "--benches", "--tests", "--all-features"])
.args(args.finish())
.args(cargo_args)
.run()
.context("Failed to list tests")?;
return Ok(());
@ -69,7 +78,7 @@ pub fn run_tests(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
.cmd("cargo")
.args(llvm_cov_nextest_flags)
.args(["--benches", "--tests", "--all-features"])
.args(args.finish())
.args(cargo_args)
.quiet()
.run()
.context("Tests failed")?;

View File

@ -1,6 +1,7 @@
use std::{io, process::Command};
use std::{ffi::OsString, io, process::Command};
use anyhow::Context;
use pico_args::Arguments;
use xshell::Shell;
pub(crate) struct Program {
@ -12,6 +13,26 @@ pub(crate) fn looks_like_git_sha(input: &str) -> bool {
input.len() == 40 && input.chars().all(|c| c.is_ascii_hexdigit())
}
pub(crate) fn flatten_args(
args: Arguments,
passthrough_args: Option<Vec<OsString>>,
) -> Vec<OsString> {
if let Some(passthrough_args) = passthrough_args {
let mut args = args.finish();
// The following matches the historical behavior of our xtasks, however,
// it would be more general not to re-insert the terminator here, so
// that arguments can be passed either to cargo or to tests. i.e., with
// the next line, the args are interpreted as `xtask test <xtask args>
// -- <test args>`, without it the args would be interpreted as `xtask
// test <xtask args> -- <cargo args> -- <test args>`.
args.push(OsString::from("--"));
args.extend(passthrough_args);
args
} else {
args.finish()
}
}
pub(crate) fn check_all_programs(programs: &[Program]) -> anyhow::Result<()> {
let mut failed_crates = Vec::new();
for &Program {