summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/tools/websocket-logger
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /dom/webgpu/tests/cts/checkout/tools/websocket-logger
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/tools/websocket-logger')
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/websocket-logger/.gitignore1
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/websocket-logger/README.md9
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/websocket-logger/main.js25
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/websocket-logger/package-lock.json39
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/websocket-logger/package.json14
5 files changed, 88 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/tools/websocket-logger/.gitignore b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/.gitignore
new file mode 100644
index 0000000000..1c0f45a79c
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/.gitignore
@@ -0,0 +1 @@
+/wslog-*.txt
diff --git a/dom/webgpu/tests/cts/checkout/tools/websocket-logger/README.md b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/README.md
new file mode 100644
index 0000000000..1328f12e97
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/README.md
@@ -0,0 +1,9 @@
+This simple utility receives messages via a WebSocket and writes them out to both the command line
+and a file called `wslog-TIMESTAMP.txt` in the working directory.
+
+It can be used to receive logs from CTS in a way that's resistant to test crashes and totally
+independent of which runtime is being used (e.g. standalone, WPT, Node).
+It's used in particular to capture timing results for predefining "chunking" of the CTS for WPT.
+
+To set up, use `npm ci`.
+To launch, use `npm start`.
diff --git a/dom/webgpu/tests/cts/checkout/tools/websocket-logger/main.js b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/main.js
new file mode 100755
index 0000000000..4a5a89e762
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/main.js
@@ -0,0 +1,25 @@
+#!/usr/bin/env node
+
+import fs from 'fs/promises';
+import { WebSocketServer } from 'ws';
+
+const wss = new WebSocketServer({ port: 59497 });
+
+const timestamp = new Date().toISOString().slice(0, 19).replace(/[:]/g, '-')
+const filename = `wslog-${timestamp}.txt`
+const f = await fs.open(filename, 'w');
+console.log(`Writing to ${filename}`);
+console.log('Ctrl-C to stop');
+
+process.on('SIGINT', () => {
+ console.log(`\nWritten to ${filename}`);
+ process.exit();
+});
+
+wss.on('connection', async ws => {
+ ws.on('message', data => {
+ const s = data.toString();
+ f.write(s + '\n');
+ console.log(s);
+ });
+});
diff --git a/dom/webgpu/tests/cts/checkout/tools/websocket-logger/package-lock.json b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/package-lock.json
new file mode 100644
index 0000000000..b43ae34804
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/package-lock.json
@@ -0,0 +1,39 @@
+{
+ "name": "websocket-logger",
+ "version": "0.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "websocket-logger",
+ "version": "0.0.0",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "ws": "^8.13.0"
+ },
+ "bin": {
+ "websocket-logger": "main.js"
+ }
+ },
+ "node_modules/ws": {
+ "version": "8.13.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
+ "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ }
+ }
+}
diff --git a/dom/webgpu/tests/cts/checkout/tools/websocket-logger/package.json b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/package.json
new file mode 100644
index 0000000000..66585968bd
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/websocket-logger/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "websocket-logger",
+ "version": "0.0.0",
+ "author": "WebGPU CTS Contributors",
+ "private": true,
+ "license": "BSD-3-Clause",
+ "type": "module",
+ "scripts": {
+ "start": "node main.js"
+ },
+ "dependencies": {
+ "ws": "^8.13.0"
+ }
+}