@@ -134,8 +134,9 @@ const BUILD_OPTS = {
134134 skipRegistry : true ,
135135} ;
136136
137- async function buildEngine ( fixtureDir , engine , label ) {
137+ async function buildEngine ( fixtureDir , engine , label , tempDirs ) {
138138 const dir = mkdtempSync ( join ( tmpdir ( ) , `parity-${ label } -` ) ) ;
139+ tempDirs . push ( dir ) ; // register before await so cleanup runs even if buildGraph throws
139140 cpSync ( fixtureDir , dir , { recursive : true } ) ;
140141 await buildGraph ( dir , { ...BUILD_OPTS , engine } ) ;
141142 return dir ;
@@ -145,8 +146,9 @@ async function buildEngine(fixtureDir, engine, label) {
145146// build on the same dir triggers "Engine changed (wasm -> native), promoting
146147// to full rebuild", which sets forceFullRebuild and skips the orchestrator —
147148// the JS pipeline then drives the napi buildCallEdges resolver.
148- async function buildHybrid ( fixtureDir , label ) {
149+ async function buildHybrid ( fixtureDir , label , tempDirs ) {
149150 const dir = mkdtempSync ( join ( tmpdir ( ) , `parity-${ label } -` ) ) ;
151+ tempDirs . push ( dir ) ; // register before await so cleanup runs even if buildGraph throws
150152 cpSync ( fixtureDir , dir , { recursive : true } ) ;
151153 await buildGraph ( dir , { ...BUILD_OPTS , incremental : true , engine : 'wasm' } ) ;
152154 await buildGraph ( dir , { ...BUILD_OPTS , incremental : true , engine : 'native' } ) ;
@@ -193,6 +195,7 @@ function readMultisets(dir) {
193195function diffMultisets ( base , other ) {
194196 const diffs = [ ] ;
195197 const keys = new Set ( [ ...base . keys ( ) , ...other . keys ( ) ] ) ;
198+ keys . delete ( '__TOTAL_ROWS__' ) ;
196199 for ( const key of keys ) {
197200 const a = base . get ( key ) ?? 0 ;
198201 const b = other . get ( key ) ?? 0 ;
@@ -213,15 +216,13 @@ for (const fixture of fixtures) {
213216 const tempDirs = [ ] ;
214217
215218 try {
216- const wasmDir = await buildEngine ( fixtureDir , 'wasm' , `${ fixture } -wasm` ) ;
217- tempDirs . push ( wasmDir ) ;
219+ const wasmDir = await buildEngine ( fixtureDir , 'wasm' , `${ fixture } -wasm` , tempDirs ) ;
218220 const base = readMultisets ( wasmDir ) ;
219221
220- const variants = [ [ 'native' , await buildEngine ( fixtureDir , 'native' , `${ fixture } -native` ) ] ] ;
221- tempDirs . push ( variants [ 0 ] [ 1 ] ) ;
222+ const nativeDir = await buildEngine ( fixtureDir , 'native' , `${ fixture } -native` , tempDirs ) ;
223+ const variants = [ [ 'native' , nativeDir ] ] ;
222224 if ( hybrid ) {
223- const hybridDir = await buildHybrid ( fixtureDir , `${ fixture } -hybrid` ) ;
224- tempDirs . push ( hybridDir ) ;
225+ const hybridDir = await buildHybrid ( fixtureDir , `${ fixture } -hybrid` , tempDirs ) ;
225226 variants . push ( [ 'hybrid' , hybridDir ] ) ;
226227 }
227228
0 commit comments