@@ -7,7 +7,7 @@ use wgpu::*;
7
7
8
8
use crate :: TestingContext ;
9
9
10
- #[ cfg( not( target_arch = "wasm32" ) ) ]
10
+ #[ cfg( not( any ( target_arch = "wasm32" , miri ) ) ) ]
11
11
async fn read_png ( path : impl AsRef < Path > , width : u32 , height : u32 ) -> Option < Vec < u8 > > {
12
12
let data = match std:: fs:: read ( & path) {
13
13
Ok ( f) => f,
@@ -45,7 +45,7 @@ async fn read_png(path: impl AsRef<Path>, width: u32, height: u32) -> Option<Vec
45
45
Some ( buffer)
46
46
}
47
47
48
- #[ cfg( not( target_arch = "wasm32" ) ) ]
48
+ #[ cfg( not( any ( target_arch = "wasm32" , miri ) ) ) ]
49
49
async fn write_png (
50
50
path : impl AsRef < Path > ,
51
51
width : u32 ,
@@ -64,15 +64,15 @@ async fn write_png(
64
64
writer. write_image_data ( data) . unwrap ( ) ;
65
65
}
66
66
67
- #[ cfg_attr( target_arch = "wasm32" , allow( unused) ) ]
67
+ #[ cfg_attr( any ( target_arch = "wasm32" , miri ) , allow( unused) ) ]
68
68
fn add_alpha ( input : & [ u8 ] ) -> Vec < u8 > {
69
69
input
70
70
. chunks_exact ( 3 )
71
71
. flat_map ( |chunk| [ chunk[ 0 ] , chunk[ 1 ] , chunk[ 2 ] , 255 ] )
72
72
. collect ( )
73
73
}
74
74
75
- #[ cfg_attr( target_arch = "wasm32" , allow( unused) ) ]
75
+ #[ cfg_attr( any ( target_arch = "wasm32" , miri ) , allow( unused) ) ]
76
76
fn remove_alpha ( input : & [ u8 ] ) -> Vec < u8 > {
77
77
input
78
78
. chunks_exact ( 4 )
@@ -81,7 +81,7 @@ fn remove_alpha(input: &[u8]) -> Vec<u8> {
81
81
. collect ( )
82
82
}
83
83
84
- #[ cfg( not( target_arch = "wasm32" ) ) ]
84
+ #[ cfg( not( any ( target_arch = "wasm32" , miri ) ) ) ]
85
85
fn print_flip ( pool : & mut nv_flip:: FlipPool ) {
86
86
println ! ( "\t Mean: {:.6}" , pool. mean( ) ) ;
87
87
println ! ( "\t Min Value: {:.6}" , pool. min_value( ) ) ;
@@ -115,7 +115,7 @@ pub enum ComparisonType {
115
115
}
116
116
117
117
impl ComparisonType {
118
- #[ cfg( not( target_arch = "wasm32" ) ) ]
118
+ #[ cfg( not( any ( target_arch = "wasm32" , miri ) ) ) ]
119
119
fn check ( & self , pool : & mut nv_flip:: FlipPool ) -> bool {
120
120
match * self {
121
121
ComparisonType :: Mean ( v) => {
@@ -148,7 +148,7 @@ impl ComparisonType {
148
148
}
149
149
}
150
150
151
- #[ cfg( not( target_arch = "wasm32" ) ) ]
151
+ #[ cfg( not( any ( target_arch = "wasm32" , miri ) ) ) ]
152
152
pub async fn compare_image_output (
153
153
path : impl AsRef < Path > + AsRef < OsStr > ,
154
154
adapter_info : & wgpu:: AdapterInfo ,
@@ -250,7 +250,7 @@ pub async fn compare_image_output(
250
250
}
251
251
}
252
252
253
- #[ cfg( target_arch = "wasm32" ) ]
253
+ #[ cfg( any ( target_arch = "wasm32" , miri ) ) ]
254
254
pub async fn compare_image_output (
255
255
path : impl AsRef < Path > + AsRef < OsStr > ,
256
256
adapter_info : & wgpu:: AdapterInfo ,
@@ -259,13 +259,13 @@ pub async fn compare_image_output(
259
259
test_with_alpha : & [ u8 ] ,
260
260
checks : & [ ComparisonType ] ,
261
261
) {
262
- #[ cfg( target_arch = "wasm32" ) ]
262
+ #[ cfg( any ( target_arch = "wasm32" , miri ) ) ]
263
263
{
264
264
let _ = ( path, adapter_info, width, height, test_with_alpha, checks) ;
265
265
}
266
266
}
267
267
268
- #[ cfg_attr( target_arch = "wasm32" , allow( unused) ) ]
268
+ #[ cfg_attr( any ( target_arch = "wasm32" , miri ) , allow( unused) ) ]
269
269
fn sanitize_for_path ( s : & str ) -> String {
270
270
s. chars ( )
271
271
. map ( |ch| if ch. is_ascii_alphanumeric ( ) { ch } else { '_' } )
0 commit comments