Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacasonato committed Jun 1, 2021
1 parent 43c0f51 commit 03edd5a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/webgpu/gpu_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,13 @@ got [${failedByteActualValues.join(', ')}]`;
}

this.device.pushErrorScope(filter);
const returnValue = fn();
const promise = this.device.popErrorScope();
let returnValue;
let promise: Promise<GPUError | null>;
try {
returnValue = fn();
} finally {
promise = this.device.popErrorScope();
}

this.eventualAsyncExpectation(async niceStack => {
const error = await promise;
Expand Down
10 changes: 8 additions & 2 deletions src/webgpu/util/device_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,20 @@ class DeviceHolder implements DeviceProvider {
);

if (gpuValidationError !== null) {
assert(gpuValidationError instanceof GPUValidationError);
assert(
gpuValidationError instanceof GPUValidationError,
`not a GPUValidationError: ${gpuValidationError.toString()}`
);
// Allow the device to be reused.
throw new TestFailedButDeviceReusable(
`Unexpected validation error occurred: ${gpuValidationError.message}`
);
}
if (gpuOutOfMemoryError !== null) {
assert(gpuOutOfMemoryError instanceof GPUOutOfMemoryError);
assert(
gpuOutOfMemoryError instanceof GPUOutOfMemoryError,
`not a GPUOutOfMemoryError: ${gpuOutOfMemoryError.toString()}`
);
// Don't allow the device to be reused; unexpected OOM could break the device.
throw new TestOOMedShouldAttemptGC('Unexpected out-of-memory error occurred');
}
Expand Down
22 changes: 18 additions & 4 deletions tools/deno
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Logger } from "../out/common/framework/logging/logger.js";
import { parseQuery } from "../out/common/framework/query/parseQuery.js";
import { compareQueries, Ordering } from '../out/common/framework/query/compare.js';
import { assert, unreachable } from "../out/common/framework/util/util.js";
import { parseExpectationsForTestQuery } from "../src/common/framework/query/query.js";
import { parseExpectationsForTestQuery } from "../out/common/framework/query/query.js";

function usage(rc) {
console.log("Usage:");
Expand Down Expand Up @@ -98,7 +98,8 @@ if (queries.length === 0) {
let ignores = [];
if (ignoreFile) {
const ignoreFileText = await Deno.readTextFile(ignoreFile);
ignores = ignoreFileText.split("\n").map((line) => line.split("#")[0].trim())
ignores = ignoreFileText.split("\n")
.map((line) => line.split("#")[0].trim())
.filter((l) => l.length > 0);
}

Expand Down Expand Up @@ -127,7 +128,14 @@ try {
for (const testcase of testcases) {
total++;
const name = testcase.query.toString();
if (ignores.includes(name)) {
const isIgnored = ignores.find((l) => {
if (l.startsWith("^")) {
return name.startsWith(l.slice(1));
} else {
return name == l;
}
})
if (isIgnored) {
ignored.push(name);
continue;
}
Expand Down Expand Up @@ -186,7 +194,7 @@ try {
printResults(failed);
}

const passed = total - warned.length - failed.length - skipped.length;
const passed = total - warned.length - failed.length - skipped.length - ignored.length;
const pct = (x) => ((100 * x) / total).toFixed(2);
const rpt = (x) => {
const xs = x.toString().padStart(1 + Math.log10(total), " ");
Expand All @@ -200,6 +208,12 @@ Skipped = ${rpt(skipped.length)}
Failed = ${rpt(failed.length)}
Ignored = ${rpt(ignored.length)}`);

if (verbose) {
for (const [name] of failed) {
console.log(name);
}
}

if (failed.length || warned.length) {
Deno.exit(1);
}
Expand Down

0 comments on commit 03edd5a

Please sign in to comment.