Re-add missing example tests (#4277)

This commit is contained in:
Connor Fitzgerald 2023-10-22 01:18:37 -04:00 committed by GitHub
parent 04ac5f2851
commit 3cc6a563ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

View File

@ -9,6 +9,7 @@ publish = false
[[bin]]
name = "hello-synchronization"
path = "src/main.rs"
harness = false
[dependencies]
bytemuck.workspace = true

View File

@ -2,9 +2,11 @@ const ARR_SIZE: usize = 128;
struct ExecuteResults {
patient_workgroup_results: Vec<u32>,
#[cfg_attr(test, allow(unused))]
hasty_workgroup_results: Vec<u32>,
}
#[cfg_attr(test, allow(unused))]
async fn run() {
let instance = wgpu::Instance::default();
let adapter = instance
@ -187,6 +189,7 @@ async fn get_data<T: bytemuck::Pod>(
staging_buffer.unmap();
}
#[cfg(not(test))]
fn main() {
#[cfg(not(target_arch = "wasm32"))]
{
@ -207,5 +210,8 @@ fn main() {
}
}
#[cfg(test)]
wgpu_test::gpu_test_main!();
#[cfg(test)]
mod tests;

View File

@ -9,6 +9,7 @@ publish = false
[[bin]]
name = "timestamp-queries"
path = "src/main.rs"
harness = false
[dependencies]
bytemuck.workspace = true

View File

@ -75,6 +75,7 @@ impl QueryResults {
}
}
#[cfg_attr(test, allow(unused))]
fn print(&self, queue: &wgpu::Queue) {
let period = queue.get_timestamp_period();
let elapsed_us = |start, end: u64| end.wrapping_sub(start) as f64 * period as f64 / 1000.0;
@ -174,6 +175,7 @@ impl Queries {
}
}
#[cfg_attr(test, allow(unused))]
async fn run() {
// Instantiates instance of wgpu
let backends = wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all);
@ -403,6 +405,7 @@ fn render_pass(
rpass.draw(0..3, 0..1);
}
#[cfg(not(test))]
fn main() {
#[cfg(not(target_arch = "wasm32"))]
{
@ -417,6 +420,9 @@ fn main() {
}
}
#[cfg(test)]
wgpu_test::gpu_test_main!();
#[cfg(test)]
mod tests {
use wgpu_test::{gpu_test, GpuTestConfiguration};