summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/tools
diff options
context:
space:
mode:
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/tools')
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/checklist11
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/dev_server4
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/index.js6
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/package.json8
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/tabs-anywhere.js29
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/trailing-space-anywhere.js29
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/gen_cache4
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/gen_listings7
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/gen_version33
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_chunked2sec.json6
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_unchunked.json5
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/gen_wpt_cts_html39
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/merge_listing_times9
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/run_deno3
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/run_node6
-rw-r--r--dom/webgpu/tests/cts/checkout/tools/run_wpt_ref_tests4
-rwxr-xr-xdom/webgpu/tests/cts/checkout/tools/validate6
-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
22 files changed, 297 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/tools/checklist b/dom/webgpu/tests/cts/checkout/tools/checklist
new file mode 100755
index 0000000000..8aace4f387
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/checklist
@@ -0,0 +1,11 @@
+#!/usr/bin/env node
+
+// Takes a list of queries and checks that:
+// - Every query matches something in the repository
+// - Every case in the repository matches exactly one query
+// This is used to ensure that tracking spreadsheet is complete (not missing any tests)
+// and every query in it is valid (e.g. renames have been applied, and new tests added
+// to the spreadsheet have also been added to the CTS).
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/tools/checklist.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/dev_server b/dom/webgpu/tests/cts/checkout/tools/dev_server
new file mode 100755
index 0000000000..d400d79c19
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/dev_server
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/tools/dev_server.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/index.js b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/index.js
new file mode 100644
index 0000000000..1f5bb211aa
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/index.js
@@ -0,0 +1,6 @@
+module.exports = {
+ rules: {
+ 'string-trailing-space': require('./trailing-space-anywhere'),
+ 'string-tabs': require('./tabs-anywhere'),
+ },
+};
diff --git a/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/package.json b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/package.json
new file mode 100644
index 0000000000..5685ebfa3c
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "eslint-plugin-gpuweb-cts",
+ "version": "0.0.0",
+ "author": "WebGPU CTS Contributors",
+ "private": true,
+ "license": "BSD-3-Clause",
+ "main": "index.js"
+}
diff --git a/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/tabs-anywhere.js b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/tabs-anywhere.js
new file mode 100644
index 0000000000..82238f8615
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/tabs-anywhere.js
@@ -0,0 +1,29 @@
+module.exports = {
+ meta: {
+ type: 'suggestion',
+ docs: {
+ description: 'Indentation tabs are not allowed, even in multiline strings, due to WPT lint rules. This rule simply disallows tabs anywhere.',
+ },
+ schema: [],
+ },
+ create: context => {
+ const sourceCode = context.getSourceCode();
+
+ return {
+ Program: node => {
+ for (let lineIdx = 0; lineIdx < sourceCode.lines.length; ++lineIdx) {
+ const line = sourceCode.lines[lineIdx];
+ const matches = line.matchAll(/\t/g);
+ for (const match of matches) {
+ context.report({
+ node,
+ loc: { line: lineIdx + 1, column: match.index },
+ message: 'Tabs not allowed.',
+ // fixer is hard to implement, so not implemented.
+ });
+ }
+ }
+ },
+ };
+ },
+};
diff --git a/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/trailing-space-anywhere.js b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/trailing-space-anywhere.js
new file mode 100644
index 0000000000..811b379ff6
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/eslint-plugin-gpuweb-cts/trailing-space-anywhere.js
@@ -0,0 +1,29 @@
+module.exports = {
+ meta: {
+ type: 'suggestion',
+ docs: {
+ description: 'Trailing spaces are not allowed, even in multiline strings, due to WPT lint rules.',
+ },
+ schema: [],
+ },
+ create: context => {
+ const sourceCode = context.getSourceCode();
+
+ return {
+ Program: node => {
+ for (let lineIdx = 0; lineIdx < sourceCode.lines.length; ++lineIdx) {
+ const line = sourceCode.lines[lineIdx];
+ const match = /\s+$/.exec(line);
+ if (match) {
+ context.report({
+ node,
+ loc: { line: lineIdx + 1, column: match.index },
+ message: 'Trailing spaces not allowed.',
+ // fixer is hard to implement, so not implemented.
+ });
+ }
+ }
+ },
+ };
+ },
+};
diff --git a/dom/webgpu/tests/cts/checkout/tools/gen_cache b/dom/webgpu/tests/cts/checkout/tools/gen_cache
new file mode 100755
index 0000000000..fd7bf52c2f
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/gen_cache
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/tools/gen_cache.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/gen_listings b/dom/webgpu/tests/cts/checkout/tools/gen_listings
new file mode 100755
index 0000000000..6c25622423
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/gen_listings
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+
+// Crawl a suite directory (e.g. src/webgpu/) to generate a listing.js containing
+// the listing of test files in the suite.
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/tools/gen_listings.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/gen_version b/dom/webgpu/tests/cts/checkout/tools/gen_version
new file mode 100755
index 0000000000..53128ca2a0
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/gen_version
@@ -0,0 +1,33 @@
+#!/usr/bin/env node
+
+// Get the current git hash, and save (overwrite) it into out/framework/version.js
+// so it can be read when running inside the browser.
+
+/* eslint-disable no-console */
+
+require('../src/common/tools/setup-ts-in-node.js');
+const fs = require('fs');
+
+const myself = 'tools/gen_version';
+if (!fs.existsSync(myself)) {
+ console.error('Must be run from repository root');
+ process.exit(1);
+}
+
+const { version } = require('../src/common/tools/version.ts');
+
+fs.mkdirSync('./out/common/internal', { recursive: true });
+// Overwrite the version.js generated by TypeScript compilation.
+fs.writeFileSync(
+ './out/common/internal/version.js',
+ `\
+// AUTO-GENERATED - DO NOT EDIT. See ${myself}.
+
+export const version = '${version}';
+`
+);
+
+// Since the generated version.js was overwritten, its source map is no longer relevant.
+try {
+ fs.unlinkSync('./out/common/internal/version.js.map');
+} catch (ex) { }
diff --git a/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_chunked2sec.json b/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_chunked2sec.json
new file mode 100644
index 0000000000..1d13e85c58
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_chunked2sec.json
@@ -0,0 +1,6 @@
+{
+ "suite": "webgpu",
+ "out": "../out-wpt/cts-chunked2sec.https.html",
+ "template": "../src/common/templates/cts.https.html",
+ "maxChunkTimeMS": 2000
+}
diff --git a/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_unchunked.json b/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_unchunked.json
new file mode 100644
index 0000000000..ffe06d5633
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cfg_unchunked.json
@@ -0,0 +1,5 @@
+{
+ "suite": "webgpu",
+ "out": "../out-wpt/cts.https.html",
+ "template": "../src/common/templates/cts.https.html"
+}
diff --git a/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cts_html b/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cts_html
new file mode 100755
index 0000000000..07f1f465c7
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/gen_wpt_cts_html
@@ -0,0 +1,39 @@
+#!/usr/bin/env node
+
+// Generate a top-level cts.https.html file for WPT.
+//
+// In the default invocation (used by grunt), just generates a cts.https.html with one "variant"
+// per test spec file (.spec.ts).
+//
+// In the advanced invocation, generate a list of variants, which are broken down as much as needed
+// to accommodate a provided list of suppressions, and no further. This reduces the total runtime of
+// the test suite by not generating an entire page load for every single test case.
+// The resulting cts.https.html can be checked in and used to run tests within browser harnesses.
+//
+// For example, for the following 9 cases:
+//
+// webgpu:a/foo:foo1={"x":1}
+// webgpu:a/foo:foo1={"x":2}
+// webgpu:a/foo:foo2={"x":1}
+// webgpu:a/foo:foo2={"x":2}
+// webgpu:a/bar:bar1={"x":1}
+// webgpu:a/bar:bar1={"x":2}
+// webgpu:a/bar:bar1={"x":3}
+// webgpu:a/bar:bar2={"x":1}
+// webgpu:a/bar:bar2={"x":2}
+//
+// and the following suppressions:
+//
+// [ Win ] ?q=webgpu:a/bar:bar1={"x":1} [ Failure ]
+// [ Mac ] ?q=webgpu:a/bar:bar1={"x":3} [ Failure ]
+//
+// the following list of 5 variants gives enough granularity to suppress only the failing cases:
+//
+// ?q=webgpu:a/foo:
+// ?q=webgpu:a/bar:bar1={"x":1} <- [ Win ]
+// ?q=webgpu:a/bar:bar1={"x":2}
+// ?q=webgpu:a/bar:bar1={"x":3} <- [ Mac ]
+// ?q=webgpu:a/bar:bar2~
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/tools/gen_wpt_cts_html.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/merge_listing_times b/dom/webgpu/tests/cts/checkout/tools/merge_listing_times
new file mode 100755
index 0000000000..a9bcd2e71a
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/merge_listing_times
@@ -0,0 +1,9 @@
+#!/usr/bin/env node
+
+// See `docs/adding_timing_metadata.md` for an explanation of listing times, and
+// a walkthrough on adding entries for new tests.
+
+require('../src/common/tools/setup-ts-in-node.js');
+
+// See the help message in this file for info on how to use the tool.
+require('../src/common/tools/merge_listing_times.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/run_deno b/dom/webgpu/tests/cts/checkout/tools/run_deno
new file mode 100755
index 0000000000..8cc89a475c
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/run_deno
@@ -0,0 +1,3 @@
+#!/usr/bin/env -S deno run --unstable --allow-read --allow-write --allow-env --allow-net=deno.land --no-check
+
+import '../out/common/runtime/cmdline.js'; \ No newline at end of file
diff --git a/dom/webgpu/tests/cts/checkout/tools/run_node b/dom/webgpu/tests/cts/checkout/tools/run_node
new file mode 100755
index 0000000000..b71ec9f134
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/run_node
@@ -0,0 +1,6 @@
+#!/usr/bin/env node
+
+// Run test suites under node.
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/runtime/cmdline.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/run_wpt_ref_tests b/dom/webgpu/tests/cts/checkout/tools/run_wpt_ref_tests
new file mode 100644
index 0000000000..79fd1b1b7c
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/run_wpt_ref_tests
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/tools/run_wpt_ref_tests.ts');
diff --git a/dom/webgpu/tests/cts/checkout/tools/validate b/dom/webgpu/tests/cts/checkout/tools/validate
new file mode 100755
index 0000000000..03b3a61bb1
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/tools/validate
@@ -0,0 +1,6 @@
+#!/usr/bin/env node
+
+// Validate several properties of test files and the tests in them.
+
+require('../src/common/tools/setup-ts-in-node.js');
+require('../src/common/tools/validate.ts');
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"
+ }
+}