Skip to content

Commit 3758b08

Browse files
Update cts to 20d2805 (#8201)
1 parent 3902b0c commit 3758b08

File tree

7 files changed

+101
-21
lines changed

7 files changed

+101
-21
lines changed

cts_runner/revision.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f164473e801f80c0e560e67a9abb356b09e06506
1+
20d2805a255a3ea41227200a61405ddb2871bcc0

cts_runner/test.lst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// The following may be useful to generate lists of tests for this file:
2+
// ```
3+
// cargo xtask cts -- --list <selector>
4+
// ```
15
unittests:*
26
webgpu:api,operation,command_buffer,basic:*
37
webgpu:api,operation,command_buffer,copyBufferToBuffer:*
@@ -102,7 +106,13 @@ webgpu:api,validation,image_copy,layout_related:copy_end_overflows_u64:*
102106
fails-if(dx12) webgpu:api,validation,image_copy,layout_related:offset_alignment:*
103107
webgpu:api,validation,image_copy,texture_related:format:dimension="1d";*
104108
webgpu:api,validation,queue,submit:command_buffer,*
105-
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,*
109+
// `GPUTexture` as `GPUTextureView` not supported by Deno. https://github.com/gfx-rs/wgpu/issues/8200
110+
//FAIL: webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_color_attachment:
111+
//FAIL: webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_depth_stencil_attachment:
112+
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,same_size:
113+
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,color_depth_mismatch:
114+
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,layer_count:*
115+
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,mip_level_count:*
106116
webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,*
107117
webgpu:api,validation,texture,rg11b10ufloat_renderable:*
108118
webgpu:api,operation,render_pipeline,overrides:*

xtask/src/cts.rs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ struct TestLine {
6262
pub fails_if: Option<String>,
6363
}
6464

65-
pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
65+
pub fn run_cts(
66+
shell: Shell,
67+
mut args: Arguments,
68+
passthrough_args: Option<Vec<OsString>>,
69+
) -> anyhow::Result<()> {
6670
let skip_checkout = args.contains("--skip-checkout");
6771
let llvm_cov = args.contains("--llvm-cov");
6872
let release = args.contains("--release");
@@ -89,8 +93,12 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
8993
.collect::<Vec<_>>();
9094

9195
if tests.is_empty() && list_files.is_empty() {
92-
log::info!("Reading default test list from {CTS_DEFAULT_TEST_LIST}");
93-
list_files.push(OsString::from(CTS_DEFAULT_TEST_LIST));
96+
if passthrough_args.is_none() {
97+
log::info!("Reading default test list from {CTS_DEFAULT_TEST_LIST}");
98+
list_files.push(OsString::from(CTS_DEFAULT_TEST_LIST));
99+
}
100+
} else if passthrough_args.is_some() {
101+
bail!("Test(s) and test list(s) are incompatible with passthrough arguments.");
94102
}
95103

96104
for file in list_files {
@@ -208,6 +216,25 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
208216
&["run"][..]
209217
};
210218

219+
if let Some(passthrough_args) = passthrough_args {
220+
let mut cmd = shell
221+
.cmd("cargo")
222+
.args(run_flags)
223+
.args(["--manifest-path".as_ref(), wgpu_cargo_toml.as_os_str()])
224+
.args(["-p", "cts_runner"])
225+
.args(["--bin", "cts_runner"]);
226+
227+
if release {
228+
cmd = cmd.arg("--release")
229+
}
230+
231+
cmd.args(["--", "./tools/run_deno", "--verbose"])
232+
.args(&passthrough_args)
233+
.run()?;
234+
235+
return Ok(());
236+
}
237+
211238
log::info!("Running CTS");
212239
for test in &tests {
213240
match (&test.fails_if, &running_on_backend) {

xtask/src/main.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ const HELP: &str = "\
1717
Usage: xtask <COMMAND>
1818
1919
Commands:
20-
cts [--skip-checkout] [<test selector> | -f <test list file>]...
20+
cts [<options>] [<test selector...> | -f <test list file...> | -- <args...>]
2121
Check out, build, and run CTS tests
2222
23-
--skip-checkout Don't check out the pinned CTS version, use whatever is
24-
already checked out.
23+
--skip-checkout Don't check out the pinned CTS version, use whatever
24+
is already checked out.
25+
--release Build and run in release mode
26+
--llvm-cov Run with LLVM code coverage
27+
--backend <backend> Specify the backend (metal, dx12, or vulkan). Used
28+
to evaluate `fails-if` conditions in the test list.
2529
2630
run-wasm
2731
Build and run web examples
@@ -75,7 +79,12 @@ fn main() -> anyhow::Result<ExitCode> {
7579
.format_indent(Some(0))
7680
.init();
7781

78-
let mut args = Arguments::from_env();
82+
let mut args = std::env::args_os().skip(1).collect::<Vec<_>>();
83+
let passthrough_args = args
84+
.iter()
85+
.position(|arg| arg == "--")
86+
.map(|pos| args.drain(pos..).skip(1).collect());
87+
let mut args = Arguments::from_vec(args);
7988

8089
if args.contains(["-h", "--help"]) {
8190
eprint!("{HELP}");
@@ -92,10 +101,10 @@ fn main() -> anyhow::Result<ExitCode> {
92101
shell.change_dir(String::from(env!("CARGO_MANIFEST_DIR")) + "/..");
93102

94103
match subcommand.as_deref() {
95-
Some("cts") => cts::run_cts(shell, args)?,
96-
Some("run-wasm") => run_wasm::run_wasm(shell, args)?,
104+
Some("cts") => cts::run_cts(shell, args, passthrough_args)?,
105+
Some("run-wasm") => run_wasm::run_wasm(shell, args, passthrough_args)?,
97106
Some("miri") => miri::run_miri(shell, args)?,
98-
Some("test") => test::run_tests(shell, args)?,
107+
Some("test") => test::run_tests(shell, args, passthrough_args)?,
99108
Some("vendor-web-sys") => vendor_web_sys::run_vendor_web_sys(shell, args)?,
100109
Some(subcommand) => {
101110
bad_arguments!("Unknown subcommand: {}", subcommand)

xtask/src/run_wasm.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
use anyhow::Context;
1+
use std::ffi::OsString;
22

3+
use anyhow::Context;
34
use pico_args::Arguments;
45
use xshell::Shell;
56

6-
use crate::util::{check_all_programs, Program};
7+
use crate::util::{check_all_programs, flatten_args, Program};
78

8-
pub(crate) fn run_wasm(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
9+
pub(crate) fn run_wasm(
10+
shell: Shell,
11+
mut args: Arguments,
12+
passthrough_args: Option<Vec<OsString>>,
13+
) -> anyhow::Result<()> {
914
let should_serve = !args.contains("--no-serve");
1015
let release = args.contains("--release");
16+
let cargo_args = flatten_args(args, passthrough_args);
1117

1218
let mut programs_needed = vec![Program {
1319
crate_name: "wasm-bindgen-cli",
@@ -28,8 +34,6 @@ pub(crate) fn run_wasm(shell: Shell, mut args: Arguments) -> anyhow::Result<()>
2834

2935
log::info!("building webgpu examples");
3036

31-
let cargo_args = args.finish();
32-
3337
xshell::cmd!(
3438
shell,
3539
"cargo build --target wasm32-unknown-unknown -p wgpu-examples --no-default-features --features webgpu {release_flag...}"

xtask/src/test.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
use std::ffi::OsString;
2+
13
use anyhow::Context;
24
use pico_args::Arguments;
35
use xshell::Shell;
46

5-
pub fn run_tests(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
7+
use crate::util::flatten_args;
8+
9+
pub fn run_tests(
10+
shell: Shell,
11+
mut args: Arguments,
12+
passthrough_args: Option<Vec<OsString>>,
13+
) -> anyhow::Result<()> {
614
let llvm_cov = args.contains("--llvm-cov");
715
let list = args.contains("--list");
16+
let cargo_args = flatten_args(args, passthrough_args);
817
// Retries handled by cargo nextest natively
918

1019
// 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<()> {
5867
.cmd("cargo")
5968
.args(llvm_cov_nextest_flags)
6069
.args(["-v", "--benches", "--tests", "--all-features"])
61-
.args(args.finish())
70+
.args(cargo_args)
6271
.run()
6372
.context("Failed to list tests")?;
6473
return Ok(());
@@ -69,7 +78,7 @@ pub fn run_tests(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
6978
.cmd("cargo")
7079
.args(llvm_cov_nextest_flags)
7180
.args(["--benches", "--tests", "--all-features"])
72-
.args(args.finish())
81+
.args(cargo_args)
7382
.quiet()
7483
.run()
7584
.context("Tests failed")?;

xtask/src/util.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::{io, process::Command};
1+
use std::{ffi::OsString, io, process::Command};
22

33
use anyhow::Context;
4+
use pico_args::Arguments;
45
use xshell::Shell;
56

67
pub(crate) struct Program {
@@ -12,6 +13,26 @@ pub(crate) fn looks_like_git_sha(input: &str) -> bool {
1213
input.len() == 40 && input.chars().all(|c| c.is_ascii_hexdigit())
1314
}
1415

16+
pub(crate) fn flatten_args(
17+
args: Arguments,
18+
passthrough_args: Option<Vec<OsString>>,
19+
) -> Vec<OsString> {
20+
if let Some(passthrough_args) = passthrough_args {
21+
let mut args = args.finish();
22+
// The following matches the historical behavior of our xtasks, however,
23+
// it would be more general not to re-insert the terminator here, so
24+
// that arguments can be passed either to cargo or to tests. i.e., with
25+
// the next line, the args are interpreted as `xtask test <xtask args>
26+
// -- <test args>`, without it the args would be interpreted as `xtask
27+
// test <xtask args> -- <cargo args> -- <test args>`.
28+
args.push(OsString::from("--"));
29+
args.extend(passthrough_args);
30+
args
31+
} else {
32+
args.finish()
33+
}
34+
}
35+
1536
pub(crate) fn check_all_programs(programs: &[Program]) -> anyhow::Result<()> {
1637
let mut failed_crates = Vec::new();
1738
for &Program {

0 commit comments

Comments
 (0)