Skip to content

Commit

Permalink
Run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
beaufortfrancois committed Mar 4, 2024
1 parent 3822458 commit 6057e70
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 127 deletions.
7 changes: 4 additions & 3 deletions src/common/runtime/helper/test_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ export class TestServiceWorker {
query: string,
expectations: TestQueryWithExpectation[] = []
): Promise<void> {
const [suite, name] = query.split(":", 2);
const [suite, name] = query.split(':', 2);
const fileName = name.split(',').join('/');
const serviceWorkerPath = `/out/${suite}/webworker/${fileName}.worker.js`;

const registration = await navigator.serviceWorker.register(serviceWorkerPath, {
type: 'module',
scope: '/',
});
await navigator.serviceWorker.ready;
await registration.update();

navigator.serviceWorker.onmessage = ev => {
const query: string = ev.data.query;
Expand All @@ -132,13 +132,14 @@ export class TestServiceWorker {
// update the entire results JSON somehow at some point).
};

registration.active.postMessage({
registration.active?.postMessage({
query,
expectations,
ctsOptions: this.ctsOptions,
});
const serviceWorkerResult = await new Promise<LiveTestCaseResult>(resolve => {
this.resolvers.set(query, resolve);
void registration.unregister();
});
rec.injectResult(serviceWorkerResult);
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/tools/dev_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ app.get('/out/**/*.js', async (req, res, next) => {
return;
}

// FIXME: I'm not sure if this is the way I should handle it...
// I'm not sure if this is the way I should handle it...
const dir = jsUrl.endsWith('worker.js') ? path.resolve(srcDir, '../out') : srcDir;
let absPath = path.join(dir, tsUrl);
if (!fs.existsSync(absPath)) {
Expand Down
33 changes: 17 additions & 16 deletions src/common/tools/gen_listings_and_webworkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ export const listing = ${JSON.stringify(listing, undefined, 2)};
`\
// AUTO-GENERATED - DO NOT EDIT. See ${myself}.
// oldG is a TestGroup<Fixture> object (defined in common/internal/test_group.ts).
import { g as oldG } from '${relPathToSuiteRoot}/${entry.file.join('/')}.spec.js';
// FIXME: Expose a proxied test interface. I think this can completely replace test_worker-worker.js
// (using this instead of that), but if not then hopefully it can at least share code with it.
console.log(oldG.iterate());
// g is a TestGroup<Fixture> object (defined in common/internal/test_group.ts).
import { g } from '${relPathToSuiteRoot}/${entry.file.join('/')}.spec.js';
import { globalTestConfig } from '/out/common/framework/test_config.js';
import { Logger } from '/out/common/internal/logging/logger.js';
import { setDefaultRequestAdapterOptions } from '/out/common/util/navigator_gpu.js';
import { parseQuery } from '/out/common/internal/query/parseQuery.js';
import { comparePublicParamsPaths, Ordering } from '/out/common/internal/query/compare.js';
import { assert } from '/out/common/util/util.js';
async function reportTestResults(ev) {
const query = ev.data.query;
Expand All @@ -109,17 +108,19 @@ async function reportTestResults(ev) {
});
}
// const testcases = Array.from(await loader.loadCases(parseQuery(query)));
// assert(testcases.length === 1, 'worker query resulted in != 1 cases');
// const testcase = testcases[0];
const testcase = { query }; // FIXME! I failed to figure out how to get a testcase from oldG and query ;(
const [rec, result] = log.record(testcase.query.toString());
// await testcase.run(rec, expectations);
result.status = 'pass'; // FIXME
result.timems = 42; // FIXME
const testQuerySingleCase = parseQuery(query);
let testcase = null;
for (const t of g.iterate()) {
for (const c of t.iterate(testQuerySingleCase.params)) {
if (comparePublicParamsPaths(c.id.params, testQuerySingleCase.params) === Ordering.Equal) {
testcase = c;
}
}
}
assert(testcase);
const [rec, result] = log.record(query);
await testcase.run(rec, testQuerySingleCase, expectations);
this.postMessage({ query, result });
}
self.onmessage = (ev) => {
Expand Down
210 changes: 105 additions & 105 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
{
"webgpu/shader/execution/binary/af_addition.bin": "38b261fa",
"webgpu/shader/execution/binary/af_logical.bin": "a483b968",
"webgpu/shader/execution/binary/af_division.bin": "ec39b0da",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "ca1373a8",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "406d99af",
"webgpu/shader/execution/binary/af_multiplication.bin": "2eb6d50d",
"webgpu/shader/execution/binary/af_remainder.bin": "e2b6b21",
"webgpu/shader/execution/binary/af_subtraction.bin": "84794350",
"webgpu/shader/execution/binary/f16_addition.bin": "19e8823d",
"webgpu/shader/execution/binary/f16_logical.bin": "b89ca9b9",
"webgpu/shader/execution/binary/f16_division.bin": "6dc4b748",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "7533842",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "2d799920",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "44e3b295",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "412f0911",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "a231201b",
"webgpu/shader/execution/binary/f16_multiplication.bin": "94b11030",
"webgpu/shader/execution/binary/f16_remainder.bin": "de68a200",
"webgpu/shader/execution/binary/f16_subtraction.bin": "f308327a",
"webgpu/shader/execution/binary/f32_addition.bin": "c87c8c08",
"webgpu/shader/execution/binary/f32_logical.bin": "c7370c09",
"webgpu/shader/execution/binary/f32_division.bin": "34ce65ae",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "f3808d0c",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "e33e7fe5",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "41091ebf",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "37ccb101",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "4d67866",
"webgpu/shader/execution/binary/f32_multiplication.bin": "5d85a36c",
"webgpu/shader/execution/binary/f32_remainder.bin": "62f591b2",
"webgpu/shader/execution/binary/f32_subtraction.bin": "60fc275a",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "a0b0a016",
"webgpu/shader/execution/binary/i32_comparison.bin": "f3d9b3f9",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "16e32fd",
"webgpu/shader/execution/binary/u32_comparison.bin": "da33cc5d",
"webgpu/shader/execution/abs.bin": "1ead834c",
"webgpu/shader/execution/acos.bin": "e25802ba",
"webgpu/shader/execution/acosh.bin": "2321726f",
"webgpu/shader/execution/asin.bin": "d554a73b",
"webgpu/shader/execution/asinh.bin": "d2bdb21b",
"webgpu/shader/execution/atan.bin": "eb6476f3",
"webgpu/shader/execution/atan2.bin": "cf15e7fa",
"webgpu/shader/execution/atanh.bin": "6c57cc3",
"webgpu/shader/execution/bitcast.bin": "a25e9714",
"webgpu/shader/execution/ceil.bin": "8d120ea3",
"webgpu/shader/execution/clamp.bin": "a762ef58",
"webgpu/shader/execution/cos.bin": "a859da89",
"webgpu/shader/execution/cosh.bin": "86abdd85",
"webgpu/shader/execution/cross.bin": "e4556729",
"webgpu/shader/execution/degrees.bin": "1fa19a41",
"webgpu/shader/execution/determinant.bin": "108c3d65",
"webgpu/shader/execution/distance.bin": "77a1baa6",
"webgpu/shader/execution/dot.bin": "d4ac2e8a",
"webgpu/shader/execution/exp.bin": "15539afd",
"webgpu/shader/execution/exp2.bin": "7f6a8523",
"webgpu/shader/execution/faceForward.bin": "e7b35f43",
"webgpu/shader/execution/floor.bin": "b26656ca",
"webgpu/shader/execution/fma.bin": "5a70c683",
"webgpu/shader/execution/fract.bin": "23c0d5ec",
"webgpu/shader/execution/frexp.bin": "d28e66be",
"webgpu/shader/execution/inverseSqrt.bin": "9f297854",
"webgpu/shader/execution/ldexp.bin": "638db0c7",
"webgpu/shader/execution/length.bin": "7d237c62",
"webgpu/shader/execution/log.bin": "70720bf0",
"webgpu/shader/execution/log2.bin": "93a309be",
"webgpu/shader/execution/max.bin": "36eb4779",
"webgpu/shader/execution/min.bin": "ca772bf1",
"webgpu/shader/execution/mix.bin": "ecbf61ae",
"webgpu/shader/execution/modf.bin": "6ddea900",
"webgpu/shader/execution/normalize.bin": "d3e47c61",
"webgpu/shader/execution/pack2x16float.bin": "e6859c1a",
"webgpu/shader/execution/pow.bin": "a58be71c",
"webgpu/shader/execution/quantizeToF16.bin": "eca85bca",
"webgpu/shader/execution/radians.bin": "a216c9aa",
"webgpu/shader/execution/reflect.bin": "ebce9830",
"webgpu/shader/execution/refract.bin": "59d1e5d6",
"webgpu/shader/execution/round.bin": "9389a090",
"webgpu/shader/execution/saturate.bin": "7ca4b681",
"webgpu/shader/execution/sign.bin": "1f4eeb34",
"webgpu/shader/execution/sin.bin": "a1e234b4",
"webgpu/shader/execution/sinh.bin": "1a62054b",
"webgpu/shader/execution/smoothstep.bin": "d5824fd6",
"webgpu/shader/execution/sqrt.bin": "66f21d02",
"webgpu/shader/execution/step.bin": "310cb6c7",
"webgpu/shader/execution/tan.bin": "1e26f533",
"webgpu/shader/execution/tanh.bin": "4c546d1c",
"webgpu/shader/execution/transpose.bin": "7bef2494",
"webgpu/shader/execution/trunc.bin": "e72535eb",
"webgpu/shader/execution/unpack2x16float.bin": "593d88c6",
"webgpu/shader/execution/unpack2x16snorm.bin": "9ebd3e40",
"webgpu/shader/execution/unpack2x16unorm.bin": "83a36fa9",
"webgpu/shader/execution/unpack4x8snorm.bin": "41b12606",
"webgpu/shader/execution/unpack4x8unorm.bin": "96f1850b",
"webgpu/shader/execution/unary/af_arithmetic.bin": "6fa1d84a",
"webgpu/shader/execution/unary/af_assignment.bin": "98c8f82a",
"webgpu/shader/execution/unary/bool_conversion.bin": "dd71f171",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "2f2d38fc",
"webgpu/shader/execution/unary/f16_conversion.bin": "70c94538",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "db90c01c",
"webgpu/shader/execution/unary/f32_conversion.bin": "81912140",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "c69716e2",
"webgpu/shader/execution/unary/i32_conversion.bin": "83218e69",
"webgpu/shader/execution/unary/u32_conversion.bin": "8f5bad00",
"webgpu/shader/execution/unary/ai_assignment.bin": "c7e6ac33",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "81c11ec2",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "3d27dc97"
"webgpu/shader/execution/binary/af_addition.bin": "fc43d206",
"webgpu/shader/execution/binary/af_logical.bin": "3dc912ac",
"webgpu/shader/execution/binary/af_division.bin": "6cbdaf09",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "d61fe049",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "16d18276",
"webgpu/shader/execution/binary/af_multiplication.bin": "ce2a0e9e",
"webgpu/shader/execution/binary/af_remainder.bin": "4032e3cf",
"webgpu/shader/execution/binary/af_subtraction.bin": "67a1c189",
"webgpu/shader/execution/binary/f16_addition.bin": "3edd84a3",
"webgpu/shader/execution/binary/f16_logical.bin": "adcc36e9",
"webgpu/shader/execution/binary/f16_division.bin": "81168258",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "3497729d",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "767e22c7",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "356acec0",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "ed00c0e4",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "f089b873",
"webgpu/shader/execution/binary/f16_multiplication.bin": "4675c758",
"webgpu/shader/execution/binary/f16_remainder.bin": "5ea2af46",
"webgpu/shader/execution/binary/f16_subtraction.bin": "a7962472",
"webgpu/shader/execution/binary/f32_addition.bin": "ef624c29",
"webgpu/shader/execution/binary/f32_logical.bin": "68c1e846",
"webgpu/shader/execution/binary/f32_division.bin": "cc886305",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "b3bab14a",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "afccd9d5",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "c8a022a1",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "b0db93fb",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "d90fbe21",
"webgpu/shader/execution/binary/f32_multiplication.bin": "693597cf",
"webgpu/shader/execution/binary/f32_remainder.bin": "fe630a4b",
"webgpu/shader/execution/binary/f32_subtraction.bin": "e3409ba2",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "bd8d0b9b",
"webgpu/shader/execution/binary/i32_comparison.bin": "aec6e622",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "f5907c7e",
"webgpu/shader/execution/binary/u32_comparison.bin": "7160f1c7",
"webgpu/shader/execution/abs.bin": "c884966",
"webgpu/shader/execution/acos.bin": "3e371b22",
"webgpu/shader/execution/acosh.bin": "25b25012",
"webgpu/shader/execution/asin.bin": "75d5b677",
"webgpu/shader/execution/asinh.bin": "92fe4ad3",
"webgpu/shader/execution/atan.bin": "5a7834a4",
"webgpu/shader/execution/atan2.bin": "79487bb",
"webgpu/shader/execution/atanh.bin": "804ad33f",
"webgpu/shader/execution/bitcast.bin": "69a86c70",
"webgpu/shader/execution/ceil.bin": "46bca9a0",
"webgpu/shader/execution/clamp.bin": "620739ae",
"webgpu/shader/execution/cos.bin": "bd7467e4",
"webgpu/shader/execution/cosh.bin": "315aad98",
"webgpu/shader/execution/cross.bin": "d9a91811",
"webgpu/shader/execution/degrees.bin": "27df6eb0",
"webgpu/shader/execution/determinant.bin": "67380eba",
"webgpu/shader/execution/distance.bin": "91d94128",
"webgpu/shader/execution/dot.bin": "3644a88a",
"webgpu/shader/execution/exp.bin": "786e68bc",
"webgpu/shader/execution/exp2.bin": "454ee68d",
"webgpu/shader/execution/faceForward.bin": "625903d3",
"webgpu/shader/execution/floor.bin": "db4c92f7",
"webgpu/shader/execution/fma.bin": "b049ac43",
"webgpu/shader/execution/fract.bin": "84ce9ec3",
"webgpu/shader/execution/frexp.bin": "5320c481",
"webgpu/shader/execution/inverseSqrt.bin": "7aeff2c0",
"webgpu/shader/execution/ldexp.bin": "71b3930f",
"webgpu/shader/execution/length.bin": "e96b503a",
"webgpu/shader/execution/log.bin": "eba7ec7d",
"webgpu/shader/execution/log2.bin": "54ddf967",
"webgpu/shader/execution/max.bin": "a83a582a",
"webgpu/shader/execution/min.bin": "7c2811c1",
"webgpu/shader/execution/mix.bin": "9aa0305f",
"webgpu/shader/execution/modf.bin": "ca3173c2",
"webgpu/shader/execution/normalize.bin": "3c3a347f",
"webgpu/shader/execution/pack2x16float.bin": "73ddf92f",
"webgpu/shader/execution/pow.bin": "d2c3fd97",
"webgpu/shader/execution/quantizeToF16.bin": "ad3587f0",
"webgpu/shader/execution/radians.bin": "d5f10c52",
"webgpu/shader/execution/reflect.bin": "219e2df",
"webgpu/shader/execution/refract.bin": "fa841745",
"webgpu/shader/execution/round.bin": "74f863ec",
"webgpu/shader/execution/saturate.bin": "457fd49d",
"webgpu/shader/execution/sign.bin": "e44d954c",
"webgpu/shader/execution/sin.bin": "67bac1fd",
"webgpu/shader/execution/sinh.bin": "e37cb02b",
"webgpu/shader/execution/smoothstep.bin": "d279bc42",
"webgpu/shader/execution/sqrt.bin": "551939af",
"webgpu/shader/execution/step.bin": "72cf60af",
"webgpu/shader/execution/tan.bin": "f632f032",
"webgpu/shader/execution/tanh.bin": "72c375cb",
"webgpu/shader/execution/transpose.bin": "e968d355",
"webgpu/shader/execution/trunc.bin": "16f79aa5",
"webgpu/shader/execution/unpack2x16float.bin": "c85da768",
"webgpu/shader/execution/unpack2x16snorm.bin": "3f3dbc81",
"webgpu/shader/execution/unpack2x16unorm.bin": "2862cb20",
"webgpu/shader/execution/unpack4x8snorm.bin": "b4c90280",
"webgpu/shader/execution/unpack4x8unorm.bin": "ab1a627b",
"webgpu/shader/execution/unary/af_arithmetic.bin": "67d2b7eb",
"webgpu/shader/execution/unary/af_assignment.bin": "7964e983",
"webgpu/shader/execution/unary/bool_conversion.bin": "349303eb",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "95908291",
"webgpu/shader/execution/unary/f16_conversion.bin": "df34e3f9",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "dea317cd",
"webgpu/shader/execution/unary/f32_conversion.bin": "fb0ff55a",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "d1b09384",
"webgpu/shader/execution/unary/i32_conversion.bin": "7ae3fc76",
"webgpu/shader/execution/unary/u32_conversion.bin": "a1c35c09",
"webgpu/shader/execution/unary/ai_assignment.bin": "bde2f00d",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "f99fb5b7",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "5784ac67"
}
Binary file modified src/resources/cache/webgpu/shader/execution/bitcast.bin
Binary file not shown.
5 changes: 3 additions & 2 deletions src/webgpu/web_platform/worker/worker_launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,19 @@ export async function launchServiceWorker() {
type: 'module',
scope: '/',
});
await navigator.serviceWorker.ready;
await registration.update();

const promise = new Promise<TestResult>(resolve => {
navigator.serviceWorker.addEventListener(
'message',
ev => {
resolve(ev.data as TestResult);
void registration.unregister();
},
{ once: true }
);
});
registration.active.postMessage({
registration.active?.postMessage({
defaultRequestAdapterOptions: getDefaultRequestAdapterOptions(),
});
return await promise;
Expand Down

0 comments on commit 6057e70

Please sign in to comment.