Skip to content

Commit 1e172b2

Browse files
test: repair multi-instance tests (#7388)
1 parent c37a005 commit 1e172b2

File tree

2 files changed

+36
-33
lines changed

2 files changed

+36
-33
lines changed

tests/gpu-tests/multi-instance.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/validation-tests/api/instance.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
mod multi_instance {
2+
#![cfg(not(target_arch = "wasm32"))]
3+
4+
async fn get() -> wgpu::Adapter {
5+
let adapter = {
6+
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
7+
backends: wgpu::Backends::from_env().unwrap_or_default(),
8+
..Default::default()
9+
});
10+
instance
11+
.request_adapter(&wgpu::RequestAdapterOptions::default())
12+
.await
13+
.unwrap()
14+
};
15+
16+
log::info!("Selected adapter: {:?}", adapter.get_info());
17+
18+
adapter
19+
}
20+
21+
#[test]
22+
pub fn multi_instance() {
23+
{
24+
env_logger::init();
25+
26+
// Sequential instances.
27+
for _ in 0..3 {
28+
pollster::block_on(get());
29+
}
30+
31+
// Concurrent instances
32+
let _instances: Vec<_> = (0..3).map(|_| pollster::block_on(get())).collect();
33+
}
34+
}
35+
}
36+
137
mod request_adapter_error {
238
fn id(backends: wgpu::Backends) -> wgpu::InstanceDescriptor {
339
wgpu::InstanceDescriptor {

0 commit comments

Comments
 (0)