File tree Expand file tree Collapse file tree
tests/tests/wgpu-gpu/passthrough Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,6 +96,14 @@ static METAL_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::ne
9696 . run_sync ( metal_test) ;
9797
9898fn metallib_source ( test_hash : u64 ) -> Cow < ' static , [ u8 ] > {
99+ struct FileDropGuard < ' a > {
100+ file_name : & ' a str ,
101+ }
102+ impl Drop for FileDropGuard < ' _ > {
103+ fn drop ( & mut self ) {
104+ let _ = std:: fs:: remove_file ( self . file_name ) ;
105+ }
106+ }
99107 if cfg ! ( not( target_vendor = "apple" ) ) {
100108 return Cow :: Borrowed ( & [ ] ) ;
101109 }
@@ -119,6 +127,10 @@ fn metallib_source(test_hash: u64) -> Cow<'static, [u8]> {
119127 env!( "CARGO_MANIFEST_DIR" )
120128 ) ;
121129
130+ let _air_drop_guard = FileDropGuard {
131+ file_name : & air_name,
132+ } ;
133+
122134 {
123135 let output = std:: process:: Command :: new ( "xcrun" )
124136 . args ( [
@@ -140,6 +152,11 @@ fn metallib_source(test_hash: u64) -> Cow<'static, [u8]> {
140152 ) ;
141153 }
142154 }
155+
156+ let _metallib_drop_guard = FileDropGuard {
157+ file_name : & output_name,
158+ } ;
159+
143160 {
144161 let output = std:: process:: Command :: new ( "xcrun" )
145162 . args ( [ "metallib" , & air_name, "-o" , & output_name] )
You can’t perform that action at this time.
0 commit comments