docs: the TMPDIR each test's command runs with
The README's test conventions say that each test runs with TMPDIR naming a directory of its own, made for the run, so that fs::temp_directory_path() in it is the test's alone while another run goes on, where its runner hands it TMPDIR, which wine does not, a Windows test's TMP, TEMP and temp directory being the Wine prefix's whatever the environment gives, and wasmtime, which hands a test no environment, does not either; how much longer its path is, which a test that binds a socket there has to leave room for; that what it leaves there is removed when it passes or skips and kept, with its place in its log, when it does not; that a later run removes what was kept once the run's directory has gone a minute unchanged, a minute after that run ended or, where it was killed, after its last change to it; and that a test that builds against a sysroot it stages there, or has crafter-build fetch a repository it stages there, whose path keys crafter-build's cache and is a new one every run, points XDG_CACHE_HOME into its TMPDIR as well. AGENTS.template.md's testing conventions say why the fixed staging name is safe now, that a test that writes to /tmp by name makes a directory of its own there, a PrivateDirectory, and that a test that builds against what it stages keeps its cache in its scratch directory.
This commit is contained in:
parent
0602e282b2
commit
e643f83c00
2 changed files with 2 additions and 1 deletions
|
|
@ -299,6 +299,7 @@ Test conventions:
|
|||
|
||||
- **Exit codes**: `0` = ✅ pass, nonzero = ❌ fail, **`77`** = ⏭ skipped (autoconf convention; use it for runtime opt-outs like "tool not on PATH").
|
||||
- Each test runs in its own subprocess — a segfault doesn't take the runner down.
|
||||
- Each test runs with `TMPDIR` naming a directory of its own, `<run>/<name>` in a directory made for the run in the temp directory, or, where the run has given that name out already, the first of `<name>-2`, `<name>-3` and on that it has not, so `fs::temp_directory_path()` in a test is the test's alone, even with another run going at the same time. Its path is longer than the temp directory's by 28 bytes and the name of the test's own directory, room a test that binds a Unix socket there has to leave: a socket's path holds 107 bytes. That takes a runner that hands the test `TMPDIR`, as running it directly and qemu-user do: under wine a Windows test does not get `TMPDIR`, and its `TMP`, `TEMP` and temp directory are the Wine prefix's, which every run in that prefix shares; wasmtime gives a test no environment at all. What a test leaves in its `TMPDIR` is removed when it passes or skips. When it fails, crashes or times out, what it left is kept, and its log in `build/test-logs/` says where, as does what is printed of a test that fails or crashes. A later run removes it once the run's directory has gone a minute unchanged: a minute after the run that kept it ended, or, where that run was killed, a minute after it last made or removed a test's directory there. A test that builds against a sysroot or mingw prefix it stages there, or has crafter-build fetch a repository it stages there (an `ExternalDependency` or a `GitProject` of it), keys crafter-build's cache on that path or URL, which is a new one every run: point `XDG_CACHE_HOME` into its `TMPDIR` as well, or every run leaves an entry of its own in the cache.
|
||||
- Default timeout is 60 s per test, runs in parallel up to `hardware_concurrency()` tests (`--jobs=`). The steps of their builds share one limit, a build's: as many at once as there are hardware threads.
|
||||
- Stdout+stderr is captured and printed atomically on completion. A test that fails, crashes or times out once it is built also writes what it printed, and what crafter-build said of it, to `build/test-logs/<name>.log`, when that is anything, and, where it sets `Test::wayland` and ran, what its compositor printed, if anything, to `<name>.compositor.log` beside it (what a compositor that did not start printed is in `<name>.log`); one that failed to build, or did not get that far, writes neither. `<name>` is the test's name with `-2`, `-3` and on after it where the run has given that name out already, as two configurations or two targets may each declare a test of one name.
|
||||
- A broken fixture `project.cpp` is reported as a single failed test, not a fatal error — other tests still run.
|
||||
|
|
|
|||
Loading…
Reference in a new issue