Generate and load CTS cache

Cache .json files are generated at build time. This relies on a
list of the expected cache outputs.

The path to the cache is hardcoded in the test_runner and the
.json files are loaded at runtime.

Change-Id: Icc125125df7e9c338a243526dbc4950a2517039f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110441
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Austin Eng
2022-11-21 15:16:51 +00:00
committed by Dawn LUCI CQ
parent 8bc64636cf
commit 92b32e8efc
3 changed files with 79 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
// limitations under the License.
import { globalTestConfig } from '../third_party/webgpu-cts/src/common/framework/test_config.js';
import { dataCache } from '../third_party/webgpu-cts/src/common/framework/data_cache.js';
import { DefaultTestFileLoader } from '../third_party/webgpu-cts/src/common/internal/file_loader.js';
import { prettyPrintLog } from '../third_party/webgpu-cts/src/common/internal/logging/log_message.js';
import { Logger } from '../third_party/webgpu-cts/src/common/internal/logging/logger.js';
@@ -98,6 +99,12 @@ async function runCtsTestViaSocket(event) {
runCtsTest(input['q'], input['w']);
}
dataCache.setStore({
load: async (path) => {
return await (await fetch(`/third_party/webgpu-cts/cache/data/${path}`)).text();
}
});
// Make a rate-limited version `sendMessageTestHeartbeat` that executes
// at most once every 500 ms.
const [sendHeartbeat, {