test(webgpu): remove Deno.resources() usage (#4708)

This commit is contained in:
Leo Kettmeir 2024-05-10 16:35:47 -07:00 committed by GitHub
parent c53ca87301
commit 6deab72a00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 15 deletions

View File

@ -29,14 +29,3 @@ const isLinuxOrMacCI =
const isWsl = await checkIsWsl(); const isWsl = await checkIsWsl();
export const ignore = isWsl || isLinuxOrMacCI; export const ignore = isWsl || isLinuxOrMacCI;
export function cleanUp(device: GPUDevice) {
device.destroy();
// TODO(lucacasonato): webgpu spec should add a explicit destroy method for
// adapters.
// @ts-ignore Until WebGPU resources cleanup is automatically handled.
const resources = Object.keys(Deno[Deno.internal].core.resources());
// @ts-ignore Until WebGPU resources cleanup is automatically handled.
Deno[Deno.internal].core.close(Number(resources[resources.length - 1]));
}

View File

@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assert, assertEquals } from "@std/assert"; import { assert, assertEquals } from "@std/assert";
import { cleanUp, ignore } from "./_test_util.ts"; import { ignore } from "./_test_util.ts";
import { createCapture } from "./create_capture.ts"; import { createCapture } from "./create_capture.ts";
Deno.test({ Deno.test({
@ -30,6 +30,6 @@ Deno.test({
GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,
); );
cleanUp(device); device.destroy();
}, },
}); });

View File

@ -2,7 +2,7 @@
import { assert } from "@std/assert/assert"; import { assert } from "@std/assert/assert";
import { createTextureWithData } from "./texture_with_data.ts"; import { createTextureWithData } from "./texture_with_data.ts";
import { cleanUp, ignore } from "./_test_util.ts"; import { ignore } from "./_test_util.ts";
Deno.test({ Deno.test({
ignore, ignore,
@ -22,6 +22,6 @@ Deno.test({
usage: GPUTextureUsage.COPY_SRC, usage: GPUTextureUsage.COPY_SRC,
}, new Uint8Array([1, 1, 1, 1, 1, 1, 1])); }, new Uint8Array([1, 1, 1, 1, 1, 1, 1]));
cleanUp(device); device.destroy();
}, },
}); });