From bbb9968297e75eadd0837229210c82b1bbb06be4 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Fri, 3 Sep 2021 13:53:10 -0400 Subject: [PATCH] Enable WebGPU CTS on CI --- .github/workflows/ci.yml | 48 +++++++++++++++++++++++++++++++++++----- cts_runner/Cargo.toml | 10 --------- cts_runner/src/main.rs | 22 +++++++++--------- deno_webgpu/Cargo.toml | 4 ++-- 4 files changed, 56 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 520f93abf..b3fc200d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: target: wasm32-unknown-unknown kind: webgl - name: ${{ matrix.name }} + name: Check ${{ matrix.name }} runs-on: ${{ matrix.os }} env: @@ -138,7 +138,7 @@ jobs: if: matrix.kind == 'test' run: | cargo build --target ${{ matrix.target }} --bin wgpu-info - cargo build --target ${{ matrix.target }} --tests --workspace --exclude wgpu + cargo build --target ${{ matrix.target }} --tests -p wgpu-types -p wgpu-hal -p wgpu-core cargo build --target ${{ matrix.target }} --examples --tests -p wgpu - name: tests @@ -146,12 +146,48 @@ jobs: run: | # run wgpu-info cargo run --target ${{ matrix.target }} --bin wgpu-info - # run player tests - cargo test --target ${{ matrix.target }} --workspace --exclude wgpu --no-fail-fast -- --nocapture - + cargo test --target ${{ matrix.target }} -p wgpu-types -p wgpu-hal -p wgpu-core --no-fail-fast -- --nocapture # run coretests - cargo run --target ${{ matrix.target }} --bin wgpu-info -- cargo test --target ${{ matrix.target }} -p wgpu --no-fail-fast -- --nocapture --test-threads=1 # GLES is currently non-multithreadable + cargo run --target ${{ matrix.target }} --bin wgpu-info -- cargo test --target ${{ matrix.target }} -p wgpu --no-fail-fast -- --nocapture + + test: + strategy: + fail-fast: false + matrix: + include: + # Windows + - name: Windows x86_64 + os: windows-latest + target: x86_64-pc-windows-msvc + + name: Test ${{ matrix.name }} + runs-on: ${{ matrix.os }} + + steps: + - name: checkout repo + uses: actions/checkout@v2 + with: + path: wgpu + - name: checkout cts + uses: actions/checkout@v2 + with: + repository: gpuweb/cts + ref: 8dbacc65e37f2c0d1a5c4adbb2f6ca363fe2f459 # from "gh-pages" branch + path: cts + + - name: install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + profile: minimal + + - name: build CTS runner + run: cd wgpu && cargo build -p cts_runner + + - name: run CTS + run: cd cts && ../wgpu/target/debug/cts_runner.exe ./tools/run_deno --verbose 'unittests:*' fmt: name: Format diff --git a/cts_runner/Cargo.toml b/cts_runner/Cargo.toml index 25d597195..6a88022a2 100644 --- a/cts_runner/Cargo.toml +++ b/cts_runner/Cargo.toml @@ -19,13 +19,3 @@ deno_webidl = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a deno_webgpu = { path = "../deno_webgpu" } tokio = { version = "1.10.0", features = ["full"] } termcolor = "1.1.2" - -[build-dependencies] -deno_console = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a0a997809f02b18c2ba1ecd58d" } -deno_core = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a0a997809f02b18c2ba1ecd58d" } -deno_timers = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a0a997809f02b18c2ba1ecd58d" } -deno_url = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a0a997809f02b18c2ba1ecd58d" } -deno_web = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a0a997809f02b18c2ba1ecd58d" } -deno_webidl = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a0a997809f02b18c2ba1ecd58d" } -deno_webgpu = { path = "../deno_webgpu" } -tokio = { version = "1.10.0", features = ["full"] } \ No newline at end of file diff --git a/cts_runner/src/main.rs b/cts_runner/src/main.rs index b1768da63..b75adaad6 100644 --- a/cts_runner/src/main.rs +++ b/cts_runner/src/main.rs @@ -1,7 +1,8 @@ -use std::fmt; -use std::io::Read; -use std::io::Write; -use std::rc::Rc; +use std::{ + env, fmt, + io::{Read, Write}, + rc::Rc, +}; use deno_core::error::anyhow; use deno_core::error::AnyError; @@ -25,11 +26,12 @@ async fn main() { } async fn run() -> Result<(), AnyError> { - let args = std::env::args().collect::>(); - let url = args - .get(1) + let mut args_iter = env::args(); + let _ = args_iter.next(); + let url = args_iter + .next() .ok_or_else(|| anyhow!("missing specifier in first command line argument"))?; - let specifier = resolve_url_or_path(url)?; + let specifier = resolve_url_or_path(&url)?; let options = RuntimeOptions { module_loader: Some(Rc::new(deno_core::FsModuleLoader)), @@ -46,8 +48,8 @@ async fn run() -> Result<(), AnyError> { ..Default::default() }; let mut isolate = JsRuntime::new(options); - let args: Vec = std::env::args().skip(2).collect(); - let cfg = json!({"args": args, "cwd": std::env::current_dir().unwrap().to_string_lossy() }); + let args = args_iter.collect::>(); + let cfg = json!({"args": args, "cwd": env::current_dir().unwrap().to_string_lossy() }); let bootstrap_script = format!("globalThis.bootstrap({})", serde_json::to_string(&cfg)?); isolate.execute_script(&located_script_name!(), &bootstrap_script)?; diff --git a/deno_webgpu/Cargo.toml b/deno_webgpu/Cargo.toml index 9f0da9ae9..2a94d1ea8 100644 --- a/deno_webgpu/Cargo.toml +++ b/deno_webgpu/Cargo.toml @@ -7,7 +7,7 @@ authors = ["the Deno authors"] edition = "2018" license = "MIT" readme = "README.md" -repository = "https://github.com/denoland/deno" +repository = "https://github.com/gfx-rs/wgpu" description = "WebGPU implementation for Deno" [lib] @@ -18,4 +18,4 @@ deno_core = { git = "https://github.com/denoland/deno", rev = "ca75752e5a9499a0a serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.10", features = ["full"] } wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde"] } -wgpu-types = { path = "../wgpu-types", features = ["trace", "replay", "serde"] } \ No newline at end of file +wgpu-types = { path = "../wgpu-types", features = ["trace", "replay", "serde"] }