Files
firefox/testing/web-platform/tests/webgpu/framework/util/stack.js
T
Kai Ninomiya 49ef6c3779 Bug 1594612 [wpt PR 20140] - Roll WebGPU CTS, a=testonly
Automatic update from web-platform-tests
Roll WebGPU CTS

Prepares us to roll the vertex state CTS changes along with the vertex
state changes in Dawn and Chrome.

TBR: [email protected]
Change-Id: I5ed5eebdff7d8e7559b0044686caacea9defd850
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1902131
Reviewed-by: Kai Ninomiya <[email protected]>
Commit-Queue: Kai Ninomiya <[email protected]>
Cr-Commit-Position: refs/heads/master@{#713275}

--

wpt-commits: b490a2b1777c8062c0eb3ff0115735a5bc9c1bab
wpt-pr: 20140
2019-11-29 10:55:53 +00:00

93 lines
3.8 KiB
JavaScript

/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/
// Takes a stack trace, and extracts only the first continuous range of lines
// containing '/suites/', which should provide only the useful part of the stack
// to the caller (for logging).
export function getStackTrace(e) {
if (!e.stack) {
return '';
}
const parts = e.stack.split('\n');
const stack = [];
let found = false;
const suitesRegex = /[\/\\]suites[\/\\]/;
for (let i = 0; i < parts.length; ++i) {
const part = parts[i].trim();
const isSuites = suitesRegex.test(part);
if (found && !isSuites) {
break;
}
if (isSuites) {
stack.push(part);
found = true;
}
}
return stack.join('\n');
} // *** Examples ***
//
// Node fail()
// > Error:
// > at CaseRecorder.fail (/Users/kainino/src/cts-experiment/src/framework/logger.ts:99:30)
// > at RunCaseSpecific.exports.g.test.t [as fn] (/Users/kainino/src/cts-experiment/src/suites/unittests/logger.spec.ts:80:7)
// x at RunCaseSpecific.run (/Users/kainino/src/cts-experiment/src/framework/test_group.ts:121:18)
// x at processTicksAndRejections (internal/process/task_queues.js:86:5)
//
// Node throw
// > Error: hello
// > at RunCaseSpecific.g.test.t [as fn] (/Users/kainino/src/cts-experiment/src/suites/unittests/test_group.spec.ts:51:11)
// x at RunCaseSpecific.run (/Users/kainino/src/cts-experiment/src/framework/test_group.ts:121:18)
// x at processTicksAndRejections (internal/process/task_queues.js:86:5)
//
// Firefox fail()
// > fail@http://localhost:8080/out/framework/logger.js:104:30
// > expect@http://localhost:8080/out/framework/default_fixture.js:59:16
// > @http://localhost:8080/out/suites/unittests/util.spec.js:35:5
// x run@http://localhost:8080/out/framework/test_group.js:119:18
//
// Firefox throw
// > @http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11
// x run@http://localhost:8080/out/framework/test_group.js:119:18
//
// Safari fail()
// > fail@http://localhost:8080/out/framework/logger.js:104:39
// > expect@http://localhost:8080/out/framework/default_fixture.js:59:20
// > http://localhost:8080/out/suites/unittests/util.spec.js:35:11
// x http://localhost:8080/out/framework/test_group.js:119:20
// x asyncFunctionResume@[native code]
// x [native code]
// x promiseReactionJob@[native code]
//
// Safari throw
// > http://localhost:8080/out/suites/unittests/test_group.spec.js:48:20
// x http://localhost:8080/out/framework/test_group.js:119:20
// x asyncFunctionResume@[native code]
// x [native code]
// x promiseReactionJob@[native code]
//
// Chrome fail()
// x Error
// x at CaseRecorder.fail (http://localhost:8080/out/framework/logger.js:104:30)
// x at DefaultFixture.expect (http://localhost:8080/out/framework/default_fixture.js:59:16)
// > at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/util.spec.js:35:5)
// x at RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:18)
// x at async runCase (http://localhost:8080/out/runtime/standalone.js:37:17)
// x at async http://localhost:8080/out/runtime/standalone.js:102:7
//
// Chrome throw
// x Error: hello
// > at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11)
// x at RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:18)"
// x at async Promise.all (index 0)
// x at async TestGroupTest.run (http://localhost:8080/out/suites/unittests/test_group_test.js:6:5)
// x at async RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:53:15)
// x at async RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:7)
// x at async runCase (http://localhost:8080/out/runtime/standalone.js:37:17)
// x at async http://localhost:8080/out/runtime/standalone.js:102:7
//# sourceMappingURL=stack.js.map