import assert from 'node:assert/strict'; import {nativeFixture} from './native_combined_fixture.mjs'; import {checkNativeOwnership} from '../../scripts/os-acceptance/features/k2155-native-ownership-check.mjs'; import {checkNativeWorkers} from '../../scripts/os-acceptance/features/k2155-native-worker-check.mjs'; import {checkNativeIrqs} from '../../scripts/os-acceptance/features/k2155-native-irq-check.mjs'; import {checkNativeDma} from '../../scripts/os-acceptance/features/k2155-native-dma-check.mjs'; const rejected=[]; for(const first of [100,110])for(const tco of [0n,1n<<25n]){ const input=nativeFixture(first,tco); assert.equal(checkNativeOwnership(input).ownedPages,34);assert.equal(checkNativeWorkers(input).workers,2); assert.equal(checkNativeIrqs(input).handlerEretVerified,true);assert.equal(checkNativeDma(input).queues,3); const mutations=[ ['bad-block-head',210,'dma-0-0-2',4],['block-status-error',210,'dma-0-0-3',16],['wrong-sector',210,'dma-0-0-3',512], ['wrong-block-address',210,'dma-0-0-0',0],['early-network-submission',210,'dma-1-0-1',2],['early-rx-completion',30,'dma-1-0-2',2], ['wrong-rx-length',40,'dma-1-0-2',8],['wrong-rx-nonce',40,'dma-1-0-3',26],['wrong-tx-nonce',211,'dma-1-1-3',26], ['wrong-tx-flags',211,'dma-1-1-0',12],['rx-buffer-overrun',40,'dma-1-0-3',2048],['rx-offload-header',40,'dma-1-0-3',0], ['block-ready-stuck',50,'mmio-0-ready',0],['net-tx-ready-stuck',50,'mmio-1-ready',0],['net-rx-ready-stuck',230,'mmio-1-ready',0], ['wrong-rx-selection',230,'OS_K2155_DMA_DEVICES',(64+11)*8],['device-not-reset',50,'mmio-1-status',0],['interrupt-not-reset',50,'mmio-1-interrupt',0], ['release-before-scrub',60,'dma-0-0-3',0],['released-rx-not-zero',70,'dma-1-0-2',0], ['false-fresh-callback-view',210,'OS_K2155_DMA_DEVICES',16*8],['wrong-device',30,'mmio-1-device',0], ['wrong-phase',30,'OS_K2155_NATIVE_STATE',8],['wrong-device-epoch',20,'OS_K2155_NATIVE_STATE',32],['wrong-owner',10,'OS_K2155_NATIVE_STATE',40], ['wrong-generation',10,'OS_K2155_NATIVE_STATE',48],['wrong-owned-pages',10,'OS_K2155_NATIVE_STATE',56],['admission-open',10,'OS_K2155_NATIVE_STATE',64], ['irq-unmasked',20,'OS_K2155_NATIVE_STATE',72],['handler-still-active',20,'OS_K2155_NATIVE_STATE',80],['worker-still-running',30,'OS_K2155_NATIVE_STATE',88], ['dma-not-drained',40,'OS_K2155_NATIVE_STATE',96],['backend-device-not-reset',50,'OS_K2155_NATIVE_STATE',104],['backend-queue-not-reset',50,'OS_K2155_NATIVE_STATE',112], ['fake-reclamation',50,'OS_K2155_NATIVE_STATE',120],['wrong-free-count',60,'OS_K2155_NATIVE_STATE',128],['false-release-attempt',60,'OS_K2155_NATIVE_STATE',144], ['deadline-extended',30,'OS_K2155_NATIVE_STATE',160],['unaccounted-state',30,'OS_K2155_NATIVE_STATE',168], ]; for(const[name,stage,key,offset]of mutations){const snapshots=input.snapshots.map(s=>({...s})),i=snapshots.findIndex(s=>Number(s.OS_K2155_EVIDENCE.readBigUInt64LE(8))===stage);snapshots[i][key]=Buffer.from(snapshots[i][key]);snapshots[i][key][offset]^=1; assert.throws(()=>checkNativeDma({...input,snapshots}),name);rejected.push(first+':'+tco+':'+name);} for(const[name,exchange]of [['host-send-before-workers-stop',{...input.exchange,afterCapturedStage:20}],['extra-rx-packet',{...input.exchange,sentCount:3}],['stale-host-packet',{...input.exchange,rx:'00'.repeat(60)}]]){ assert.throws(()=>checkNativeDma({...input,exchange}),name);rejected.push(first+':'+tco+':'+name);} } console.log(JSON.stringify({status:'NATIVE_COMBINED_HOST_TESTS_PASSED',syntheticFixture:true,positiveFixtures:4,subproofsPerFixture:4,rejected,guestAccepted:false,productAccepted:false,physicalIntegratedShutdownVerified:false}));