summaryrefslogtreecommitdiff
path: root/cli/tests/unit/webgpu_test.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-03-30 20:56:28 -0400
committerGitHub <noreply@github.com>2022-03-30 20:56:28 -0400
commit1d24b2cf6335d18ccf8c9c9840fd466011f546c3 (patch)
tree24a78f653f0dfba62dd3b43cf55a84ee149931ad /cli/tests/unit/webgpu_test.ts
parentd069360c46f35d51ccc985dc988cf42662669e94 (diff)
chore: disable wgpu tests in WSL (#14157)
Diffstat (limited to 'cli/tests/unit/webgpu_test.ts')
-rw-r--r--cli/tests/unit/webgpu_test.ts29
1 files changed, 23 insertions, 6 deletions
diff --git a/cli/tests/unit/webgpu_test.ts b/cli/tests/unit/webgpu_test.ts
index b1b3b1ecb..6ecf27fd0 100644
--- a/cli/tests/unit/webgpu_test.ts
+++ b/cli/tests/unit/webgpu_test.ts
@@ -7,11 +7,16 @@ try {
isCI = true;
}
-// Skip this test on linux CI, because the vulkan emulator is not good enough
-// yet, and skip on macOS because these do not have virtual GPUs.
+// Skip these tests on linux CI, because the vulkan emulator is not good enough
+// yet, and skip on macOS CI because these do not have virtual GPUs.
+const isLinuxOrMacCI =
+ (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI;
+// Skip these tests in WSL because it doesn't have good GPU support.
+const isWsl = await checkIsWsl();
+
Deno.test({
permissions: { read: true, env: true },
- ignore: (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI,
+ ignore: isWsl || isLinuxOrMacCI,
}, async function webgpuComputePass() {
const adapter = await navigator.gpu.requestAdapter();
assert(adapter);
@@ -99,11 +104,9 @@ Deno.test({
Deno.close(Number(resources[resources.length - 1]));
});
-// Skip this test on linux CI, because the vulkan emulator is not good enough
-// yet, and skip on macOS because these do not have virtual GPUs.
Deno.test({
permissions: { read: true, env: true },
- ignore: (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI,
+ ignore: isWsl || isLinuxOrMacCI,
}, async function webgpuHelloTriangle() {
const adapter = await navigator.gpu.requestAdapter();
assert(adapter);
@@ -209,3 +212,17 @@ Deno.test({
const resources = Object.keys(Deno.resources());
Deno.close(Number(resources[resources.length - 1]));
});
+
+async function checkIsWsl() {
+ return Deno.build.os === "linux" && await hasMicrosoftProcVersion();
+
+ async function hasMicrosoftProcVersion() {
+ // https://github.com/microsoft/WSL/issues/423#issuecomment-221627364
+ try {
+ const procVersion = await Deno.readTextFile("/proc/version");
+ return /microsoft/i.test(procVersion);
+ } catch {
+ return false;
+ }
+ }
+}