summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'dom/webgpu/tests/cts/vendor')
-rw-r--r--dom/webgpu/tests/cts/vendor/Cargo.lock106
-rw-r--r--dom/webgpu/tests/cts/vendor/Cargo.toml2
-rw-r--r--dom/webgpu/tests/cts/vendor/src/fs.rs33
-rw-r--r--dom/webgpu/tests/cts/vendor/src/main.rs49
4 files changed, 164 insertions, 26 deletions
diff --git a/dom/webgpu/tests/cts/vendor/Cargo.lock b/dom/webgpu/tests/cts/vendor/Cargo.lock
index ea51837ca5..c1f2757393 100644
--- a/dom/webgpu/tests/cts/vendor/Cargo.lock
+++ b/dom/webgpu/tests/cts/vendor/Cargo.lock
@@ -30,9 +30,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "0.7.20"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
@@ -125,6 +125,26 @@ dependencies = [
]
[[package]]
+name = "const_format"
+version = "0.2.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673"
+dependencies = [
+ "const_format_proc_macros",
+]
+
+[[package]]
+name = "const_format_proc_macros"
+version = "0.2.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-xid",
+]
+
+[[package]]
name = "crossbeam"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -366,6 +386,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"
[[package]]
+name = "itertools"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
+dependencies = [
+ "either",
+]
+
+[[package]]
name = "jwalk"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -449,6 +478,12 @@ dependencies = [
]
[[package]]
+name = "minimal-lexical"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+
+[[package]]
name = "miniz_oxide"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -458,6 +493,16 @@ dependencies = [
]
[[package]]
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+dependencies = [
+ "memchr",
+ "minimal-lexical",
+]
+
+[[package]]
name = "num_cpus"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -495,6 +540,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
+name = "pori"
+version = "0.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4a63d338dec139f56dacc692ca63ad35a6be6a797442479b55acd611d79e906"
+dependencies = [
+ "nom",
+]
+
+[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -560,9 +614,21 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.7.1"
+version = "1.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
+checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629"
dependencies = [
"aho-corasick",
"memchr",
@@ -571,9 +637,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.6.28"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
+checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]]
name = "rustc-demangle"
@@ -740,6 +806,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
+name = "unicode-xid"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
+
+[[package]]
name = "vendor-webgpu-cts"
version = "0.1.0"
dependencies = [
@@ -748,12 +820,14 @@ dependencies = [
"dunce",
"env_logger",
"format",
+ "itertools",
"lets_find_up",
"log",
"miette",
"regex",
"shell-words",
"thiserror",
+ "wax",
"which",
]
@@ -765,12 +839,11 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "walkdir"
-version = "2.3.2"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
dependencies = [
"same-file",
- "winapi",
"winapi-util",
]
@@ -781,6 +854,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
+name = "wax"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d12a78aa0bab22d2f26ed1a96df7ab58e8a93506a3e20adb47c51a93b4e1357"
+dependencies = [
+ "const_format",
+ "itertools",
+ "nom",
+ "pori",
+ "regex",
+ "thiserror",
+ "walkdir",
+]
+
+[[package]]
name = "which"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/dom/webgpu/tests/cts/vendor/Cargo.toml b/dom/webgpu/tests/cts/vendor/Cargo.toml
index d7721d1931..e90a947bad 100644
--- a/dom/webgpu/tests/cts/vendor/Cargo.toml
+++ b/dom/webgpu/tests/cts/vendor/Cargo.toml
@@ -9,12 +9,14 @@ dircpy = "0.3.14"
dunce = "1.0.3"
env_logger = "0.10.0"
format = "0.2.4"
+itertools = "0.11.0"
lets_find_up = "0.0.3"
log = "0.4.17"
miette = { version = "5.5.0", features = ["fancy"] }
regex = "1.7.1"
shell-words = "1.1.0"
thiserror = "1.0.38"
+wax = "0.6.0"
which = "4.4.0"
[workspace]
diff --git a/dom/webgpu/tests/cts/vendor/src/fs.rs b/dom/webgpu/tests/cts/vendor/src/fs.rs
index 31697f9758..3062f27cdb 100644
--- a/dom/webgpu/tests/cts/vendor/src/fs.rs
+++ b/dom/webgpu/tests/cts/vendor/src/fs.rs
@@ -245,15 +245,6 @@ impl Display for Child<'_> {
}
}
-pub(crate) fn existing_file<P>(path: P) -> P
-where
- P: AsRef<Path>,
-{
- let p = path.as_ref();
- assert!(p.is_file(), "{p:?} does not exist as a file");
- path
-}
-
pub(crate) fn copy_dir<P, Q>(source: P, dest: Q) -> miette::Result<()>
where
P: Display + AsRef<Path>,
@@ -297,6 +288,30 @@ where
})
}
+pub(crate) fn rename<P1, P2>(from: P1, to: P2) -> miette::Result<()>
+where
+ P1: AsRef<Path>,
+ P2: AsRef<Path>,
+{
+ fs::rename(&from, &to).into_diagnostic().wrap_err_with(|| {
+ format!(
+ "failed to rename {} to {}",
+ from.as_ref().display(),
+ to.as_ref().display()
+ )
+ })
+}
+
+pub(crate) fn try_exists<P>(path: P) -> miette::Result<bool>
+where
+ P: AsRef<Path>,
+{
+ let path = path.as_ref();
+ path.try_exists()
+ .into_diagnostic()
+ .wrap_err_with(|| format!("failed to check if path exists: {}", path.display()))
+}
+
pub(crate) fn create_dir_all<P>(path: P) -> miette::Result<()>
where
P: AsRef<Path>,
diff --git a/dom/webgpu/tests/cts/vendor/src/main.rs b/dom/webgpu/tests/cts/vendor/src/main.rs
index 750b65c62e..1171c90b3a 100644
--- a/dom/webgpu/tests/cts/vendor/src/main.rs
+++ b/dom/webgpu/tests/cts/vendor/src/main.rs
@@ -6,12 +6,13 @@ use std::{
};
use clap::Parser;
+use itertools::Itertools;
use lets_find_up::{find_up_with, FindUpKind, FindUpOptions};
use miette::{bail, ensure, miette, Context, Diagnostic, IntoDiagnostic, Report, SourceSpan};
use regex::Regex;
use crate::{
- fs::{copy_dir, create_dir_all, existing_file, remove_file, FileRoot},
+ fs::{copy_dir, create_dir_all, remove_file, FileRoot},
path::join_path,
process::{which, EasyCommand},
};
@@ -277,13 +278,6 @@ fn run(args: CliArgs) -> miette::Result<()> {
})?;
let cts_https_html_path = out_wpt_dir.child("cts.https.html");
- log::info!("refining the output of {cts_https_html_path} with `npm run gen_wpt_cts_html …`…");
- EasyCommand::new(&npm_bin, |cmd| {
- cmd.args(["run", "gen_wpt_cts_html"]).arg(existing_file(
- &cts_ckt.child("tools/gen_wpt_cfg_unchunked.json"),
- ))
- })
- .spawn()?;
{
let extra_cts_https_html_path = out_wpt_dir.child("cts-chunked2sec.https.html");
@@ -551,6 +545,45 @@ fn run(args: CliArgs) -> miette::Result<()> {
log::info!(" …removing {cts_https_html_path}, now that it's been divided up…");
remove_file(&cts_https_html_path)?;
+ log::info!("moving ready-to-go WPT test files into `cts`…");
+
+ let webgpu_dir = out_wpt_dir.child("webgpu");
+ let ready_to_go_tests = wax::Glob::new("**/*.{html,{any,sub,worker}.js}")
+ .unwrap()
+ .walk(&webgpu_dir)
+ .map_ok(|entry| webgpu_dir.child(entry.into_path()))
+ .collect::<Result<Vec<_>, _>>()
+ .map_err(Report::msg)
+ .wrap_err_with(|| {
+ format!("failed to walk {webgpu_dir} for ready-to-go WPT test files")
+ })?;
+
+ log::trace!(" …will move the following: {ready_to_go_tests:#?}");
+
+ for file in ready_to_go_tests {
+ let path_relative_to_webgpu_dir = file.strip_prefix(&webgpu_dir).unwrap();
+ let dst_path = cts_tests_dir.child(path_relative_to_webgpu_dir);
+ log::trace!("…moving {file} to {dst_path}…");
+ ensure!(
+ !fs::try_exists(&dst_path)?,
+ "internal error: duplicate path found while moving ready-to-go test {} to {}",
+ file,
+ dst_path,
+ );
+ fs::create_dir_all(dst_path.parent().unwrap()).wrap_err_with(|| {
+ format!(
+ concat!(
+ "failed to create destination parent dirs. ",
+ "while recursively moving from {} to {}",
+ ),
+ file, dst_path,
+ )
+ })?;
+ fs::rename(&file, &dst_path)
+ .wrap_err_with(|| format!("failed to move {file} to {dst_path}"))?;
+ }
+ log::debug!(" …finished moving ready-to-go WPT test files");
+
Ok(())
})?;