# Testing

```sh
make test-pic      # crash, tool, provider, session, TUI and unit suites; ASan/UBSan and release builds
make test-docs     # the reference against the code, the README budget, links
make bench-pic     # compare timings with bench/baselines/<OS>-<arch>.tsv
```

`make test-pic` runs every suite in parallel, one job per core (`JOBS=1` for the serial order); each
script keeps its output in `build/pic/logs` and prints it only when it fails. Tests never touch the
real `~/.pic`: they run with a private `HOME` and `PIC_MODEL_CATALOG=offline`. `make install-pic`
runs the whole suite before it installs.

CI runs the same suite on every check-in and gates trunk. [Landing](landing.md) has the details.
Changes are also run under [Fil-C](https://fil-c.org), where any memory error is a crash
(`tools/remote/`). [Fil-C](filc.md) says how to run it.

## Compilers

The build uses `CC` (default `cc`) and compiles with `-Werror`; it is warning-clean under clang and
gcc (`make CC=gcc-16 pic`). gcc's `-Wformat-truncation`, which clang does not have, is off: a
clipped error or display string is the intended outcome there.

## Fuzzing

`make fuzz-decode`, `fuzz-http`, `fuzz-chat` and `fuzz-responses` need an LLVM clang with libFuzzer;
`FUZZ_SECONDS` bounds a run. CI runs each for 30 seconds when the runner has one.

## Generated files

`src/changelog.inc` is built from `CHANGELOG.md` by `tools/changelog-inc.sh` and is not committed.
The key table in `docs/reference/keys.md` is generated from `src/tui/keymap.c` by `sh
test/pic/docs.sh --keys`, and `make test-docs` fails when they differ.
