From 6deab72a0041e57127bfc45882f5f036d9520bc5 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Fri, 10 May 2024 16:35:47 -0700 Subject: [PATCH] test(webgpu): remove `Deno.resources()` usage (#4708) --- webgpu/_test_util.ts | 11 ----------- webgpu/create_capture_test.ts | 4 ++-- webgpu/texture_with_data_test.ts | 4 ++-- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/webgpu/_test_util.ts b/webgpu/_test_util.ts index 4221206c1dd3..776a210f2d46 100644 --- a/webgpu/_test_util.ts +++ b/webgpu/_test_util.ts @@ -29,14 +29,3 @@ const isLinuxOrMacCI = const isWsl = await checkIsWsl(); 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])); -} diff --git a/webgpu/create_capture_test.ts b/webgpu/create_capture_test.ts index 95373b8f71dc..63f78a1fbbdd 100644 --- a/webgpu/create_capture_test.ts +++ b/webgpu/create_capture_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. 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"; Deno.test({ @@ -30,6 +30,6 @@ Deno.test({ GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, ); - cleanUp(device); + device.destroy(); }, }); diff --git a/webgpu/texture_with_data_test.ts b/webgpu/texture_with_data_test.ts index 69bc8c2e44b6..646b6a997b4e 100644 --- a/webgpu/texture_with_data_test.ts +++ b/webgpu/texture_with_data_test.ts @@ -2,7 +2,7 @@ import { assert } from "@std/assert/assert"; import { createTextureWithData } from "./texture_with_data.ts"; -import { cleanUp, ignore } from "./_test_util.ts"; +import { ignore } from "./_test_util.ts"; Deno.test({ ignore, @@ -22,6 +22,6 @@ Deno.test({ usage: GPUTextureUsage.COPY_SRC, }, new Uint8Array([1, 1, 1, 1, 1, 1, 1])); - cleanUp(device); + device.destroy(); }, });