Skip to content

Enable WebGPU CTS on CI #1903

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
target: wasm32-unknown-unknown
kind: webgl

name: ${{ matrix.name }}
name: Check ${{ matrix.name }}
runs-on: ${{ matrix.os }}

env:
Expand Down Expand Up @@ -138,20 +138,56 @@ 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
if: matrix.kind == 'test' && matrix.os == 'windows-2019'
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
Expand Down
10 changes: 0 additions & 10 deletions cts_runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
22 changes: 12 additions & 10 deletions cts_runner/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -25,11 +26,12 @@ async fn main() {
}

async fn run() -> Result<(), AnyError> {
let args = std::env::args().collect::<Vec<_>>();
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)),
Expand All @@ -46,8 +48,8 @@ async fn run() -> Result<(), AnyError> {
..Default::default()
};
let mut isolate = JsRuntime::new(options);
let args: Vec<String> = 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::<Vec<String>>();
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)?;

Expand Down
4 changes: 2 additions & 2 deletions deno_webgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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"] }
wgpu-types = { path = "../wgpu-types", features = ["trace", "replay", "serde"] }