summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-12-02 14:43:17 +0100
committerGitHub <noreply@github.com>2022-12-02 14:43:17 +0100
commit4d07ed0efa8f0e2cab1a33f1b7b6a3627bfce69f (patch)
tree898aadf1ae739190ed98ec463824f7e9ca8f48eb /tools
parent6982c74e11ec8294ed5bd53d2a9d316d7e20e7d2 (diff)
chore: rewrite tests and utils to use Deno.Command API (#16895)
Since "Deno.spawn()", "Deno.spawnSync()" and "Deno.spawnChild" are getting deprecated, this commits rewrites all tests and utilities to use "Deno.Command" API instead.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/flamebench.js8
-rw-r--r--tools/util.js4
-rwxr-xr-xtools/wgpu_sync.js4
-rw-r--r--tools/wpt/runner.ts4
-rw-r--r--tools/wpt/utils.ts20
5 files changed, 20 insertions, 20 deletions
diff --git a/tools/flamebench.js b/tools/flamebench.js
index 54705d266..7c79bd10f 100755
--- a/tools/flamebench.js
+++ b/tools/flamebench.js
@@ -3,11 +3,11 @@
import { join, ROOT_PATH as ROOT } from "./util.js";
async function bashOut(subcmd) {
- const { success, stdout } = await Deno.spawn("bash", {
+ const { success, stdout } = await new Deno.Command("bash", {
args: ["-c", subcmd],
stdout: "piped",
stderr: "null",
- });
+ }).output();
// Check for failure
if (!success) {
@@ -20,12 +20,12 @@ async function bashOut(subcmd) {
}
async function bashThrough(subcmd, opts = {}) {
- const { success, code } = await Deno.spawn("bash", {
+ const { success, code } = await new Deno.Command("bash", {
...opts,
args: ["-c", subcmd],
stdout: "inherit",
stderr: "inherit",
- });
+ }).output();
// Exit process on failure
if (!success) {
diff --git a/tools/util.js b/tools/util.js
index d164ca954..49279df58 100644
--- a/tools/util.js
+++ b/tools/util.js
@@ -14,10 +14,10 @@ export { delay } from "../test_util/std/async/delay.ts";
export const ROOT_PATH = dirname(dirname(fromFileUrl(import.meta.url)));
async function getFilesFromGit(baseDir, args) {
- const { success, stdout } = await Deno.spawn("git", {
+ const { success, stdout } = await new Deno.Command("git", {
stderr: "inherit",
args,
- });
+ }).output();
const output = new TextDecoder().decode(stdout);
if (!success) {
throw new Error("gitLsFiles failed");
diff --git a/tools/wgpu_sync.js b/tools/wgpu_sync.js
index 4d343878b..7548c5515 100755
--- a/tools/wgpu_sync.js
+++ b/tools/wgpu_sync.js
@@ -9,12 +9,12 @@ const V_WGPU = "0.13";
const TARGET_DIR = join(ROOT_PATH, "ext", "webgpu");
async function bash(subcmd, opts = {}) {
- const { success, code } = await Deno.spawn("bash", {
+ const { success, code } = await new Deno.Command("bash", {
...opts,
args: ["-c", subcmd],
stdout: "inherit",
sdterr: "inherit",
- });
+ }).output();
// Exit process on failure
if (!success) {
diff --git a/tools/wpt/runner.ts b/tools/wpt/runner.ts
index 269e6ffd1..517ce42b5 100644
--- a/tools/wpt/runner.ts
+++ b/tools/wpt/runner.ts
@@ -107,14 +107,14 @@ export async function runSingleTest(
"[]",
);
- const proc = Deno.spawnChild(denoBinary(), {
+ const proc = new Deno.Command(denoBinary(), {
args,
env: {
NO_COLOR: "1",
},
stdout: "null",
stderr: "piped",
- });
+ }).spawn();
const cases = [];
let stderr = "";
diff --git a/tools/wpt/utils.ts b/tools/wpt/utils.ts
index c77effa62..7614a0c55 100644
--- a/tools/wpt/utils.ts
+++ b/tools/wpt/utils.ts
@@ -118,18 +118,18 @@ export function assert(condition: unknown, message: string): asserts condition {
}
}
-export function runPy<T extends Omit<Deno.SpawnOptions, "cwd">>(
+export function runPy<T extends Omit<Deno.CommandOptions, "cwd">>(
args: string[],
options: T,
-): Deno.Child<T> {
+): Deno.ChildProcess {
const cmd = Deno.build.os == "windows" ? "python.exe" : "python3";
- return Deno.spawnChild(cmd, {
+ return new Deno.Command(cmd, {
args,
stdout: "inherit",
stderr: "inherit",
...options,
cwd: join(ROOT_PATH, "./test_util/wpt/"),
- });
+ }).spawn();
}
export async function checkPy3Available() {
@@ -148,12 +148,12 @@ export async function checkPy3Available() {
export async function cargoBuild() {
if (binary) return;
- const { success } = await Deno.spawn("cargo", {
+ const { success } = await new Deno.Command("cargo", {
args: ["build", ...(release ? ["--release"] : [])],
cwd: ROOT_PATH,
stdout: "inherit",
stderr: "inherit",
- });
+ }).output();
assert(success, "cargo build failed");
}
@@ -175,16 +175,16 @@ export async function generateRunInfo(): Promise<unknown> {
"darwin": "mac",
"linux": "linux",
};
- const proc = await Deno.spawn("git", {
+ const proc = await new Deno.Command("git", {
args: ["rev-parse", "HEAD"],
cwd: join(ROOT_PATH, "test_util", "wpt"),
stderr: "inherit",
- });
+ }).output();
const revision = (new TextDecoder().decode(proc.stdout)).trim();
- const proc2 = await Deno.spawn(denoBinary(), {
+ const proc2 = await new Deno.Command(denoBinary(), {
args: ["eval", "console.log(JSON.stringify(Deno.version))"],
cwd: join(ROOT_PATH, "test_util", "wpt"),
- });
+ }).output();
const version = JSON.parse(new TextDecoder().decode(proc2.stdout));
const runInfo = {
"os": oses[Deno.build.os],