Adjust the directory structure outside the tests for navigability
- Moves src/{framework,runtime,tools,constants.ts} to src/common/*
- Moves templates/ to src/common/templates/
- Moves src/suites/*/ up to src/*/
- Renames the `cts:` suite to `webgpu:`
- Unhides some files from vscode
This commit is contained in:
parent
6037ea4442
commit
20bc11b931
143 changed files with 438 additions and 348 deletions
106
.gitignore
vendored
106
.gitignore
vendored
|
|
@ -3,15 +3,58 @@ out-wpt/
|
|||
# Copied from @webgpu/types during build (as a hack to avoid having any "real"
|
||||
# dependencies, which makes it easier to get the output in the out/ directory
|
||||
# to be self-contained).
|
||||
/src/constants.ts
|
||||
/src/common/constants.ts
|
||||
|
||||
*.code-workspace
|
||||
|
||||
.tscache/
|
||||
*.tmp.txt
|
||||
|
||||
# Created by https://www.gitignore.io/api/node
|
||||
# Edit at https://www.gitignore.io/?templates=node
|
||||
# Created by https://www.gitignore.io/api/linux,macos,windows,node
|
||||
# Edit at https://www.gitignore.io/?templates=linux,macos,windows,node
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
|
|
@ -20,6 +63,10 @@ logs
|
|||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
|
|
@ -32,6 +79,7 @@ lib-cov
|
|||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
|
@ -49,12 +97,15 @@ bower_components
|
|||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
/node_modules/
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
|
|
@ -72,6 +123,7 @@ typings/
|
|||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
|
@ -82,6 +134,18 @@ typings/
|
|||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# rollup.js default build output
|
||||
dist/
|
||||
|
||||
# Uncomment the public line if your project uses Gatsby
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav
|
||||
# public
|
||||
|
||||
# Storybook build outputs
|
||||
.out
|
||||
.storybook-out
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
|
|
@ -91,7 +155,37 @@ typings/
|
|||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
#DynamoDB Local files
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# End of https://www.gitignore.io/api/node
|
||||
# Temporary folders
|
||||
tmp/
|
||||
temp/
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# End of https://www.gitignore.io/api/linux,macos,windows,node
|
||||
|
|
|
|||
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
|
@ -9,19 +9,13 @@
|
|||
"files.trimTrailingWhitespace": true,
|
||||
"files.exclude": {
|
||||
"*.tmp.txt": true,
|
||||
".babelrc": true,
|
||||
".gitignore": true,
|
||||
".prettierignore": true,
|
||||
".travis.yml": true,
|
||||
".tscache": true,
|
||||
".vscode": true,
|
||||
"deploy_key.enc": true,
|
||||
"node_modules": true,
|
||||
"out": true,
|
||||
"prettier.config.js": true,
|
||||
"third_party": true,
|
||||
"tsconfig.json": true,
|
||||
"tsconfig.web.json": true,
|
||||
"tslint.json": true,
|
||||
"out-wpt": true,
|
||||
"yarn-error.log": true,
|
||||
"yarn.lock": true
|
||||
},
|
||||
|
|
|
|||
29
Gruntfile.js
29
Gruntfile.js
|
|
@ -4,7 +4,7 @@ module.exports = function (grunt) {
|
|||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
clean: {
|
||||
constants: ['src/constants.ts'],
|
||||
constants: ['src/constants.ts', 'src/common/constants.ts'],
|
||||
out: ['out/', 'out-wpt'],
|
||||
},
|
||||
|
||||
|
|
@ -23,11 +23,11 @@ module.exports = function (grunt) {
|
|||
},
|
||||
'generate-listings': {
|
||||
cmd: 'node',
|
||||
args: ['tools/gen_listings', 'cts', 'unittests'],
|
||||
args: ['tools/gen_listings', 'webgpu', 'unittests'],
|
||||
},
|
||||
'generate-wpt-cts-html': {
|
||||
cmd: 'node',
|
||||
args: ['tools/gen_wpt_cts_html', 'out-wpt/cts.html', 'templates/cts.html'],
|
||||
args: ['tools/gen_wpt_cts_html', 'out-wpt/cts.html', 'src/common/templates/cts.html'],
|
||||
},
|
||||
test: {
|
||||
cmd: 'node',
|
||||
|
|
@ -37,12 +37,9 @@ module.exports = function (grunt) {
|
|||
cmd: 'node',
|
||||
args: [
|
||||
'node_modules/@babel/cli/bin/babel',
|
||||
'--source-maps',
|
||||
'true',
|
||||
'--extensions',
|
||||
'.ts',
|
||||
'--out-dir',
|
||||
'out/',
|
||||
'--source-maps=true',
|
||||
'--extensions=.ts',
|
||||
'--out-dir=out/',
|
||||
'src/',
|
||||
],
|
||||
},
|
||||
|
|
@ -63,7 +60,7 @@ module.exports = function (grunt) {
|
|||
expand: true,
|
||||
cwd: 'node_modules/@webgpu/types/src',
|
||||
src: 'constants.ts',
|
||||
dest: 'src/',
|
||||
dest: 'src/common/',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -73,18 +70,18 @@ module.exports = function (grunt) {
|
|||
expand: true,
|
||||
cwd: 'node_modules/@webgpu/glslang/dist/web-devel',
|
||||
src: 'glslang.{js,wasm}',
|
||||
dest: 'out/',
|
||||
dest: 'out/common/',
|
||||
},
|
||||
],
|
||||
},
|
||||
'out-wpt': {
|
||||
files: [
|
||||
{ expand: true, cwd: '.', src: 'LICENSE.txt', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'constants.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'framework/**/*.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'suites/cts/**/*.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'runtime/wpt.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'runtime/helper/**/*.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'common/constants.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'common/framework/**/*.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'webgpu/**/*.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'common/runtime/wpt.js', dest: 'out-wpt/' },
|
||||
{ expand: true, cwd: 'out', src: 'common/runtime/helper/**/*.js', dest: 'out-wpt/' },
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# WebGPU CTS
|
||||
# WebGPU Conformance Test Suite
|
||||
|
||||
## >>> [**Contribution Guidelines**](https://github.com/gpuweb/gpuweb/wiki/WebGPU-CTS-guidelines) <<<
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ After checking out the repository and installing Yarn, run these commands to
|
|||
set up dependencies:
|
||||
|
||||
```sh
|
||||
cd cts/
|
||||
cd webgpu/
|
||||
yarn install
|
||||
|
||||
npx grunt # show available grunt commands
|
||||
|
|
@ -45,7 +45,7 @@ npx grunt test
|
|||
To test in a browser under the standalone harness, run `grunt serve`, then
|
||||
open:
|
||||
|
||||
- http://localhost:8080/ (defaults to ?runnow=0&q=cts)
|
||||
- http://localhost:8080/ (defaults to ?runnow=0&worker=0&debug=0&q=webgpu:)
|
||||
- http://localhost:8080/?runnow=1&q=unittests:
|
||||
- http://localhost:8080/?runnow=1&q=unittests:basic:&q=unittests:params:
|
||||
|
||||
|
|
@ -53,14 +53,14 @@ open:
|
|||
|
||||
To see debug logs in a browser, use the `debug=1` query string:
|
||||
|
||||
- http://localhost:8080/?q=cts:validation&debug=1
|
||||
- http://localhost:8080/?q=webgpu:validation&debug=1
|
||||
|
||||
### Making Changes
|
||||
|
||||
To add new tests, simply imitate the pattern in neigboring tests or
|
||||
neighboring files. New test files must be named ending in `.spec.ts`.
|
||||
|
||||
For an example, see `src/suites/cts/examples.spec.ts`.
|
||||
For an example test file, see `src/webgpu/examples.spec.ts`.
|
||||
|
||||
Since this project is written in TypeScript, it integrates best with Visual
|
||||
Studio Code. There are also some default settings (in `.vscode/settings.json`)
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ A single suite has a directory structure, and many _test spec files_
|
|||
(`.spec.ts` files containing tests) and _READMEs_.
|
||||
Each member of a suite is identified by its path within the suite.
|
||||
|
||||
**Example:** `src/suites/*/`
|
||||
**Example:** `src/webgpu/`
|
||||
|
||||
### README
|
||||
|
||||
**Example:** `src/suites/**/README.txt`
|
||||
**Example:** `src/webgpu/README.txt`
|
||||
|
||||
Describes (in prose) the contents of a subdirectory in a suite.
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ Comprised of suite name (`suite`) and test spec file path relative to the suite
|
|||
|
||||
**Type:** `TestSpecID`
|
||||
|
||||
**Example:** `{ suite: 'cts', path: 'command_buffer/compute/basic' }` corresponds to
|
||||
`src/suites/cts/command_buffer/compute/basic.spec.ts`.
|
||||
**Example:** `{ suite: 'webgpu', path: 'command_buffer/compute/basic' }` corresponds to
|
||||
`src/webgpu/command_buffer/compute/basic.spec.ts`.
|
||||
|
||||
### Test Case ID
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ test files can be discovered by the web runner (since it does not have filesyste
|
|||
|
||||
### Listing File
|
||||
|
||||
**Example:** `out/suites/*/index.js`
|
||||
**Example:** `out/webgpu/index.js`
|
||||
|
||||
## Test Spec
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ Always contains one `RunCaseIterable`.
|
|||
|
||||
A single `.spec.ts` file. It always contains one _test group_.
|
||||
|
||||
**Example:** `src/suites/**/*.spec.ts`
|
||||
**Example:** `src/webgpu/**/*.spec.ts`
|
||||
|
||||
### Filtered Test Spec
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { ParamSpec } from './params/index.js';
|
|||
|
||||
// Identifies a test spec file.
|
||||
export interface TestSpecID {
|
||||
// The spec's suite, e.g. 'cts'.
|
||||
// The spec's suite name, e.g. 'webgpu'.
|
||||
readonly suite: string;
|
||||
// The spec's path within the suite, e.g. 'command_buffer/compute/basic'.
|
||||
readonly path: string;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// A listing of all specs within a single suite. This is the (awaited) type of
|
||||
// `groups` in 'src/suites/*/index.ts' and the auto-generated
|
||||
// 'out/suites/*/index.js' files (see tools/gen_listings).
|
||||
// `groups` in '{cts,unittests}/index.ts' and the auto-generated
|
||||
// 'out/{cts,unittests}/index.js' files (see tools/gen_listings).
|
||||
export type TestSuiteListing = Iterable<TestSuiteListingEntry>;
|
||||
|
||||
export interface TestSuiteListingEntry {
|
||||
|
|
@ -31,11 +31,11 @@ export interface TestFileLoader {
|
|||
|
||||
class DefaultTestFileLoader implements TestFileLoader {
|
||||
async listing(suite: string): Promise<TestSuiteListing> {
|
||||
return (await import(`../suites/${suite}/index.js`)).listing;
|
||||
return (await import(`../../${suite}/index.js`)).listing;
|
||||
}
|
||||
|
||||
import(path: string): Promise<TestSpec> {
|
||||
return import('../suites/' + path);
|
||||
return import('../../' + path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11,15 +11,15 @@ import { TestFilter } from './internal.js';
|
|||
// Each filter is of one of the forms below (urlencoded).
|
||||
export function makeFilter(filter: string): TestFilter {
|
||||
const i1 = filter.indexOf(':');
|
||||
assert(i1 !== -1, 'Test queries must fully specify their suite name (e.g. "cts:")');
|
||||
assert(i1 !== -1, 'Test queries must fully specify their suite name (e.g. "webgpu:")');
|
||||
|
||||
const suite = filter.substring(0, i1);
|
||||
const i2 = filter.indexOf(':', i1 + 1);
|
||||
if (i2 === -1) {
|
||||
// - cts:
|
||||
// - cts:buf
|
||||
// - cts:buffers/
|
||||
// - cts:buffers/map
|
||||
// - webgpu:
|
||||
// - webgpu:buf
|
||||
// - webgpu:buffers/
|
||||
// - webgpu:buffers/map
|
||||
const groupPrefix = filter.substring(i1 + 1);
|
||||
return new FilterByGroup(suite, groupPrefix);
|
||||
}
|
||||
|
|
@ -28,8 +28,8 @@ export function makeFilter(filter: string): TestFilter {
|
|||
const endOfTestName = new RegExp('[^' + allowedTestNameCharacters + ']');
|
||||
const i3sub = filter.substring(i2 + 1).search(endOfTestName);
|
||||
if (i3sub === -1) {
|
||||
// - cts:buffers/mapWriteAsync:
|
||||
// - cts:buffers/mapWriteAsync:b
|
||||
// - webgpu:buffers/mapWriteAsync:
|
||||
// - webgpu:buffers/mapWriteAsync:b
|
||||
const testPrefix = filter.substring(i2 + 1);
|
||||
return new FilterByTestMatch({ suite, path }, testPrefix);
|
||||
}
|
||||
|
|
@ -44,14 +44,14 @@ export function makeFilter(filter: string): TestFilter {
|
|||
}
|
||||
|
||||
if (token === '~') {
|
||||
// - cts:buffers/mapWriteAsync:basic~
|
||||
// - cts:buffers/mapWriteAsync:basic~{}
|
||||
// - cts:buffers/mapWriteAsync:basic~{filter:"params"}
|
||||
// - webgpu:buffers/mapWriteAsync:basic~
|
||||
// - webgpu:buffers/mapWriteAsync:basic~{}
|
||||
// - webgpu:buffers/mapWriteAsync:basic~{filter:"params"}
|
||||
return new FilterByParamsMatch({ suite, path }, test, params);
|
||||
} else if (token === '=') {
|
||||
// - cts:buffers/mapWriteAsync:basic=
|
||||
// - cts:buffers/mapWriteAsync:basic={}
|
||||
// - cts:buffers/mapWriteAsync:basic={exact:"params"}
|
||||
// - webgpu:buffers/mapWriteAsync:basic=
|
||||
// - webgpu:buffers/mapWriteAsync:basic={}
|
||||
// - webgpu:buffers/mapWriteAsync:basic={exact:"params"}
|
||||
return new FilterByParamsExact({ suite, path }, test, params);
|
||||
} else {
|
||||
unreachable("invalid character after test name; must be '~' or '='");
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// 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).
|
||||
// containing '/(webgpu|unittests)/', which should provide only the useful part
|
||||
// of the stack to the caller (for logging).
|
||||
export function getStackTrace(e: Error): string {
|
||||
if (!e.stack) {
|
||||
return '';
|
||||
|
|
@ -11,10 +11,10 @@ export function getStackTrace(e: Error): string {
|
|||
const stack = [];
|
||||
const moreStack = [];
|
||||
let found = false;
|
||||
const suitesRegex = /[\/\\]suites[\/\\]/;
|
||||
const commonRegex = /[\/\\](webgpu|unittests)[\/\\]/;
|
||||
for (let i = 0; i < parts.length; ++i) {
|
||||
const part = parts[i].trim();
|
||||
const isSuites = suitesRegex.test(part);
|
||||
const isSuites = commonRegex.test(part); // approximate
|
||||
if (found && !isSuites) {
|
||||
moreStack.push(part);
|
||||
}
|
||||
|
|
@ -34,38 +34,38 @@ export function getStackTrace(e: Error): string {
|
|||
//
|
||||
// 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)
|
||||
// > at CaseRecorder.fail (/Users/kainino/src/cts/src/common/framework/logger.ts:99:30)
|
||||
// > at RunCaseSpecific.exports.g.test.t [as fn] (/Users/kainino/src/cts/src/unittests/logger.spec.ts:80:7)
|
||||
// x at RunCaseSpecific.run (/Users/kainino/src/cts/src/common/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)
|
||||
// > at RunCaseSpecific.g.test.t [as fn] (/Users/kainino/src/cts/src/unittests/test_group.spec.ts:51:11)
|
||||
// x at RunCaseSpecific.run (/Users/kainino/src/cts/src/common/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
|
||||
// > @http://localhost:8080/out/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
|
||||
// > @http://localhost:8080/out/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
|
||||
// > http://localhost:8080/out/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
|
||||
// > http://localhost:8080/out/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]
|
||||
|
|
@ -75,18 +75,18 @@ export function getStackTrace(e: Error): string {
|
|||
// 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)
|
||||
// > at RunCaseSpecific.fn (http://localhost:8080/out/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)
|
||||
// > at RunCaseSpecific.fn (http://localhost:8080/out/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 TestGroupTest.run (http://localhost:8080/out/unittests/test_group_test.js:6:5)
|
||||
// x at async RunCaseSpecific.fn (http://localhost:8080/out/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
|
||||
|
|
@ -12,7 +12,7 @@ import { makeQueryString } from '../framework/url_query.js';
|
|||
function usage(rc: number): never {
|
||||
console.log('Usage:');
|
||||
console.log(' tools/run [OPTIONS...] QUERIES...');
|
||||
console.log(' tools/run unittests: cts:buffers/');
|
||||
console.log(' tools/run unittests: webgpu:buffers/');
|
||||
console.log('Options:');
|
||||
console.log(' --verbose Print result/log of every test as it runs.');
|
||||
console.log(' --debug Include debug messages in logging.');
|
||||
|
|
@ -20,7 +20,7 @@ function usage(rc: number): never {
|
|||
return process.exit(rc);
|
||||
}
|
||||
|
||||
if (!fs.existsSync('src/runtime/cmdline.ts')) {
|
||||
if (!fs.existsSync('src/common/runtime/cmdline.ts')) {
|
||||
console.log('Must be run from repository root');
|
||||
usage(1);
|
||||
}
|
||||
|
|
@ -45,4 +45,4 @@
|
|||
</style>
|
||||
|
||||
<textarea id=results></textarea>
|
||||
<script type=module src=/webgpu/runtime/wpt.js></script>
|
||||
<script type=module src=/webgpu/common/runtime/wpt.js></script>
|
||||
|
|
@ -16,7 +16,7 @@ import { TestSpec } from '../framework/loader.js';
|
|||
const specSuffix = '.spec.ts';
|
||||
|
||||
export async function crawl(suite: string): Promise<TestSuiteListingEntry[]> {
|
||||
const specDir = 'src/suites/' + suite;
|
||||
const specDir = 'src/' + suite;
|
||||
if (!fs.existsSync(specDir)) {
|
||||
console.error(`Could not find ${specDir}`);
|
||||
process.exit(1);
|
||||
|
|
@ -30,7 +30,7 @@ export async function crawl(suite: string): Promise<TestSuiteListingEntry[]> {
|
|||
const f = file.substring((specDir + '/').length);
|
||||
if (f.endsWith(specSuffix)) {
|
||||
const testPath = f.substring(0, f.length - specSuffix.length);
|
||||
const filename = `../../${specDir}/${testPath}.spec.js`;
|
||||
const filename = `../../../${specDir}/${testPath}.spec.js`;
|
||||
const mod = (await import(filename)) as TestSpec;
|
||||
assert(mod.description !== undefined, 'Test spec file missing description: ' + filename);
|
||||
assert(mod.g !== undefined, 'Test spec file missing TestGroup definition: ' + filename);
|
||||
|
|
@ -9,7 +9,7 @@ import { crawl } from './crawl.js';
|
|||
function usage(rc: number): void {
|
||||
console.error('Usage:');
|
||||
console.error(' tools/gen_listings [SUITES...]');
|
||||
console.error(' tools/gen_listings cts unittests');
|
||||
console.error(' tools/gen_listings webgpu unittests');
|
||||
process.exit(rc);
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ if (process.argv.length <= 2) {
|
|||
usage(0);
|
||||
}
|
||||
|
||||
const myself = 'src/tools/gen_listings.ts';
|
||||
const myself = 'src/common/tools/gen_listings.ts';
|
||||
if (!fs.existsSync(myself)) {
|
||||
console.error('Must be run from repository root');
|
||||
usage(1);
|
||||
|
|
@ -27,7 +27,7 @@ if (!fs.existsSync(myself)) {
|
|||
for (const suite of process.argv.slice(2)) {
|
||||
const listing = await crawl(suite);
|
||||
|
||||
const outFile = path.normalize(`out/suites/${suite}/index.js`);
|
||||
const outFile = path.normalize(`out/${suite}/index.js`);
|
||||
fs.writeFileSync(
|
||||
outFile,
|
||||
`\
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
import { promises as fs } from 'fs';
|
||||
|
||||
import { listing } from '../../webgpu/index.js';
|
||||
import { generateMinimalQueryList } from '../framework/generate_minimal_query_list.js';
|
||||
import { TestSuiteListingEntry } from '../framework/listing.js';
|
||||
import { TestLoader } from '../framework/loader.js';
|
||||
import { listing } from '../suites/cts/index.js';
|
||||
|
||||
function printUsageAndExit(rc: number): void {
|
||||
console.error(`\
|
||||
|
|
@ -23,10 +23,10 @@ multiplies the size of the variant list.
|
|||
|
||||
and myexpectations.txt is a file containing a list of WPT paths to suppress, e.g.:
|
||||
|
||||
path/to/cts.html?worker=0&q=cts:a/foo:bar={"x":1}
|
||||
path/to/cts.html?worker=1&q=cts:a/foo:bar={"x":1}
|
||||
path/to/cts.html?worker=0&q=webgpu:a/foo:bar={"x":1}
|
||||
path/to/cts.html?worker=1&q=webgpu:a/foo:bar={"x":1}
|
||||
|
||||
path/to/cts.html?worker=1&q=cts:a/foo:bar={"x":3}
|
||||
path/to/cts.html?worker=1&q=webgpu:a/foo:bar={"x":3}
|
||||
`);
|
||||
process.exit(rc);
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ const [
|
|||
const lines = entries
|
||||
// Exclude READMEs.
|
||||
.filter(l => l.path.length !== 0 && !l.path.endsWith('/'))
|
||||
.map(l => '?q=cts:' + l.path);
|
||||
.map(l => '?q=webgpu:' + l.path);
|
||||
await generateFile(lines);
|
||||
} else {
|
||||
// Prefixes sorted from longest to shortest
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
import { TestSuiteListing } from '../../framework/listing.js';
|
||||
import { makeListing } from '../../tools/crawl.js';
|
||||
|
||||
export const listing: Promise<TestSuiteListing> = makeListing(__filename);
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
export const description = `
|
||||
Tests for getStackTrace.
|
||||
`;
|
||||
|
||||
import { TestGroup, getStackTrace } from '../../framework/index.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
export const g = new TestGroup(UnitTest);
|
||||
|
||||
g.test('stacks', t => {
|
||||
const lines: number = t.params._expectedLines;
|
||||
|
||||
const ex = new Error();
|
||||
ex.stack = t.params._stack;
|
||||
t.expect(ex.stack === t.params._stack);
|
||||
const stringified = getStackTrace(ex);
|
||||
const parts = stringified.split('\n');
|
||||
|
||||
t.expect(parts.length === lines);
|
||||
const fst = parts[0];
|
||||
const lst = parts[parts.length - 1];
|
||||
t.expect(fst.indexOf('/suites/') !== -1 || fst.indexOf('\\suites\\') !== -1);
|
||||
t.expect(lst.indexOf('/suites/') !== -1 || lst.indexOf('\\suites\\') !== -1);
|
||||
}).params([
|
||||
{
|
||||
case: 'node_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `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)
|
||||
at RunCaseSpecific.run (/Users/kainino/src/cts-experiment/src/framework/test_group.ts:121:18)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:86:5)`,
|
||||
},
|
||||
{
|
||||
// TODO: make sure this test case actually matches what happens on windows
|
||||
case: 'node_fail_backslash',
|
||||
_expectedLines: 1,
|
||||
_stack: `Error:
|
||||
at CaseRecorder.fail (C:\\Users\\kainino\\src\\cts-experiment\\src\\framework\\logger.ts:99:30)
|
||||
at RunCaseSpecific.exports.g.test.t [as fn] (C:\\Users\\kainino\\src\\cts-experiment\\src\\suites\\unittests\\logger.spec.ts:80:7)
|
||||
at RunCaseSpecific.run (C:\\Users\\kainino\\src\\cts-experiment\\src\\framework\\test_group.ts:121:18)
|
||||
at processTicksAndRejections (internal\\process\\task_queues.js:86:5)`,
|
||||
},
|
||||
{
|
||||
case: 'node_fail_processTicksAndRejections',
|
||||
_expectedLines: 3,
|
||||
_stack: `Error: expectation had no effect: suite1:foo:
|
||||
at Object.generateMinimalQueryList (/Users/kainino/src/cts/src/framework/generate_minimal_query_list.ts:72:24)
|
||||
at testGenerateMinimalQueryList (/Users/kainino/src/cts/src/suites/unittests/loading.spec.ts:289:25)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:93:5)
|
||||
at RunCaseSpecific.fn (/Users/kainino/src/cts/src/suites/unittests/loading.spec.ts:300:3)
|
||||
at RunCaseSpecific.run (/Users/kainino/src/cts/src/framework/test_group.ts:144:9)
|
||||
at /Users/kainino/src/cts/src/runtime/cmdline.ts:62:25
|
||||
at async Promise.all (index 29)
|
||||
at /Users/kainino/src/cts/src/runtime/cmdline.ts:78:5`,
|
||||
},
|
||||
{
|
||||
case: 'node_throw',
|
||||
_expectedLines: 1,
|
||||
_stack: `Error: hello
|
||||
at RunCaseSpecific.g.test.t [as fn] (/Users/kainino/src/cts-experiment/src/suites/unittests/test_group.spec.ts:51:11)
|
||||
at RunCaseSpecific.run (/Users/kainino/src/cts-experiment/src/framework/test_group.ts:121:18)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:86:5)`,
|
||||
},
|
||||
{
|
||||
case: 'firefox_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `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
|
||||
run@http://localhost:8080/out/framework/test_group.js:119:18`,
|
||||
},
|
||||
{
|
||||
case: 'firefox_throw',
|
||||
_expectedLines: 1,
|
||||
_stack: `@http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11
|
||||
run@http://localhost:8080/out/framework/test_group.js:119:18`,
|
||||
},
|
||||
{
|
||||
case: 'safari_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `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
|
||||
http://localhost:8080/out/framework/test_group.js:119:20
|
||||
asyncFunctionResume@[native code]
|
||||
[native code]
|
||||
promiseReactionJob@[native code]`,
|
||||
},
|
||||
{
|
||||
case: 'safari_throw',
|
||||
_expectedLines: 1,
|
||||
_stack: `http://localhost:8080/out/suites/unittests/test_group.spec.js:48:20
|
||||
http://localhost:8080/out/framework/test_group.js:119:20
|
||||
asyncFunctionResume@[native code]
|
||||
[native code]
|
||||
promiseReactionJob@[native code]`,
|
||||
},
|
||||
{
|
||||
case: 'chrome_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `Error
|
||||
at CaseRecorder.fail (http://localhost:8080/out/framework/logger.js:104:30)
|
||||
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)
|
||||
at RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:18)
|
||||
at async runCase (http://localhost:8080/out/runtime/standalone.js:37:17)
|
||||
at async http://localhost:8080/out/runtime/standalone.js:102:7`,
|
||||
},
|
||||
{
|
||||
case: 'chrome_throw',
|
||||
_expectedLines: 5,
|
||||
_stack: `Error: hello
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:18)"
|
||||
at async Promise.all (index 0)
|
||||
at async TestGroupTest.run (http://localhost:8080/out/suites/unittests/test_group_test.js:6:5)
|
||||
at async RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:53:15)
|
||||
at async RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:7)
|
||||
at async runCase (http://localhost:8080/out/runtime/standalone.js:37:17)
|
||||
at async http://localhost:8080/out/runtime/standalone.js:102:7`,
|
||||
},
|
||||
{
|
||||
case: 'multiple_lines',
|
||||
_expectedLines: 7,
|
||||
_stack: `Error: hello
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:18)"
|
||||
at async Promise.all (index 0)
|
||||
at async TestGroupTest.run (http://localhost:8080/out/suites/unittests/test_group_test.js:6:5)
|
||||
at async RunCaseSpecific.fn (http://localhost:8080/out/suites/unittests/test_group.spec.js:53:15)
|
||||
at async RunCaseSpecific.run (http://localhost:8080/out/framework/test_group.js:119:7)
|
||||
at async runCase (http://localhost:8080/out/runtime/standalone.js:37:17)
|
||||
at async http://localhost:8080/out/runtime/standalone.js:102:7`,
|
||||
},
|
||||
]);
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
import { TestSuiteListing } from '../../framework/listing.js';
|
||||
import { makeListing } from '../../tools/crawl.js';
|
||||
|
||||
export const listing: Promise<TestSuiteListing> = makeListing(__filename);
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
import { Fixture } from '../../framework/fixture.js';
|
||||
|
||||
export class UnitTest extends Fixture {}
|
||||
|
|
@ -2,8 +2,8 @@ export const description = `
|
|||
Tests for AsyncMutex.
|
||||
`;
|
||||
|
||||
import { TestGroup, objectEquals } from '../../framework/index.js';
|
||||
import { AsyncMutex } from '../../framework/util/async_mutex.js';
|
||||
import { TestGroup, objectEquals } from '../common/framework/index.js';
|
||||
import { AsyncMutex } from '../common/framework/util/async_mutex.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
Basic unit tests for test framework.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../framework/index.js';
|
||||
import { TestGroup } from '../common/framework/index.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
139
src/unittests/getStackTrace.spec.ts
Normal file
139
src/unittests/getStackTrace.spec.ts
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
export const description = `
|
||||
Tests for getStackTrace.
|
||||
`;
|
||||
|
||||
import { TestGroup, getStackTrace } from '../common/framework/index.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
export const g = new TestGroup(UnitTest);
|
||||
|
||||
g.test('stacks', t => {
|
||||
const lines: number = t.params._expectedLines;
|
||||
|
||||
const ex = new Error();
|
||||
ex.stack = t.params._stack;
|
||||
t.expect(ex.stack === t.params._stack);
|
||||
const stringified = getStackTrace(ex);
|
||||
const parts = stringified.split('\n');
|
||||
|
||||
t.expect(parts.length === lines);
|
||||
const fst = parts[0];
|
||||
const lst = parts[parts.length - 1];
|
||||
t.expect(fst.indexOf('/unittests/') !== -1 || fst.indexOf('\\unittests\\') !== -1);
|
||||
t.expect(lst.indexOf('/unittests/') !== -1 || lst.indexOf('\\unittests\\') !== -1);
|
||||
}).params([
|
||||
{
|
||||
case: 'node_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `Error:
|
||||
at CaseRecorder.fail (/Users/kainino/src/cts/src/common/framework/logger.ts:99:30)
|
||||
at RunCaseSpecific.exports.g.test.t [as fn] (/Users/kainino/src/cts/src/unittests/logger.spec.ts:80:7)
|
||||
at RunCaseSpecific.run (/Users/kainino/src/cts/src/common/framework/test_group.ts:121:18)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:86:5)`,
|
||||
},
|
||||
{
|
||||
// TODO: make sure this test case actually matches what happens on windows
|
||||
case: 'node_fail_backslash',
|
||||
_expectedLines: 1,
|
||||
_stack: `Error:
|
||||
at CaseRecorder.fail (C:\\Users\\kainino\\src\\cts\\src\\common\\framework\\logger.ts:99:30)
|
||||
at RunCaseSpecific.exports.g.test.t [as fn] (C:\\Users\\kainino\\src\\cts\\src\\unittests\\logger.spec.ts:80:7)
|
||||
at RunCaseSpecific.run (C:\\Users\\kainino\\src\\cts\\src\\common\\framework\\test_group.ts:121:18)
|
||||
at processTicksAndRejections (internal\\process\\task_queues.js:86:5)`,
|
||||
},
|
||||
{
|
||||
case: 'node_fail_processTicksAndRejections',
|
||||
_expectedLines: 3,
|
||||
_stack: `Error: expectation had no effect: suite1:foo:
|
||||
at Object.generateMinimalQueryList (/Users/kainino/src/cts/src/common/framework/generate_minimal_query_list.ts:72:24)
|
||||
at testGenerateMinimalQueryList (/Users/kainino/src/cts/src/unittests/loading.spec.ts:289:25)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:93:5)
|
||||
at RunCaseSpecific.fn (/Users/kainino/src/cts/src/unittests/loading.spec.ts:300:3)
|
||||
at RunCaseSpecific.run (/Users/kainino/src/cts/src/common/framework/test_group.ts:144:9)
|
||||
at /Users/kainino/src/cts/src/common/runtime/cmdline.ts:62:25
|
||||
at async Promise.all (index 29)
|
||||
at /Users/kainino/src/cts/src/common/runtime/cmdline.ts:78:5`,
|
||||
},
|
||||
{
|
||||
case: 'node_throw',
|
||||
_expectedLines: 1,
|
||||
_stack: `Error: hello
|
||||
at RunCaseSpecific.g.test.t [as fn] (/Users/kainino/src/cts/src/unittests/test_group.spec.ts:51:11)
|
||||
at RunCaseSpecific.run (/Users/kainino/src/cts/src/common/framework/test_group.ts:121:18)
|
||||
at processTicksAndRejections (internal/process/task_queues.js:86:5)`,
|
||||
},
|
||||
{
|
||||
case: 'firefox_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `fail@http://localhost:8080/out/common/framework/logger.js:104:30
|
||||
expect@http://localhost:8080/out/common/framework/default_fixture.js:59:16
|
||||
@http://localhost:8080/out/unittests/util.spec.js:35:5
|
||||
run@http://localhost:8080/out/common/framework/test_group.js:119:18`,
|
||||
},
|
||||
{
|
||||
case: 'firefox_throw',
|
||||
_expectedLines: 1,
|
||||
_stack: `@http://localhost:8080/out/unittests/test_group.spec.js:48:11
|
||||
run@http://localhost:8080/out/common/framework/test_group.js:119:18`,
|
||||
},
|
||||
{
|
||||
case: 'safari_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `fail@http://localhost:8080/out/common/framework/logger.js:104:39
|
||||
expect@http://localhost:8080/out/common/framework/default_fixture.js:59:20
|
||||
http://localhost:8080/out/unittests/util.spec.js:35:11
|
||||
http://localhost:8080/out/common/framework/test_group.js:119:20
|
||||
asyncFunctionResume@[native code]
|
||||
[native code]
|
||||
promiseReactionJob@[native code]`,
|
||||
},
|
||||
{
|
||||
case: 'safari_throw',
|
||||
_expectedLines: 1,
|
||||
_stack: `http://localhost:8080/out/unittests/test_group.spec.js:48:20
|
||||
http://localhost:8080/out/common/framework/test_group.js:119:20
|
||||
asyncFunctionResume@[native code]
|
||||
[native code]
|
||||
promiseReactionJob@[native code]`,
|
||||
},
|
||||
{
|
||||
case: 'chrome_fail',
|
||||
_expectedLines: 1,
|
||||
_stack: `Error
|
||||
at CaseRecorder.fail (http://localhost:8080/out/common/framework/logger.js:104:30)
|
||||
at DefaultFixture.expect (http://localhost:8080/out/common/framework/default_fixture.js:59:16)
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/unittests/util.spec.js:35:5)
|
||||
at RunCaseSpecific.run (http://localhost:8080/out/common/framework/test_group.js:119:18)
|
||||
at async runCase (http://localhost:8080/out/common/runtime/standalone.js:37:17)
|
||||
at async http://localhost:8080/out/common/runtime/standalone.js:102:7`,
|
||||
},
|
||||
{
|
||||
case: 'chrome_throw',
|
||||
_expectedLines: 5,
|
||||
_stack: `Error: hello
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.run (http://localhost:8080/out/common/framework/test_group.js:119:18)"
|
||||
at async Promise.all (index 0)
|
||||
at async TestGroupTest.run (http://localhost:8080/out/unittests/test_group_test.js:6:5)
|
||||
at async RunCaseSpecific.fn (http://localhost:8080/out/unittests/test_group.spec.js:53:15)
|
||||
at async RunCaseSpecific.run (http://localhost:8080/out/common/framework/test_group.js:119:7)
|
||||
at async runCase (http://localhost:8080/out/common/runtime/standalone.js:37:17)
|
||||
at async http://localhost:8080/out/common/runtime/standalone.js:102:7`,
|
||||
},
|
||||
{
|
||||
case: 'multiple_lines',
|
||||
_expectedLines: 7,
|
||||
_stack: `Error: hello
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.fn (http://localhost:8080/out/unittests/test_group.spec.js:48:11)
|
||||
at RunCaseSpecific.run (http://localhost:8080/out/common/framework/test_group.js:119:18)"
|
||||
at async Promise.all (index 0)
|
||||
at async TestGroupTest.run (http://localhost:8080/out/unittests/test_group_test.js:6:5)
|
||||
at async RunCaseSpecific.fn (http://localhost:8080/out/unittests/test_group.spec.js:53:15)
|
||||
at async RunCaseSpecific.run (http://localhost:8080/out/common/framework/test_group.js:119:7)
|
||||
at async runCase (http://localhost:8080/out/common/runtime/standalone.js:37:17)
|
||||
at async http://localhost:8080/out/common/runtime/standalone.js:102:7`,
|
||||
},
|
||||
]);
|
||||
4
src/unittests/index.ts
Normal file
4
src/unittests/index.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { TestSuiteListing } from '../common/framework/listing.js';
|
||||
import { makeListing } from '../common/tools/crawl.js';
|
||||
|
||||
export const listing: Promise<TestSuiteListing> = makeListing(__filename);
|
||||
|
|
@ -2,14 +2,14 @@ export const description = `
|
|||
Tests for queries/filtering, loading, and running.
|
||||
`;
|
||||
|
||||
import { generateMinimalQueryList } from '../../framework/generate_minimal_query_list.js';
|
||||
import { RunCase, TestGroup, paramsEquals } from '../../framework/index.js';
|
||||
import { TestSuiteListing, TestSuiteListingEntry } from '../../framework/listing.js';
|
||||
import { TestFileLoader, TestLoader, TestSpecOrReadme } from '../../framework/loader.js';
|
||||
import { Logger } from '../../framework/logger.js';
|
||||
import { TestFilterResult } from '../../framework/test_filter/index.js';
|
||||
import { makeQueryString } from '../../framework/url_query.js';
|
||||
import { assert, objectEquals } from '../../framework/util/index.js';
|
||||
import { generateMinimalQueryList } from '../common/framework/generate_minimal_query_list.js';
|
||||
import { RunCase, TestGroup, paramsEquals } from '../common/framework/index.js';
|
||||
import { TestSuiteListing, TestSuiteListingEntry } from '../common/framework/listing.js';
|
||||
import { TestFileLoader, TestLoader, TestSpecOrReadme } from '../common/framework/loader.js';
|
||||
import { Logger } from '../common/framework/logger.js';
|
||||
import { TestFilterResult } from '../common/framework/test_filter/index.js';
|
||||
import { makeQueryString } from '../common/framework/url_query.js';
|
||||
import { assert, objectEquals } from '../common/framework/util/index.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
|
|
@ -4,8 +4,8 @@ Unit tests for namespaced logging system.
|
|||
Also serves as a larger test of async test functions, and of the logging system.
|
||||
`;
|
||||
|
||||
import { SkipTestCase, TestGroup, paramsEquals } from '../../framework/index.js';
|
||||
import { Logger } from '../../framework/logger.js';
|
||||
import { SkipTestCase, TestGroup, paramsEquals } from '../common/framework/index.js';
|
||||
import { Logger } from '../common/framework/logger.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
Unit tests for makeFilter.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../framework/index.js';
|
||||
import { TestGroup } from '../common/framework/index.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ import {
|
|||
pexclude,
|
||||
pfilter,
|
||||
poptions,
|
||||
} from '../../framework/index.js';
|
||||
} from '../common/framework/index.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
Unit tests for parameterization.
|
||||
`;
|
||||
|
||||
import { ParamSpec, TestGroup, pcombine, pexclude, pfilter } from '../../framework/index.js';
|
||||
import { ParamSpec, TestGroup, pcombine, pexclude, pfilter } from '../common/framework/index.js';
|
||||
|
||||
import { TestGroupTest } from './test_group_test.js';
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
|
@ -2,13 +2,13 @@ export const description = `
|
|||
Unit tests for test_filter .matches() methods.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../framework/index.js';
|
||||
import { FilterByGroup } from '../../framework/test_filter/filter_by_group.js';
|
||||
import { TestGroup } from '../common/framework/index.js';
|
||||
import { FilterByGroup } from '../common/framework/test_filter/filter_by_group.js';
|
||||
import {
|
||||
FilterByParamsExact,
|
||||
FilterByParamsMatch,
|
||||
FilterByTestMatch,
|
||||
} from '../../framework/test_filter/filter_one_file.js';
|
||||
} from '../common/framework/test_filter/filter_one_file.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
Unit tests for TestGroup.
|
||||
`;
|
||||
|
||||
import { Fixture, TestGroup, assert, poptions } from '../../framework/index.js';
|
||||
import { Fixture, TestGroup, assert, poptions } from '../common/framework/index.js';
|
||||
|
||||
import { TestGroupTest } from './test_group_test.js';
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { TestCaseID } from '../../framework/id.js';
|
||||
import { Fixture, TestGroup, paramsEquals } from '../../framework/index.js';
|
||||
import { LiveTestSpecResult, Logger } from '../../framework/logger.js';
|
||||
import { TestCaseID } from '../common/framework/id.js';
|
||||
import { Fixture, TestGroup, paramsEquals } from '../common/framework/index.js';
|
||||
import { LiveTestSpecResult, Logger } from '../common/framework/logger.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
3
src/unittests/unit_test.ts
Normal file
3
src/unittests/unit_test.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { Fixture } from '../common/framework/fixture.js';
|
||||
|
||||
export class UnitTest extends Fixture {}
|
||||
|
|
@ -2,8 +2,8 @@ export const description = `
|
|||
Unit tests for URL queries.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../framework/index.js';
|
||||
import { makeQueryString } from '../../framework/url_query.js';
|
||||
import { TestGroup } from '../common/framework/index.js';
|
||||
import { makeQueryString } from '../common/framework/url_query.js';
|
||||
|
||||
import { UnitTest } from './unit_test.js';
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
export const description = ``;
|
||||
|
||||
import { TestGroup, pbool, pcombine, poptions } from '../../../framework/index.js';
|
||||
import { TestGroup, pbool, pcombine, poptions } from '../../common/framework/index.js';
|
||||
|
||||
import { MappingTest } from './mapping_test.js';
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
export const description = ``;
|
||||
|
||||
import { TestGroup, pbool, pcombine, poptions } from '../../../framework/index.js';
|
||||
import { TestGroup, pbool, pcombine, poptions } from '../../common/framework/index.js';
|
||||
|
||||
import { MappingTest } from './mapping_test.js';
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
export const description = ``;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
import { GPUTest } from '../gpu_test.js';
|
||||
|
||||
class F extends GPUTest {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
export const description = ``;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
import { GPUTest } from '../gpu_test.js';
|
||||
|
||||
function getBufferDesc(): GPUBufferDescriptor {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
export const description = ``;
|
||||
|
||||
import { Fixture, TestGroup } from '../../../framework/index.js';
|
||||
import { Fixture, TestGroup } from '../../common/framework/index.js';
|
||||
|
||||
export const g = new TestGroup(Fixture);
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { C } from '../../framework/index.js';
|
||||
import { C } from '../common/framework/index.js';
|
||||
|
||||
// Textures
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
Basic tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
import { GPUTest } from '../gpu_test.js';
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
|
@ -2,8 +2,8 @@ export const description = `
|
|||
Basic command buffer compute tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../../framework/index.js';
|
||||
import GLSL from '../../../../tools/glsl.macro.js';
|
||||
import { TestGroup } from '../../../common/framework/index.js';
|
||||
import GLSL from '../../../common/tools/glsl.macro.js';
|
||||
import { GPUTest } from '../../gpu_test.js';
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
copy{Buffer,Texture}To{Buffer,Texture} tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
import { GPUTest } from '../gpu_test.js';
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
Basic command buffer rendering tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../../framework/index.js';
|
||||
import { TestGroup } from '../../../common/framework/index.js';
|
||||
import { GPUTest } from '../../gpu_test.js';
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
export const description = ``;
|
||||
|
||||
import { TestGroup } from '../../../../framework/index.js';
|
||||
import GLSL from '../../../../tools/glsl.macro.js';
|
||||
import { TestGroup } from '../../../common/framework/index.js';
|
||||
import GLSL from '../../../common/tools/glsl.macro.js';
|
||||
import { GPUTest } from '../../gpu_test.js';
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
export const description = `
|
||||
renderPass store op test that drawn quad is either stored or cleared based on storeop`;
|
||||
|
||||
import { TestGroup } from '../../../../framework/index.js';
|
||||
import GLSL from '../../../../tools/glsl.macro.js';
|
||||
import { TestGroup } from '../../../common/framework/index.js';
|
||||
import GLSL from '../../../common/tools/glsl.macro.js';
|
||||
import { GPUTest } from '../../gpu_test.js';
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
copy imageBitmap To texture tests.
|
||||
`;
|
||||
|
||||
import { TestGroup, pcombine, poptions } from '../../framework/index.js';
|
||||
import { TestGroup, pcombine, poptions } from '../common/framework/index.js';
|
||||
|
||||
import { GPUTest } from './gpu_test.js';
|
||||
|
||||
|
|
@ -4,23 +4,23 @@ Examples of writing CTS tests with various features.
|
|||
Start here when looking for examples of basic framework usage.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../framework/index.js';
|
||||
import { TestGroup } from '../common/framework/index.js';
|
||||
|
||||
import { GPUTest } from './gpu_test.js';
|
||||
|
||||
// To run these tests in the standalone runner, run `grunt build` or `grunt pre` then open:
|
||||
// - http://localhost:8080/?runnow=1&q=cts:examples:
|
||||
// - http://localhost:8080/?runnow=1&q=webgpu:examples:
|
||||
// To run in WPT, copy/symlink the out-wpt/ directory as the webgpu/ directory in WPT, then open:
|
||||
// - (wpt server url)/webgpu/cts.html?q=cts:examples:
|
||||
// - (wpt server url)/webgpu/cts.html?q=webgpu:examples:
|
||||
//
|
||||
// Tests here can be run individually or in groups:
|
||||
// - ?q=cts:examples:basic/async=
|
||||
// - ?q=cts:examples:basic/
|
||||
// - ?q=cts:examples:
|
||||
// - ?q=webgpu:examples:basic/async=
|
||||
// - ?q=webgpu:examples:basic/
|
||||
// - ?q=webgpu:examples:
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
||||
// Note: spaces in test names are replaced with underscores: cts:examples:test_name=
|
||||
// Note: spaces in test names are replaced with underscores: webgpu:examples:test_name=
|
||||
g.test('test name', t => {});
|
||||
|
||||
g.test('basic', t => {
|
||||
|
|
@ -66,8 +66,8 @@ g.test('basic/async', async t => {
|
|||
// They can also be private by starting with an underscore (_result), which passes
|
||||
// them into the test but does not make them part of the case name:
|
||||
//
|
||||
// - cts:examples:basic/params={"x":2,"y":4} runs with t.params = {x: 2, y: 5, _result: 6}.
|
||||
// - cts:examples:basic/params={"x":-10,"y":18} runs with t.params = {x: -10, y: 18, _result: 8}.
|
||||
// - webgpu:examples:basic/params={"x":2,"y":4} runs with t.params = {x: 2, y: 5, _result: 6}.
|
||||
// - webgpu:examples:basic/params={"x":-10,"y":18} runs with t.params = {x: -10, y: 18, _result: 8}.
|
||||
g.test('basic/params', t => {
|
||||
t.expect(t.params.x + t.params.y === t.params._result);
|
||||
}).params([
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
export const description = ``;
|
||||
|
||||
import { attemptGarbageCollection } from '../../framework/collect_garbage.js';
|
||||
import { TestGroup, raceWithRejectOnTimeout } from '../../framework/index.js';
|
||||
import { attemptGarbageCollection } from '../common/framework/collect_garbage.js';
|
||||
import { TestGroup, raceWithRejectOnTimeout } from '../common/framework/index.js';
|
||||
|
||||
import { GPUTest } from './gpu_test.js';
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { getGPU } from '../../framework/gpu/implementation.js';
|
||||
import { Fixture, assert, unreachable } from '../../framework/index.js';
|
||||
import { getGPU } from '../common/framework/gpu/implementation.js';
|
||||
import { Fixture, assert, unreachable } from '../common/framework/index.js';
|
||||
|
||||
type glslang = typeof import('@webgpu/glslang/dist/web-devel/glslang');
|
||||
type Glslang = import('@webgpu/glslang/dist/web-devel/glslang').Glslang;
|
||||
|
|
@ -108,7 +108,7 @@ export class GPUTest extends Fixture {
|
|||
|
||||
async initGLSL(): Promise<void> {
|
||||
if (!glslangInstance) {
|
||||
const glslangPath = '../../glslang.js';
|
||||
const glslangPath = '../common/glslang.js';
|
||||
let glslangModule: () => Promise<Glslang>;
|
||||
try {
|
||||
glslangModule = ((await import(glslangPath)) as glslang).default;
|
||||
4
src/webgpu/index.ts
Normal file
4
src/webgpu/index.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { TestSuiteListing } from '../common/framework/listing.js';
|
||||
import { makeListing } from '../common/tools/crawl.js';
|
||||
|
||||
export const listing: Promise<TestSuiteListing> = makeListing(__filename);
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
export const description = `
|
||||
computePass test that sampled texture is cleared`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import GLSL from '../../../tools/glsl.macro.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
import GLSL from '../../common/tools/glsl.macro.js';
|
||||
import { GPUTest } from '../gpu_test.js';
|
||||
|
||||
export const g = new TestGroup(GPUTest);
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
createBindGroup validation tests.
|
||||
`;
|
||||
|
||||
import { C, TestGroup, pcombine, poptions, unreachable } from '../../../framework/index.js';
|
||||
import { C, TestGroup, pcombine, poptions, unreachable } from '../../common/framework/index.js';
|
||||
import { kBindingTypes } from '../capability_info.js';
|
||||
|
||||
import { BindingResourceType, ValidationTest, resourceBindingMatches } from './validation_test.js';
|
||||
|
|
@ -2,8 +2,8 @@ export const description = `
|
|||
createBindGroupLayout validation tests.
|
||||
`;
|
||||
|
||||
import { C, TestGroup, poptions } from '../../../framework/index.js';
|
||||
import { ParamSpec } from '../../../framework/params/index.js';
|
||||
import { C, TestGroup, poptions } from '../../common/framework/index.js';
|
||||
import { ParamSpec } from '../../common/framework/params/index.js';
|
||||
import {
|
||||
kBindingTypeInfo,
|
||||
kBindingTypes,
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
createPipelineLayout validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup, pbool, pcombine, poptions } from '../../../framework/index.js';
|
||||
import { TestGroup, pbool, pcombine, poptions } from '../../common/framework/index.js';
|
||||
import { kBindingTypeInfo, kBindingTypes, kShaderStageCombinations } from '../capability_info.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
|
@ -2,8 +2,8 @@ export const description = `
|
|||
createRenderPipeline validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup, poptions } from '../../../framework/index.js';
|
||||
import GLSL from '../../../tools/glsl.macro.js';
|
||||
import { TestGroup, poptions } from '../../common/framework/index.js';
|
||||
import GLSL from '../../common/tools/glsl.macro.js';
|
||||
import { kTextureFormatInfo, kTextureFormats } from '../capability_info.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
createTexture validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup, poptions } from '../../../framework/index.js';
|
||||
import { TestGroup, poptions } from '../../common/framework/index.js';
|
||||
import { kTextureFormatInfo, kTextureFormats } from '../capability_info.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
createView validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
||||
|
|
@ -2,8 +2,13 @@ export const description = `
|
|||
error scope validation tests.
|
||||
`;
|
||||
|
||||
import { getGPU } from '../../../framework/gpu/implementation.js';
|
||||
import { Fixture, TestGroup, assert, raceWithRejectOnTimeout } from '../../../framework/index.js';
|
||||
import { getGPU } from '../../common/framework/gpu/implementation.js';
|
||||
import {
|
||||
Fixture,
|
||||
TestGroup,
|
||||
assert,
|
||||
raceWithRejectOnTimeout,
|
||||
} from '../../common/framework/index.js';
|
||||
|
||||
class F extends Fixture {
|
||||
_device: GPUDevice | undefined = undefined;
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
fences validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
queue submit validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
||||
|
|
@ -2,8 +2,8 @@ export const description = `
|
|||
render pass validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import GLSL from '../../../tools/glsl.macro.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
import GLSL from '../../common/tools/glsl.macro.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
render pass descriptor validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
setBindGroup validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup, pcombine, poptions } from '../../../framework/index.js';
|
||||
import { TestGroup, pcombine, poptions } from '../../common/framework/index.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ export const description = `
|
|||
setBlendColor validation tests.
|
||||
`;
|
||||
|
||||
import { TestGroup } from '../../../framework/index.js';
|
||||
import { TestGroup } from '../../common/framework/index.js';
|
||||
|
||||
import { ValidationTest } from './validation_test.js';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue