Files
firefox/testing/web-platform/tests/webgpu/framework/logger.js
T
Kai Ninomiya 24bfd7bca9 Bug 1595203 [wpt PR 20186] - Update naming for vertex state, a=testonly
Automatic update from web-platform-tests
Update naming for vertex state

Specification change:
https://github.com/gpuweb/gpuweb/pull/469

Dawn roll:
https://dawn.googlesource.com/dawn/+log/c3284fa40ec6b12731ed66c2f2a9256ae3fa692e..ae1f25fee85ebf2773b24a0a4f39c160839b1dbb

CTS roll:
https://github.com/gpuweb/cts/compare/3dc37c83a70667e9a92df773f34d154ec600d203...e114192747a54f34157eb65754e037701fbdf98b

TBR: [email protected]
Bug: dawn:22
Change-Id: Ib427760b9fba4b2cc4290de046c4a31d77e0b67a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900807
Reviewed-by: Austin Eng <[email protected]>
Reviewed-by: Yunchao He <[email protected]>
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Kai Ninomiya <[email protected]>
Cr-Commit-Position: refs/heads/master@{#713682}

--

wpt-commits: 4831b37a33f002e67ecc5f9f5b41145721e0ab60
wpt-pr: 20186
2019-11-29 10:55:55 +00:00

163 lines
3.5 KiB
JavaScript

/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { SkipTestCase } from './fixture.js';
import { makeQueryString } from './url_query.js';
import { extractPublicParams } from './url_query.js';
import { getStackTrace, now } from './util/index.js';
import { version } from './version.js';
class LogMessageWithStack extends Error {
constructor(name, ex) {
super(ex.message);
this.name = name;
this.stack = ex.stack;
}
toJSON() {
let m = this.name;
if (this.message) {
m += ': ' + this.message;
}
m += '\n' + getStackTrace(this);
return m;
}
}
class LogMessageWithoutStack extends LogMessageWithStack {
toJSON() {
return this.message;
}
}
export class Logger {
constructor() {
_defineProperty(this, "results", []);
}
record(spec) {
const result = {
spec: makeQueryString(spec),
cases: []
};
this.results.push(result);
return [new TestSpecRecorder(result), result];
}
asJSON(space) {
return JSON.stringify({
version,
results: this.results
}, undefined, space);
}
}
export class TestSpecRecorder {
constructor(result) {
_defineProperty(this, "result", void 0);
this.result = result;
}
record(test, params) {
const result = {
test,
params: params ? extractPublicParams(params) : null,
status: 'running',
timems: -1
};
this.result.cases.push(result);
return [new TestCaseRecorder(result), result];
}
}
var PassState;
(function (PassState) {
PassState[PassState["pass"] = 0] = "pass";
PassState[PassState["skip"] = 1] = "skip";
PassState[PassState["warn"] = 2] = "warn";
PassState[PassState["fail"] = 3] = "fail";
})(PassState || (PassState = {}));
export class TestCaseRecorder {
constructor(result) {
_defineProperty(this, "result", void 0);
_defineProperty(this, "state", PassState.pass);
_defineProperty(this, "startTime", -1);
_defineProperty(this, "logs", []);
_defineProperty(this, "debugging", false);
this.result = result;
}
start(debug = false) {
this.startTime = now();
this.logs = [];
this.state = PassState.pass;
this.debugging = debug;
}
finish() {
if (this.startTime < 0) {
throw new Error('finish() before start()');
}
const endTime = now(); // Round to next microsecond to avoid storing useless .xxxx00000000000002 in results.
this.result.timems = Math.ceil((endTime - this.startTime) * 1000) / 1000;
this.result.status = PassState[this.state];
this.result.logs = this.logs;
this.debugging = false;
}
debug(ex) {
if (!this.debugging) {
return;
}
this.logs.push(new LogMessageWithoutStack('DEBUG', ex));
}
warn(ex) {
this.setState(PassState.warn);
this.logs.push(new LogMessageWithStack('WARN', ex));
}
fail(ex) {
this.setState(PassState.fail);
this.logs.push(new LogMessageWithStack('FAIL', ex));
}
skipped(ex) {
this.setState(PassState.skip);
this.logs.push(new LogMessageWithStack('SKIP', ex));
}
threw(ex) {
if (ex instanceof SkipTestCase) {
this.skipped(ex);
return;
}
this.setState(PassState.fail);
this.logs.push(new LogMessageWithStack('EXCEPTION', ex));
}
setState(state) {
this.state = Math.max(this.state, state);
}
}
//# sourceMappingURL=logger.js.map