Strip subcase params from logs reported to Telemetry

Bug: 347963252
Change-Id: I836f768105b0103eb35e82c4ad482a8ca640b2a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/194954
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/webgpu-cts/test_runner.js b/webgpu-cts/test_runner.js
index fcc7086..9342a22 100644
--- a/webgpu-cts/test_runner.js
+++ b/webgpu-cts/test_runner.js
@@ -225,6 +225,10 @@
 
   const name = testcase.query.toString();
 
+  // Logs look like: " - EXPECTATION FAILED: subcase: foobar=2;foo=a;bar=2\n...."
+  // or "EXCEPTION: Name!: Message!\nsubcase: fail = true\n..."
+  const subcaseLogPrefixRegex = /\s?subcase: .*$/m;
+
   const wpt_fn = async () => {
     sendMessageTestStarted();
     const [rec, res] = log.record(name);
@@ -252,7 +256,11 @@
         }
       }
       // 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'));
+      // Strip out subcase information for better clustering.
+      sendMessageTestLog((res.logs || [])
+        .filter(l => l.name !== 'INFO')
+        .map(prettyPrintLog)
+        .map(l => l.replace(subcaseLogPrefixRegex, '')));
     }
     sendMessageTestFinished();
   };
@@ -304,7 +312,7 @@
 }
 
 function sendMessageTestLog(logs) {
-  splitLogsForPayload(logs.map(prettyPrintLog).join('\n\n'))
+  splitLogsForPayload(logs.join('\n\n'))
     .forEach((piece) => {
       socket.send(JSON.stringify({
         'type': 'TEST_LOG',