cts: make logging better for Telemetry - Don't send full log messages for passing tests. Telemetry never does anything with such logs, so we shouldn't bother sending them over the websocket. - For non-passing tests, only send non-INFO logs to Telemetry. These show up in the reported failure reason. Removing INFO logs should allow for better LUCI failure clusters. All the other logs are printed to the JS console so they may still be discovered. Bug: 347963252 Change-Id: I760233ba14afc33165c2d746f1c8489f2f56ba2e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/194460 Reviewed-by: Brian Sheedy <bsheedy@google.com> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/webgpu-cts/test_runner.js b/webgpu-cts/test_runner.js index 9178d3e..fcc7086 100644 --- a/webgpu-cts/test_runner.js +++ b/webgpu-cts/test_runner.js
@@ -238,7 +238,22 @@ endHeartbeatScope(); sendMessageTestStatus(res.status, res.timems); - sendMessageTestLog(res.logs); + if (res.status === 'pass') { + // Send an "OK" log. Passing tests don't report logs to Telemetry. + sendMessageTestLogOK(); + } else { + // Log all the logs to the console so they are visible. + if (res.logs) { + // Log the query string first as logs from multiple browsers may be interleaved and prefixed + // with their process id. Logging the test name lets us see what process a test ran in. + console.log(`Logs from ${queryString}`); + for (const l of res.logs) { + console.log(l); + } + } + // Report non-INFO logs to the harness so they don't show up in the LUCI failure reason. + sendMessageTestLog((res.logs || []).filter(l => l.name !== 'INFO')); + } sendMessageTestFinished(); }; await wpt_fn(); @@ -284,8 +299,12 @@ })); } +function sendMessageTestLogOK() { + socket.send('{"type":"TEST_LOG","log":"OK"}'); +} + function sendMessageTestLog(logs) { - splitLogsForPayload((logs ?? []).map(prettyPrintLog).join('\n\n')) + splitLogsForPayload(logs.map(prettyPrintLog).join('\n\n')) .forEach((piece) => { socket.send(JSON.stringify({ 'type': 'TEST_LOG',