import assert from 'node:assert/strict' import test from 'node:test' import { loadTestModule } from './load-test-module.mjs' const { createLogLine } = await loadTestModule(`export * from './lib/logs'`) const renderSelector = 'newRenderPipelineStateWithDescriptor:error:' const computeSelector = 'newComputePipelineStateWithDescriptor:options:reflection:error:' const precisionNote = (selector, code) => `[QEMU] reims-vgpu: ${selector}: metal2vulkan-runtime made it with a precision note (metal2vulkan-degrade-${code}): its answers there can differ from Metal's on this device; the first of its kind, each make that carries it counted` test('successful render and compute precision notes keep their text as informational logs', () => { for (const line of [ precisionNote(renderSelector, 'device-denormals'), precisionNote(computeSelector, 'simdgroup-access-order'), ]) { const row = createLogLine({ line }) assert.equal(row.level, 'info') assert.equal(row.line, line) } }) test('pipeline refusals and fatal errors retain their error level', () => { for (const line of [ `[QEMU] reims-vgpu: platform call ${renderSelector}: the runtime refused it`, '[QEMU] reims-vgpu: fatal: Vulkan device was lost', `${precisionNote(renderSelector, 'device-denormals')}; error: failed to submit the command buffer`, ]) { assert.equal(createLogLine({ line }).level, 'error') } })