// Full PID1 -> storage adapter -> virtio DMA test matrix after the long VM lane. import assert from 'node:assert/strict'; import {readFileSync,writeFileSync,renameSync,mkdtempSync,copyFileSync,existsSync,statfsSync} from 'node:fs'; import {spawn,spawnSync} from 'node:child_process'; import {createHash} from 'node:crypto'; import {join,relative} from 'node:path'; import {fileURLToPath} from 'node:url'; import {setTimeout as delay} from 'node:timers/promises'; const [sequencePath,candidatePath,localPath]=process.argv.slice(2);assert.equal(process.argv.length,5); const read=p=>JSON.parse(readFileSync(p)),artifact=path=>({path,sha256:createHash('sha256').update(readFileSync(path)).digest('hex')}); const directory=mkdtempSync('reports/os-implementation/K2150-el0-storage-queue-'); copyFileSync(fileURLToPath(import.meta.url),join(directory,'harness.mjs.txt')); const candidate=read(candidatePath),local=read(localPath),specPath=candidate.spec.path; assert.equal(candidate.slug,'shutdown-el0-storage');assert.equal(candidate.status,'COMPILED_FEATURE_CANDIDATE'); assert.equal(local.status,'K2146_K2149_LOCAL_VALIDATED');assert.deepEqual(local.candidate,artifact(candidatePath)); const pinsByPath=new Map(); function pinTree(v){if(!v||typeof v!=='object')return;if(v.path&&v.sha256){assert.deepEqual(artifact(v.path),{path:v.path,sha256:v.sha256});pinsByPath.set(v.path,{path:v.path,sha256:v.sha256});}for(const x of Object.values(v))pinTree(x);} pinTree(local);pinTree(candidate);pinTree(read(candidate.userBuild.path)); for(const path of [candidatePath,localPath,'scripts/os-acceptance/k2150-el0-storage-queue-v2.mjs', ...['k2150-el0-storage-guest-runner-v2.mjs','k2150-native-storage-fixture.mjs','k2150-el0-storage-matrix-check-v2.mjs', 'features/k2150-el0-storage-check.mjs','features/k2150-native-check.mjs','feature-progress.mjs','feature-readiness.mjs', 'features/k2150-capture-check.mjs','paused-capture-qmp.mjs','dma-gdb.mjs','dma-network.mjs','file-map-disk.mjs'].map(p=>'scripts/os-acceptance/'+p)])pinTree(artifact(path)); pinTree(artifact('reports/os-implementation/K2150-capture-v2-smoke-check-Vzu5oe/report.json')); const pins=[...pinsByPath.values()],statePath='reports/os-implementation/active-development-continuation.json'; function atomic(path,data){writeFileSync(path+'.el0-tmp',JSON.stringify(data,null,2)+'\n');renameSync(path+'.el0-tmp',path);} function verify(){for(const pin of pins)assert.deepEqual(artifact(pin.path),pin);} function save(status,extra={}){ const report={status,guestAccepted:false,productAccepted:false,scope:'Full EL0 and physical disk matrix. Roadmap admission requires all 54 cases and the dedicated raw evidence validator.', sequencePath,candidate:artifact(candidatePath),local:artifact(localPath),pins,...extra}; atomic(join(directory,'report.json'),report); const state=read(statePath);Object.assign(state.K2150,{el0StorageQueue:join(directory,'report.json'),el0StorageQueueStatus:status,...extra}); state.updatedAt=new Date().toISOString();atomic(statePath,state); } async function run(executable,args,log){ const child=spawn(executable,args,{stdio:['ignore','pipe','pipe'],env:{...process.env,FX_PROFILES:'all'}});let output=''; for(const stream of [child.stdout,child.stderr])stream.on('data',bytes=>{output+=bytes;writeFileSync(log,output);}); const code=await new Promise((resolve,reject)=>{child.once('error',reject);child.once('exit',resolve);}); assert.equal(code,0,'command failed; preserved log: '+log);return output; } const lastJson=output=>JSON.parse(output.trim().split('\n').at(-1)); writeFileSync('/tmp/turkos-k2150-el0-storage-queue.txt',directory+'\n'); let matrix,proof,admitted=false; try{ verify();save('EL0_STORAGE_MATRIX_WAITING');console.log('EL0-STORAGE-QUEUE '+directory); let sequence; for(;;){ sequence=read(sequencePath);assert.ok(['PROFILE_COLLECTION_ACTIVE','LONG_WORKLOAD_PROFILE_COMPONENTS_PASSED','LONG_WORKLOAD_PROFILE_SEQUENCE_FAILED'].includes(sequence.status)); if(sequence.status!=='PROFILE_COLLECTION_ACTIVE')break; await delay(30000); } verify(); const processes=spawnSync('ps',['-axo','pid=,comm='],{encoding:'utf8'});assert.equal(processes.status,0); assert.ok(!processes.stdout.split('\n').some(l=>l.trim().endsWith('qemu-system-aarch64')),'one guest lane only'); const disk=statfsSync('.');assert.ok(disk.bavail*disk.bsize>1.5*1024**3,'insufficient space for immutable 54-case evidence'); save('EL0_STORAGE_MATRIX_RUNNING',{predecessorSequenceStatus:sequence.status}); const terminal=lastJson(await run('node',['scripts/os-acceptance/k2150-el0-storage-guest-runner-v2.mjs',candidatePath],join(directory,'guest.log'))); assert.equal(terminal.status,'RUNNER_PASSED');matrix=terminal.matrix; verify(); const result=lastJson(await run('node',['scripts/os-acceptance/k2150-el0-storage-matrix-check-v2.mjs',matrix,candidatePath,localPath],join(directory,'physical-check.log'))); assert.equal(result.status,'K2150_FEATURE_DEVELOPMENT_MATRIX_VALIDATED');proof=result.report; await run('node',['scripts/os-acceptance/feature-progress.mjs','guest',specPath,proof],join(directory,'progress.log')); admitted=true; await run('node',['scripts/os-acceptance/feature-readiness.mjs',specPath,proof],join(directory,'readiness.log')); save('EL0_STORAGE_MATRIX_PASSED',{matrix,physicalMatrix:proof,guestAccepted:true,physicalStorageVerified:true}); }catch(error){ save(proof?'EL0_STORAGE_ADMISSION_FAILED':'EL0_STORAGE_MATRIX_FAILED',{error:error.stack,matrix:matrix??null,physicalMatrix:proof??null,guestAccepted:admitted,physicalStorageVerified:Boolean(proof)});console.error(error.stack);process.exitCode=1; } try{ for(const deadline=Date.now()+1800000;existsSync('reports/site-publication/publish.lock');){assert.ok(Date.now()