mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Tweaks to CTS xtask, useful when running a modified CTS. (#7737)
This commit is contained in:
parent
a04085c5e4
commit
ffd5b9aeea
@ -1,4 +1,4 @@
|
|||||||
use anyhow::Context;
|
use anyhow::{bail, Context};
|
||||||
use pico_args::Arguments;
|
use pico_args::Arguments;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use xshell::Shell;
|
use xshell::Shell;
|
||||||
@ -16,8 +16,9 @@ const CTS_GIT_URL: &str = "https://github.com/gpuweb/cts.git";
|
|||||||
const CTS_DEFAULT_TEST_LIST: &str = "cts_runner/test.lst";
|
const CTS_DEFAULT_TEST_LIST: &str = "cts_runner/test.lst";
|
||||||
|
|
||||||
pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
|
pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
|
||||||
let mut list_files = Vec::<OsString>::new();
|
let skip_checkout = args.contains("--skip-checkout");
|
||||||
|
|
||||||
|
let mut list_files = Vec::<OsString>::new();
|
||||||
while let Some(file) = args.opt_value_from_str("-f")? {
|
while let Some(file) = args.opt_value_from_str("-f")? {
|
||||||
list_files.push(file);
|
list_files.push(file);
|
||||||
}
|
}
|
||||||
@ -37,6 +38,8 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let wgpu_cargo_toml = shell.current_dir().join("Cargo.toml").canonicalize()?;
|
||||||
|
|
||||||
let cts_revision = shell
|
let cts_revision = shell
|
||||||
.read_file(CTS_REVISION_PATH)
|
.read_file(CTS_REVISION_PATH)
|
||||||
.context(format!(
|
.context(format!(
|
||||||
@ -46,6 +49,9 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
|
|||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
if !shell.path_exists(CTS_CHECKOUT_PATH) {
|
if !shell.path_exists(CTS_CHECKOUT_PATH) {
|
||||||
|
if skip_checkout {
|
||||||
|
bail!("Skipping CTS checkout doesn't make sense when CTS is not present");
|
||||||
|
}
|
||||||
log::info!("Cloning CTS");
|
log::info!("Cloning CTS");
|
||||||
shell
|
shell
|
||||||
.cmd("git")
|
.cmd("git")
|
||||||
@ -57,20 +63,24 @@ pub fn run_cts(shell: Shell, mut args: Arguments) -> anyhow::Result<()> {
|
|||||||
|
|
||||||
shell.change_dir(CTS_CHECKOUT_PATH);
|
shell.change_dir(CTS_CHECKOUT_PATH);
|
||||||
|
|
||||||
log::info!("Checking out CTS");
|
if !skip_checkout {
|
||||||
shell
|
log::info!("Checking out CTS");
|
||||||
.cmd("git")
|
shell
|
||||||
.args(["checkout", "--quiet", &cts_revision])
|
.cmd("git")
|
||||||
.quiet()
|
.args(["checkout", "--quiet", &cts_revision])
|
||||||
.run()
|
.quiet()
|
||||||
.context("Failed to check out CTS")?;
|
.run()
|
||||||
|
.context("Failed to check out CTS")?;
|
||||||
|
} else {
|
||||||
|
log::info!("Skipping CTS checkout because --skip-checkout was specified");
|
||||||
|
}
|
||||||
|
|
||||||
log::info!("Running CTS");
|
log::info!("Running CTS");
|
||||||
for test in &tests {
|
for test in &tests {
|
||||||
shell
|
shell
|
||||||
.cmd("cargo")
|
.cmd("cargo")
|
||||||
.args(["run"])
|
.args(["run"])
|
||||||
.args(["--manifest-path", "../Cargo.toml"])
|
.args(["--manifest-path".as_ref(), wgpu_cargo_toml.as_os_str()])
|
||||||
.args(["-p", "cts_runner"])
|
.args(["-p", "cts_runner"])
|
||||||
.args(["--bin", "cts_runner"])
|
.args(["--bin", "cts_runner"])
|
||||||
.args(["--", "./tools/run_deno", "--verbose"])
|
.args(["--", "./tools/run_deno", "--verbose"])
|
||||||
|
|||||||
@ -16,9 +16,12 @@ const HELP: &str = "\
|
|||||||
Usage: xtask <COMMAND>
|
Usage: xtask <COMMAND>
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
cts [<test selector> | -f <test list file>]...
|
cts [--skip-checkout] [<test selector> | -f <test list file>]...
|
||||||
Check out, build, and run CTS tests
|
Check out, build, and run CTS tests
|
||||||
|
|
||||||
|
--skip-checkout Don't check out the pinned CTS version, use whatever is
|
||||||
|
already checked out.
|
||||||
|
|
||||||
run-wasm
|
run-wasm
|
||||||
Build and run web examples
|
Build and run web examples
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user