Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,36 @@ on a shared runner: rerun that side before calling it a regression. Other jobs (
Comment on the pull request with the two run links, the `main` commit, and per side the test's own line and the
summary (red: ...; green: ...).

#### A D3D12 or Python pull request, red and green on your machine

`scripts/red_green.py` does the same locally for the D3D12 crates' `cargo test` and the Python tests under
`tests/`:

```
python -I scripts/red_green.py <pull request number>
```

- **Green** is current `main` (it fetches `origin/main`) with the pull request merged.
- **Red** is current `main` plus only the pull request's tests. That means its test files (under a `tests` folder,
`*_tests.rs`, `tests.rs`), and, in other Rust files, the hunks that change only `#[cfg(test)]` items. Those are
cherry-picked with a 3-way merge. A conflict, or a pull request that changes no test, is "red not constructible".
A hunk that mixes test and other code stays on the green side only.
- It runs `cargo test --no-fail-fast` for the crates under `d3d12/crates` and `d3d12/apps` the pull request touches,
from `d3d12/` so the pinned toolchain applies. It also runs each changed `tests/**/test*.py` with unittest. Both
sides run in one worktree with one cargo target dir, red first, under `<git common dir>/red-green` (`--work-dir`
to move it). The worktree and the target dir stay for the next run, which then builds only what changed. The
target dir takes several GB; delete the folder (and run `git worktree prune`) when done.
- It prints the tests that go from red to green, those that pass on red and fail on green, those that fail on both
(failing on `main` too), and those found on one side only. The verdict is one of: `red then green` (exit 0),
`no red`, `red does not build`, `green fails`, `red not constructible`, `green not constructible`, `no tests ran`
(exit 1). `--json` prints all of it.
- `red does not build` is the case the fork-CI steps above call "does not build without the pull request's new
file": the test needs the new code, which does not show that it catches the bug.
- `--crate <name>` adds a crate, `--no-cargo` or `--no-python` leaves one kind out, `--base <ref>` tests on another
base, and `--no-fetch` uses the refs as they are.

C++ `runtime/` tests are not run by it; use the fork's CI as above.

## What you need

- **Python 3.12+**, which `make_game.py` requires (it stops with "Python 3.12 or newer is needed" on an older one, so
Expand Down
Loading
Loading