summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/docs/build.md
blob: d786bbc18c22ca6a4cbde3f9852f069a8528f90c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Building

Building the project is not usually needed for local development.
However, for exports to WPT, NodeJS, [or deployment](https://gpuweb.github.io/cts/),
files can be pre-generated.

## Build types

The project can be built several different ways, each with a different output directory:

### 0. on-the-fly builds (no output directory)

Use `npm run start` to launch a server that live-compiles everything as needed.
Use `tools/run_node` and other tools to run under `ts-node` which compiles at runtime.

### 1. `out` directory

**Built with**: `npm run standalone`

**Serve locally with**: `npx grunt serve`

**Used for**: Static deployment of the CTS, primarily for [gpuweb.github.io/cts](https://gpuweb.github.io/cts/).

### 2. `out-wpt` directory

**Built with**: `npm run wpt`

**Used for**: Deploying into [Web Platform Tests](https://web-platform-tests.org/). See [below](#export-to-wpt) for more information.

Contains:

- An adapter for running WebGPU CTS tests under WPT
- A copy of the needed files from `out/`
- A copy of any `.html` test cases from `src/`

### 3. `out-node` directory

**Built with**: `npm run node`

**Used for**: Running NodeJS tools, if you want to specifically avoid the live-compilation overhead of the `tools/` versions, or are running on a deployment which no longer has access to `ts-node` (which is a build-time dependency). For example:

- `node out-node/common/runtime/cmdline.js` ([source](../src/common/runtime/cmdline.ts)) - A command line interface test runner
- `node out-node/common/runtime/server.js` ([source](../src/common/runtime/server.ts)) - An HTTP server for executing CTS tests with a REST interface

## Testing

To build and run all pre-submit checks (including type and lint checks and
unittests), use:

```sh
npm test
```

For checks only:

```sh
npm run check
```


## Export to WPT

Run `npm run wpt`.

Copy (or symlink) the `out-wpt/` directory as the `webgpu/` directory in your
WPT checkout or your browser's "internal" WPT test directory.