Files
Reims-Go/frontend/scripts/test-logs.mjs
YXC0915 2e480d99b7 fix(logs): classify successful Metal precision notes as info
Ignore the Metal selector when a QEMU message reports a successful precision note. Reuse the same severity for log rows and the unread-error badge.
2026-12-04 21:23:18 +08:00

32 lines
1.4 KiB
JavaScript

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')
}
})