From 2c9c7397321975295efb19a76c19b375ac603bcc Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 16:42:41 +0300 Subject: [PATCH 01/12] Make an_unwritable_path_fails_at_once hold for root The test started a recording at /nonexistent-root-dir/x/clip.webm and expected an error. Recorder::start creates the missing parent directories, which a regular user cannot do below / but root can: under the runner image (Gitea run 1091, docker.gitea.com/runner-images:ubuntu-24.04, root) the call succeeded, created /nonexistent-root-dir and left a file behind. The test now builds its unwritable paths in a temporary directory from things that fail for every user: a path below a regular file (ENOTDIR, so create_dir_all fails) and a path that names an existing directory (EISDIR, so File::create fails). The unknown-container name is checked in the same place and also asserts that no file was created. Reproduced in the runner image as root with the old test failing and the new one passing. Co-Authored-By: Claude Sonnet 5.5 --- .../voelin-media/src/studio/output/record.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/voelin-media/src/studio/output/record.rs b/crates/voelin-media/src/studio/output/record.rs index 29c5cb1..0c78cd3 100644 --- a/crates/voelin-media/src/studio/output/record.rs +++ b/crates/voelin-media/src/studio/output/record.rs @@ -350,7 +350,22 @@ mod tests { #[test] fn an_unwritable_path_fails_at_once() { - assert!(Recorder::start("/nonexistent-root-dir/x/clip.webm", 0, 2).is_err()); - assert!(Recorder::start("clip.mp4", 0, 2).is_err()); + let dir = dir("unwritable"); + // A path below a regular file fails for every user, root included + // (ENOTDIR). A directory that is merely missing would be created, and + // a read-only one is written to by root. + let file = dir.join("not-a-directory"); + std::fs::write(&file, b"x").unwrap(); + assert!(Recorder::start(file.join("x").join("clip.webm"), 0, 2).is_err()); + // The directory is there and the file cannot be created because the + // path names a directory (EISDIR, again for every user). + let named_like_a_file = dir.join("clip.webm"); + std::fs::create_dir(&named_like_a_file).unwrap(); + assert!(Recorder::start(&named_like_a_file, 0, 2).is_err()); + // A name that asks for no known container is refused before any file + // is created. + assert!(Recorder::start(dir.join("clip.mp4"), 0, 2).is_err()); + assert!(!dir.join("clip.mp4").exists()); + std::fs::remove_dir_all(&dir).ok(); } } From 8541d7c9e568e1da8246041d96afffb29ca3551c Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 17:16:19 +0300 Subject: [PATCH 02/12] Document what the Linux job image lacks and how the tests cope The test step runs as root in docker.gitea.com/runner-images:ubuntu-24.04 with only the apt packages of the system-dependencies action. docs/ci.md now says how to run the CI's test command in that image with --no-fail-fast, and lists what the image has no (a regular user, sound card, PipeWire daemons, a session bus, GPU and VA-API, FFmpeg, an H.264 encoder, Wayland, a browser, the TeamSpeak dev servers) with what each kind of test does about it. It also records that two voelin-core tests fail on a machine whose ::1 swallows connections, whatever the change under test is. Co-Authored-By: Claude Sonnet 5.5 --- docs/ci.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/docs/ci.md b/docs/ci.md index 61871e7..910b93f 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -102,6 +102,66 @@ all step results. Local YAML/shell checks do not prove that a particular Gitea instance, runner registration, network policy or resource allocation can complete this job. +### Tests under the job image + +The test step runs as **root** in an Ubuntu 24.04 container +(`docker.gitea.com/runner-images:ubuntu-24.04`, `HOME=/root`) to which only +the apt packages of the system-dependencies action are added. A test that +assumes a developer machine fails there, and a run takes about an hour, so +check a change to the tests the way CI runs them, with every failing test of +every crate listed in one go (`--no-fail-fast`): + +```sh +# Root owns what the container writes: keep it in a directory of its own. +mkdir -p .scratch +docker run --rm -v "$PWD":/src -w /src -e HOME=/root \ + -e CARGO_HOME=/src/.scratch/cargo -e RUSTUP_HOME=/src/.scratch/rustup \ + -e CARGO_TARGET_DIR=/src/.scratch/target \ + docker.gitea.com/runner-images:ubuntu-24.04 bash -c ' + apt-get update && apt-get install -y --no-install-recommends \ + build-essential ca-certificates cmake curl git jq pkg-config python3 \ + libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev \ + libdav1d-dev libpipewire-0.3-dev libspa-0.2-dev libclang-dev xvfb xauth + curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs | \ + sh -s -- -y --profile minimal --default-toolchain none + . "$CARGO_HOME/env" && rustup toolchain install + xvfb-run -a bash -c "VOELIN_X11_TEST_DISPLAY=\$DISPLAY \ + cargo test --workspace --locked --no-fail-fast"' +``` + +The private VoelinProtocol dependency needs the deploy key +([below](#voelinprotocol-access)); without it, point git at a local bare +clone of that repository with +`git config --global url."file:///path/to/VoelinProtocol.git".insteadOf +ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git` and +`CARGO_NET_GIT_FETCH_WITH_CLI=true`, which leaves `Cargo.lock` as it is. + +What the image lacks, and what the tests do about it. A test that is about +the missing piece prints `skipped: ` (or is `#[ignore]`d with the +reason) and passes; any other test does not need the piece. + +| The image has no | Tests | +|---|---| +| Regular user (root writes anywhere and creates missing directories) | Nothing relies on a permission bit or a missing directory failing. A path that cannot be written is built from something that fails for root too: below a regular file (`ENOTDIR`) or naming a directory (`EISDIR`), as `an_unwritable_path_fails_at_once` of the recorder does. | +| Sound card (`/dev/snd`), PipeWire and WirePlumber daemons | `libpipewire` and ALSA are there to build against only. `tests/pipewire_apps.rs` needs `pipewire`, `wireplumber` and `dbus-daemon` and prints `skipped: needs pipewire, wireplumber and dbus-daemon`. The camera tests are `#[ignore]`d (a camera and PipeWire). | +| D-Bus session bus | `voelin-platform`'s portal proxy test returns with `no session bus: run under dbus-run-session`; the notification and capture-portal tests run only where no bus is configured, and check that talking to a missing service fails cleanly. | +| GPU, `/dev/dri`, VA-API, `/dev/udmabuf` | The VA-API and DMA-BUF tests print `no usable h264_vaapi, skipped`, `no /dev/udmabuf, skipped` or `no VA-API surfaces to export, skipped`. | +| FFmpeg libraries, `ffmpeg` and `ffprobe` | The FFmpeg tests of `voelin-media` print `FFmpeg not available (…), skipped`. The studio tests that read a recording back with `ffprobe` write and check the file themselves and skip only the `ffprobe` check; the RTMP tests need all three and skip. | +| H.264 encoder (no FFmpeg, no GPU, no OpenH264 library: `VOELIN_OPENH264_LIB` is unset and the download tests are `#[ignore]`d) | Tests that need an H.264 encoder print `no H.264 encoder on this machine`. Tests of codec choice state what `preferred_codec` promises with whatever the machine can encode. VP8 and VP9 (libvpx) are built in, so their round trips run. | +| X11 or Wayland display | `xvfb-run` supplies one X11 display and the step hands it over as `VOELIN_X11_TEST_DISPLAY` to the X11 capture and hotkey tests. `VOELIN_WLROOTS_TEST_DISPLAY` is unset, so the wlroots capture test prints `skipped`. | +| Playwright and Chromium (the image has Node) | The browser interop tests print `skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)`. | +| TeamSpeak dev servers | The live tests print `skipped: set VOELIN_LIVE=1 with the dev servers running` or are `#[ignore]`d. | +| DNS and internet for the tests | Tests that resolve real names or download are `#[ignore]`d with the reason. | + +`localhost` resolves to `::1` first in this image (it also has `127.0.0.1`), +and the tests that reach a server bound to `127.0.0.1` through `localhost` +pass because the connection to `::1` is refused at once. On a machine where +connections to `::1` hang instead (a development machine with a VPN does +that), two `voelin-core` tests fail whatever the change under test is: +`discover::tests::without_records_the_gateway_itself_is_asked` and +`web::tests::pictures_go_through_the_proxy_named_for_each_hop`. That is a +property of that machine, not of the image. + ### VoelinProtocol access The workspace depends on `voelin-identity` from the **private** repository From cd084980926ea69de0b8a199b5a0ec7ba321b8f2 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 19:11:03 +0300 Subject: [PATCH 03/12] Make the documented image run start cargo, and its VoelinProtocol mirror work The docker run that docs/ci.md prints for the tests under the job image hung for ever once the apt and rustup setup was done: bash -c execs its last command, so xvfb-run became the container's process 1 and never started cargo (probed: with the runner image and xvfb installed, xvfb-run -a as process 1 stays up with an idle Xvfb, and the same command under --init finishes). The command now has --init. The runner is not affected: it starts its steps with docker exec. The hint for the private dependency is part of the block now, so the block runs as printed: the bare clone is mounted at /protocol.git (it was never mounted into the container before) and `git config` runs with -C /, because a git worktree's .git file points outside the /src mount and git config in /src exits 128 with "gitfile does not point to a valid repository". Co-Authored-By: Claude Sonnet 5.5 --- docs/ci.md | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/ci.md b/docs/ci.md index 910b93f..85cf259 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -112,12 +112,17 @@ check a change to the tests the way CI runs them, with every failing test of every crate listed in one go (`--no-fail-fast`): ```sh +# A bare clone of the private VoelinProtocol repository (see below the block). +: "${PROTOCOL_GIT:?path of a bare clone of VoelinProtocol}" # Root owns what the container writes: keep it in a directory of its own. mkdir -p .scratch -docker run --rm -v "$PWD":/src -w /src -e HOME=/root \ +docker run --rm --init -v "$PWD":/src -w /src -e HOME=/root \ + -v "$PROTOCOL_GIT":/protocol.git:ro -e CARGO_NET_GIT_FETCH_WITH_CLI=true \ -e CARGO_HOME=/src/.scratch/cargo -e RUSTUP_HOME=/src/.scratch/rustup \ -e CARGO_TARGET_DIR=/src/.scratch/target \ docker.gitea.com/runner-images:ubuntu-24.04 bash -c ' + git -C / config --global url."file:///protocol.git".insteadOf \ + ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git apt-get update && apt-get install -y --no-install-recommends \ build-essential ca-certificates cmake curl git jq pkg-config python3 \ libasound2-dev libfontconfig1-dev libxkbcommon-dev libvpx-dev \ @@ -129,12 +134,21 @@ docker run --rm -v "$PWD":/src -w /src -e HOME=/root \ cargo test --workspace --locked --no-fail-fast"' ``` +`--init` is required: `bash -c` runs its last command, `xvfb-run`, as the +container's process 1, and that never gets to start `cargo` (the command +hangs). The runner starts its steps with `docker exec` in a container whose +process 1 is something else, so CI itself is not affected. + The private VoelinProtocol dependency needs the deploy key -([below](#voelinprotocol-access)); without it, point git at a local bare -clone of that repository with -`git config --global url."file:///path/to/VoelinProtocol.git".insteadOf -ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git` and -`CARGO_NET_GIT_FETCH_WITH_CLI=true`, which leaves `Cargo.lock` as it is. +([below](#voelinprotocol-access)). The block reads it from a local bare clone +instead: `PROTOCOL_GIT` is mounted at `/protocol.git` and git is told to use +it in place of the SSH URL (with `CARGO_NET_GIT_FETCH_WITH_CLI=true`, as in CI, +so that cargo runs the `git` command), which leaves `Cargo.lock` as it is. +The `git config` is run with `-C /` because a git worktree's `.git` file points +outside the mount, and `git config` in `/src` then fails with `fatal: gitfile +does not point to a valid repository`. To use the deploy key instead, set it up +as described below and leave out the `PROTOCOL_GIT` lines and the `git config` +command. What the image lacks, and what the tests do about it. A test that is about the missing piece prints `skipped: ` (or is `#[ignore]`d with the From ac6937289d1f243b746bb2eb7fc5ddd408bbfa35 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 19:11:03 +0300 Subject: [PATCH 04/12] Name in docs/ci.md the job image the runner really registers Runner setup told to register ubuntu-24.04:docker://ghcr.io/catthehacker/ ubuntu:act-24.04 while the new section on the tests says the test step runs in docker.gitea.com/runner-images:ubuntu-24.04. The runner of this machine (gitea-runner-performance, register script of its NixOS unit) is registered with ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04, and `docker ps` shows its CI tasks running that image, so the label line was the stale one. It now names that image, the network list names its registry in place of GHCR, and the tests section says it is the image of the ubuntu-24.04 label. Co-Authored-By: Claude Sonnet 5.5 --- docs/ci.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/ci.md b/docs/ci.md index 85cf259..d6963ee 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -46,17 +46,20 @@ the separate `release.yml` workflow below. this label (the left side must match the workflow's `runs-on`): ```text - ubuntu-24.04:docker://ghcr.io/catthehacker/ubuntu:act-24.04 + ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04 ``` Configure this in the runner's labels when registering/configuring it; - an `ubuntu-latest` label alone does not match. The job image must provide - Bash, Git, the OpenSSH client, Node.js for checkout v4, and root or - passwordless sudo for apt. + an `ubuntu-latest` label alone does not match. This is the image of the + runner that runs this repository's CI, and the one the tests are checked + against ([Tests under the job image](#tests-under-the-job-image)). The job + image must provide Bash, Git, the OpenSSH client, Node.js for checkout v4, + and root or passwordless sudo for apt. 3. Allow network access from the runner and job container to the Gitea instance, GitHub (checkout action, dependencies and RustSec advisories), - GHCR (runner image), Ubuntu apt mirrors, rustup distribution servers, - crates.io and dependency/license sources used by cargo-about. The + `docker.gitea.com` (runner image), Ubuntu apt mirrors, rustup + distribution servers, crates.io and dependency/license sources used by + cargo-about. The workspace also depends on the **private** VoelinProtocol repository (`voelin-identity`, over SSH), so the job needs read access to it and the server's SSH port. The workflows set that up themselves from a repository @@ -104,8 +107,9 @@ can complete this job. ### Tests under the job image -The test step runs as **root** in an Ubuntu 24.04 container -(`docker.gitea.com/runner-images:ubuntu-24.04`, `HOME=/root`) to which only +The test step runs as **root** in an Ubuntu 24.04 container of the +`ubuntu-24.04` label ([Runner setup](#runner-setup): +`docker.gitea.com/runner-images:ubuntu-24.04`, `HOME=/root`) to which only the apt packages of the system-dependencies action are added. A test that assumes a developer machine fails there, and a run takes about an hour, so check a change to the tests the way CI runs them, with every failing test of From 172bee533764c77f6f794ed76867f9154a3bddea Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 19:11:42 +0300 Subject: [PATCH 05/12] Say what the tests print when they skip only as precisely as the code does The table of docs/ci.md quoted one skip message per row, but the tests print several wordings per piece (for the H.264 encoder: "skipped: no H.264 encoder", "skipped: needs VP8 and H.264 encoders", "no h264_vaapi or H.264 decoder, skipped"; for FFmpeg: "FFmpeg not installed, skipped", "no FFmpeg with libavformat, skipped", ...), and some live tests return without printing. The rows now say a skipped line naming the piece, and keep an exact string only where the code has exactly that one. The row on DNS and the internet sat under a column headed "The image has no", which read as if the job had no network; it has, for apt, rustup and crates. The column is now headed "A test cannot count on" and the row says the tests use no DNS or internet and names the #[ignore]d ones that would. Co-Authored-By: Claude Sonnet 5.5 --- docs/ci.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/ci.md b/docs/ci.md index d6963ee..b41b5c0 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -155,21 +155,23 @@ as described below and leave out the `PROTOCOL_GIT` lines and the `git config` command. What the image lacks, and what the tests do about it. A test that is about -the missing piece prints `skipped: ` (or is `#[ignore]`d with the -reason) and passes; any other test does not need the piece. +the missing piece returns without testing it, in most cases after printing a +line that says it skipped and names the piece (the wording differs from test +to test), or is `#[ignore]`d with the reason, and passes; any other test does +not need the piece. -| The image has no | Tests | +| A test cannot count on | What the tests do | |---|---| | Regular user (root writes anywhere and creates missing directories) | Nothing relies on a permission bit or a missing directory failing. A path that cannot be written is built from something that fails for root too: below a regular file (`ENOTDIR`) or naming a directory (`EISDIR`), as `an_unwritable_path_fails_at_once` of the recorder does. | -| Sound card (`/dev/snd`), PipeWire and WirePlumber daemons | `libpipewire` and ALSA are there to build against only. `tests/pipewire_apps.rs` needs `pipewire`, `wireplumber` and `dbus-daemon` and prints `skipped: needs pipewire, wireplumber and dbus-daemon`. The camera tests are `#[ignore]`d (a camera and PipeWire). | +| Sound card (`/dev/snd`), PipeWire and WirePlumber daemons | `libpipewire` and ALSA are there to build against only. `tests/pipewire_apps.rs` needs `pipewire`, `wireplumber` and `dbus-daemon` and, without them, prints a skipped line that names them. The camera tests are `#[ignore]`d (a camera and PipeWire). | | D-Bus session bus | `voelin-platform`'s portal proxy test returns with `no session bus: run under dbus-run-session`; the notification and capture-portal tests run only where no bus is configured, and check that talking to a missing service fails cleanly. | -| GPU, `/dev/dri`, VA-API, `/dev/udmabuf` | The VA-API and DMA-BUF tests print `no usable h264_vaapi, skipped`, `no /dev/udmabuf, skipped` or `no VA-API surfaces to export, skipped`. | -| FFmpeg libraries, `ffmpeg` and `ffprobe` | The FFmpeg tests of `voelin-media` print `FFmpeg not available (…), skipped`. The studio tests that read a recording back with `ffprobe` write and check the file themselves and skip only the `ffprobe` check; the RTMP tests need all three and skip. | -| H.264 encoder (no FFmpeg, no GPU, no OpenH264 library: `VOELIN_OPENH264_LIB` is unset and the download tests are `#[ignore]`d) | Tests that need an H.264 encoder print `no H.264 encoder on this machine`. Tests of codec choice state what `preferred_codec` promises with whatever the machine can encode. VP8 and VP9 (libvpx) are built in, so their round trips run. | +| GPU, `/dev/dri`, VA-API, `/dev/udmabuf` | The VA-API and DMA-BUF tests print a skipped line that names what is missing: a usable `h264_vaapi`, `/dev/udmabuf` or VA-API surfaces to export. | +| FFmpeg libraries, `ffmpeg` and `ffprobe` | The FFmpeg tests of `voelin-media` and `voelin-core` print a skipped line that names what is missing (the libraries, `ffmpeg`, `ffprobe`). The studio tests that read a recording back with `ffprobe` write and check the file themselves and skip only the `ffprobe` check; the RTMP tests need all three and skip. | +| H.264 encoder (no FFmpeg, no GPU, no OpenH264 library: `VOELIN_OPENH264_LIB` is unset and the download test is `#[ignore]`d) | Tests that need an H.264 encoder print a skipped line that says no H.264 encoder is there. Tests of codec choice state what `preferred_codec` promises with whatever the machine can encode. VP8 and VP9 (libvpx) are built in, so their round trips run. | | X11 or Wayland display | `xvfb-run` supplies one X11 display and the step hands it over as `VOELIN_X11_TEST_DISPLAY` to the X11 capture and hotkey tests. `VOELIN_WLROOTS_TEST_DISPLAY` is unset, so the wlroots capture test prints `skipped`. | | Playwright and Chromium (the image has Node) | The browser interop tests print `skipped: set VOELIN_INTEROP=1 (needs node, Playwright and Chromium)`. | -| TeamSpeak dev servers | The live tests print `skipped: set VOELIN_LIVE=1 with the dev servers running` or are `#[ignore]`d. | -| DNS and internet for the tests | Tests that resolve real names or download are `#[ignore]`d with the reason. | +| TeamSpeak dev servers | Without `VOELIN_LIVE=1` the live tests return at once (some print `skipped: set VOELIN_LIVE=1 with the dev servers running`); the gateway's live test is `#[ignore]`d (`needs a running tsgw and TeamSpeak server`). | +| DNS and internet while the tests run (the job needs the network for apt, rustup and crates before they start) | The tests use no DNS or internet; those that would are `#[ignore]`d with the reason: four resolver tests of `tsclientlib` (`needs DNS and the internet`) and the OpenH264 download test. | `localhost` resolves to `::1` first in this image (it also has `127.0.0.1`), and the tests that reach a server bound to `127.0.0.1` through `localhost` From 9aea87643735f27b88fa28387c4cd895c6c16e37 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 19:53:00 +0300 Subject: [PATCH 06/12] Ask improve_level for more than the test identity already has ts::identity::tests::improve_level_keeps_the_key made its identity with Identity::create(), which stops at the first counter whose level is 8 or more, and asked improve_level for 13. About one identity in 32 has 13 or more already, and improve_level then returns it as it is, so the assertion that the counter grew fails. The test does not depend on the machine: it failed 9 times in 300 runs of the single test on a developer machine, and once in the offline run in the runner image of this task, a CI run that fails one time in about thirty for it. The target is now three levels above what the identity has, so the search always runs. The assertions on the level, the callbacks and the counter use that target. The same change is 9254e08 on phase4/seam-followups (which also fixes four other tests that fail on their own and is not merged yet): it is taken here unchanged so that a CI run of this branch does not stop on it, and the two branches merge without a conflict. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/ts/identity.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/voelin-core/src/ts/identity.rs b/crates/voelin-core/src/ts/identity.rs index 83cbdc5..18522ff 100644 --- a/crates/voelin-core/src/ts/identity.rs +++ b/crates/voelin-core/src/ts/identity.rs @@ -618,15 +618,19 @@ mod tests { #[test] fn improve_level_keeps_the_key() { let identity = synthetic(); + // A fresh identity stops at the first counter whose level is 8 or more, + // and about one in 32 has 13 or more already, which `improve_level` + // returns as it is: ask for more than this one has, whatever it has. + let target = identity.level() + 3; let levels = std::sync::Mutex::new(Vec::new()); - let better = improve_level(&identity, 13, &AtomicBool::new(false), |l| { + let better = improve_level(&identity, target, &AtomicBool::new(false), |l| { levels.lock().unwrap().push(l); }) .unwrap(); - assert!(better.level() >= 13); + assert!(better.level() >= target); assert_eq!(better.key().to_pub().get_uid(), identity.key().to_pub().get_uid()); assert!(better.counter() > identity.counter()); - assert!(levels.into_inner().unwrap().iter().any(|l| *l >= 13)); + assert!(levels.into_inner().unwrap().iter().any(|l| *l >= target)); // Cancelled: nothing. assert!(improve_level(&identity, 60, &AtomicBool::new(true), |_| {}).is_none()); // Already there: the same identity. From 637ee58979e40215c51a373cdc200ff1649bb27c Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 20:08:36 +0300 Subject: [PATCH 07/12] Record log lines in the tests through one subscriber for the whole process web::tests::info_lines read the lines a closure logs with tracing::subscriber::with_default. While that scoped subscriber is the only one alive, tracing-core registers a callsite that another thread meets first against that thread's own default, which is none, and the callsite stays disabled for every thread. session::banner_tests:: a_failing_banner_is_logged_once_with_its_address flakes this way (lines == []): it failed in one of eight runs of the CI test step in the runner image of this task (assertion `left == right` failed: [] left: 0 right: 1 at session.rs:2541; it passed in the other seven). Several other tests reach the same "banner not downloaded" callsite through image_finished while it runs. info_lines now installs a recording subscriber as the global default the first time it is called, and each call records into a buffer of its own thread, so every callsite is registered against the same subscriber and no scoped dispatcher is created or dropped while tests run. The result is the same: the lines `f` logged at info and above on its thread. The new test info_lines_see_a_callsite_another_thread_met_first fails with the old helper (lines == []) and passes with the new one. The same change is 4be37e1 on phase4/seam-followups (not merged yet; it measured 1 failure in 300 runs of banner_tests before and 0 in 600 after), taken here unchanged so that a CI run of this branch does not stop on it and the two branches merge without a conflict. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/web.rs | 71 +++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 8 deletions(-) diff --git a/crates/voelin-core/src/web.rs b/crates/voelin-core/src/web.rs index a806ab3..e464aba 100644 --- a/crates/voelin-core/src/web.rs +++ b/crates/voelin-core/src/web.rs @@ -960,11 +960,27 @@ pub(crate) mod tests { /// What `f` logs at info (and above) on this thread: each line its /// message, then its fields (` name=value`). + /// + /// One recording subscriber is installed for the whole test process, the + /// first time this is called, and each call records into a buffer of its + /// own thread. A scoped one (`tracing::subscriber::with_default`) loses + /// lines: while it is the only subscriber alive, a callsite that another + /// test's thread meets first is registered against that thread's own + /// default, which is none, and stays disabled for every thread, so the + /// lines of the test that reads them are gone + /// (`session::banner_tests::a_failing_banner_is_logged_once_with_its_address` + /// failed with no lines at all, once in about thirty runs of the suite). pub(crate) fn info_lines(f: impl FnOnce() -> T) -> (T, Vec) { + use std::cell::RefCell; + use std::sync::Once; use tracing::field::{Field, Visit}; use tracing::span; - struct Lines(Arc>>); + thread_local! { + /// The lines of the `info_lines` running on this thread, if any. + static LINES: RefCell>> = const { RefCell::new(None) }; + } + #[derive(Default)] struct Line(String, String); impl Visit for Line { @@ -975,7 +991,8 @@ pub(crate) mod tests { } } } - impl tracing::Subscriber for Lines { + struct Recorder; + impl tracing::Subscriber for Recorder { fn enabled(&self, metadata: &tracing::Metadata<'_>) -> bool { *metadata.level() <= tracing::Level::INFO } @@ -985,19 +1002,57 @@ pub(crate) mod tests { fn record(&self, _: &span::Id, _: &span::Record<'_>) {} fn record_follows_from(&self, _: &span::Id, _: &span::Id) {} fn event(&self, event: &tracing::Event<'_>) { - let mut line = Line::default(); - event.record(&mut line); - self.0.lock().unwrap().push(line.0 + &line.1); + LINES.with(|lines| { + if let Some(lines) = lines.borrow_mut().as_mut() { + let mut line = Line::default(); + event.record(&mut line); + lines.push(line.0 + &line.1); + } + }); } fn enter(&self, _: &span::Id) {} fn exit(&self, _: &span::Id) {} } - let lines = Arc::new(Mutex::new(Vec::new())); - let result = tracing::subscriber::with_default(Lines(lines.clone()), f); - let lines = lines.lock().unwrap().clone(); + /// Ends the recording of this thread, also when `f` panics. + struct Recording; + impl Drop for Recording { + fn drop(&mut self) { + LINES.with(|lines| lines.borrow_mut().take()); + } + } + + static INSTALL: Once = Once::new(); + INSTALL.call_once(|| { + tracing::subscriber::set_global_default(Recorder) + .expect("no other global tracing subscriber in the tests"); + // Makes every callsite decide again with the subscriber in place, also + // one that a thread was registering while it was being installed + // (creating a `Dispatch` rebuilds the cached interest of all of them). + drop(tracing::Dispatch::new(Recorder)); + }); + + LINES.with(|lines| *lines.borrow_mut() = Some(Vec::new())); + let _recording = Recording; + let result = f(); + let lines = LINES.with(|lines| lines.borrow_mut().take().unwrap_or_default()); (result, lines) } + /// The lines of `info_lines` do not depend on which thread met a callsite + /// first: this one is met on another thread, which records nothing, before + /// the thread that reads the lines meets it. + #[test] + fn info_lines_see_a_callsite_another_thread_met_first() { + fn log() { + tracing::info!("met"); + } + let ((), lines) = info_lines(|| { + std::thread::spawn(log).join().unwrap(); + log(); + }); + assert_eq!(lines, ["met"]); + } + fn temp_dir(tag: &str) -> std::path::PathBuf { let dir = std::env::temp_dir().join(format!("voelin-web-{tag}-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); From 61458df6255ef821e7bbc0e3cb5bd69789e38b5e Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 21:41:29 +0300 Subject: [PATCH 08/12] Cancel the download test's transfer only once its part file is made link::tests::a_file_is_downloaded_through_the_connection_the_link_opens waited for the Started state and then cancelled, expecting the part file to be gone 100 ms later. The download reports Started just before it opens the part file (files::download, then receive), and the open runs on tokio's blocking pool. A cancel that arrives in between finds no part file to remove (link cancel() removes it at once and reports Cancelled), the aborted task cannot stop the open that is already going on, and the part file is made after the cancel: `assert!(!part.exists())` failed. It did so in the second of the final runs of the CI test step in the runner image of this task, and in 10 of 100 runs of the voelin-core lib tests with three of them at a time and 16 busy loops beside them on a 32-core machine (none in 200 such runs with this change). The test now waits for the part file itself, which is what "the transfer waits in the middle" means, and checks that Started was reported. This is a real, if small, defect of the product that the test exposed: a cancel in the moment between Started and the end of the open leaves an empty `.part` next to the target. It is not fixed here: closing it takes reporting Started after the open (it also feeds the chat and the preview size limit) or waiting for the aborted task before the part is removed, which is a change of the transfer code and not of a test. Recorded in the report of this branch. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/link/tests.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/voelin-core/src/link/tests.rs b/crates/voelin-core/src/link/tests.rs index 90f8c77..5d71f0a 100644 --- a/crates/voelin-core/src/link/tests.rs +++ b/crates/voelin-core/src/link/tests.rs @@ -598,15 +598,20 @@ async fn a_file_is_downloaded_through_the_connection_the_link_opens() { report, }); let LinkCmd::OpenRead { reply, .. } = rig.inner_cmd().await else { panic!("a connection") }; - // A file whose bytes do not come: the transfer waits in the middle. + // A file whose bytes do not come: the transfer waits in the middle, with + // its part file made. `Started` is reported just before the part file is + // opened, and a cancel in between would find nothing to remove while the + // open still goes on, so the part file is what is waited for. let (server, client) = tokio::io::duplex(64); let _ = reply.send(Ok((1 << 20, Box::pin(client)))); for _ in 0..500 { - if states.lock().unwrap().iter().any(|s| matches!(s, TransferState::Started { .. })) { + if part.exists() { break; } tokio::time::sleep(Duration::from_millis(10)).await; } + assert!(part.exists(), "the transfer made its part file: {:?}", states.lock().unwrap()); + assert!(states.lock().unwrap().iter().any(|s| matches!(s, TransferState::Started { .. }))); rig.give(LinkCmd::CancelTransfer(3)); assert_eq!(final_state(&states).await, TransferState::Cancelled); rig.quiet(); From 272de7a13de64b6410b8d78b5c1ff3f48e82b9f5 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 21:41:44 +0300 Subject: [PATCH 09/12] Read the streamer's stats until they show what the viewer already saw Two voelin-core tests read Streamer::stats() once, at the moment a consumer had seen the effect, and the stats lag behind it: - stream::tests::test_pattern_through_stream_tasks asserted `video_frames >= 15` right after the viewer had decoded 15 pictures. The encoder counts a frame after the sink has taken it (`sink.send_video(..)`, then `fetch_add`), so the 15th picture can be at the viewer first: video_frames was 14 with captured_frames 15 and the picture on screen. - media::tests::an_automatic_bitrate_follows_the_stream asserted the layer's bitrate in the stats right after the sink had been told the layer's format; the stats had 0 (the layer's target is stored by the encoder thread, not by the call that tells the sink). Both now poll for the value with a deadline (5 s, and 10 s as the test's other waits), which is the same assertion without the order of two threads. Before, on a 32-core machine with 32 busy loops beside the runs: the first failed on that assertion in 7 of 150 runs of the stream tests six at a time, the second in 19 of 120 runs of the voelin-core lib tests six at a time. After, in 200 runs of the lib tests three at a time with 16 busy loops beside them, neither failed on these assertions. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/media.rs | 7 ++++++- crates/voelin-core/src/stream.rs | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/voelin-core/src/media.rs b/crates/voelin-core/src/media.rs index 5eb0986..38db2da 100644 --- a/crates/voelin-core/src/media.rs +++ b/crates/voelin-core/src/media.rs @@ -3540,7 +3540,12 @@ mod tests { let count = lock(&sink.formats).len(); tokio::time::sleep(Duration::from_millis(200)).await; assert_eq!(lock(&sink.formats).len(), count); - assert_eq!(streamer.stats().layers[0].bitrate, auto_bitrate(640, 480, 30)); + // The stats follow the sink's being told, not the other way round. + let deadline = Instant::now() + Duration::from_secs(10); + while streamer.stats().layers[0].bitrate != auto_bitrate(640, 480, 30) { + assert!(Instant::now() < deadline, "{:?}", streamer.stats().layers); + tokio::time::sleep(Duration::from_millis(20)).await; + } let update = StreamerConfigUpdate { fps: Some(15), ..StreamerConfigUpdate::default() }; streamer.reconfigure(&codecs, update).unwrap(); told(15).await; diff --git a/crates/voelin-core/src/stream.rs b/crates/voelin-core/src/stream.rs index 585631e..478db9a 100644 --- a/crates/voelin-core/src/stream.rs +++ b/crates/voelin-core/src/stream.rs @@ -1701,7 +1701,16 @@ mod tests { let stats = pipeline.stats(); assert_eq!(stats.codec, Some(Codec::Vp8)); assert!(stats.error.is_none(), "{stats:?}"); - let sent = streamer.stats(); + // The encoder counts a frame once the sink has taken it, so the picture + // can be at the viewer before the count has moved. + let mut sent = streamer.stats(); + for _ in 0..500 { + if sent.video_frames >= 15 && sent.audio_frames > 0 { + break; + } + tokio::time::sleep(Duration::from_millis(10)).await; + sent = streamer.stats(); + } assert!(sent.video_frames >= 15 && sent.audio_frames > 0, "{sent:?}"); handles[0].send(StreamCmd::Stop); From 443559aa79e7002342b302634f2bf73d909a6a77 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 21:42:15 +0300 Subject: [PATCH 10/12] Take the keyframe baseline of the layer-format test after the streamer has settled stream::tests::layer_formats_reach_the_live_stream asserts that telling the sink the same layer format twice asks for no second keyframe: it drains the sink's keyframe requests, changes the format, waits for the request that follows, tells the same format again and expects none within 200 ms. It failed once ("nothing changed", stream.rs:1326) in the first of the three final runs of the CI test step in the runner image of this task, with the machine busy with another job. Requests reach the sink from the stream going live, from the streamer's own view of its viewer connecting (PeerEvent::Connected, a moment after the viewer sees WatchState::Connected, which is all the test waited for), from the viewer's picture requests, and from a changed layer. The test drained once, right after the viewer's side was connected, so a request of one of the first three that arrives later is taken for the one the changed format asked for, and the real one then arrives after the "same again" and is counted as a change. This could not be reproduced here (0 in 400 runs of the single test, 32 at a time with 48 busy loops, nor in 200 runs of the lib tests); the change closes those windows as far as they can be named: the test waits for the streamer's own Connected (StreamViewers) as well, and drains until a moment longer than the merge interval of requests (250 ms) passes with no request, before the format is changed. The assertions are those of before. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/stream.rs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/crates/voelin-core/src/stream.rs b/crates/voelin-core/src/stream.rs index 478db9a..f385e2c 100644 --- a/crates/voelin-core/src/stream.rs +++ b/crates/voelin-core/src/stream.rs @@ -1295,9 +1295,21 @@ mod tests { // Before the viewer asks: its offer is made after this. sink.layer_format(0, format(60_000_000)); handles[1].send(StreamCmd::Watch { stream_id: "s-1".into() }); - wait(&mut rx, |e| match e { - Event::WatchState { session: 2, state: WatchState::Connected, .. } => Some(()), - _ => None, + // Connected for the viewer and for the streamer, in either order: the + // streamer asks for a keyframe when its viewer connects, a moment after + // the viewer has seen the connection. + let (mut watching, mut served) = (false, false); + wait(&mut rx, |e| { + match e { + Event::WatchState { session: 2, state: WatchState::Connected, .. } => { + watching = true; + } + Event::StreamViewers { session: 1, viewers } => { + served |= viewers.iter().any(|v| v.state == ViewerState::Connected); + } + _ => {} + } + (watching && served).then_some(()) }) .await; // 3840x2160 at 60 fps is level 5.2 (0x34) in both profiles. @@ -1312,7 +1324,15 @@ mod tests { sink.take_layer_keyframes(&mut layers); layers.contains(0) }; - keyframes(); + // What asked for a keyframe so far (going live, the viewer's connecting + // and its first picture request) is done when a moment longer than the + // merging interval of requests (250 ms) passes with none. + for _ in 0..50 { + tokio::time::sleep(Duration::from_millis(300)).await; + if !keyframes() { + break; + } + } sink.layer_format(0, format(9_000_000)); timeout(Duration::from_secs(5), async { while !keyframes() { From 1de2725f1963d638f616678dce444f760bbfb5e1 Mon Sep 17 00:00:00 2001 From: faumaray Date: Sat, 24 Oct 2026 23:07:42 +0300 Subject: [PATCH 11/12] Remove a cancelled download's part file after its task has stopped The download test, which 61458df of this branch made wait for the part file, exposed a defect of the link: a download reports Started just before it opens its part file, and the open ran on tokio's blocking pool. Link::cancel() aborted the task and removed the part file at once; when the cancel came between Started and the end of the open, there was no file yet to remove, the abort cannot stop an open that is already on the blocking pool, and the open then made an empty `.part` next to the target after the transfer had been reported Cancelled. The user sees a leftover file, and a later download with `resume` continues from it. files::receive now makes the directory and opens the part file with std::fs in one step (the same kind of small blocking call as Sink::offset and the removal in cancel, which already ran on the loop), so an abort, which takes effect at an await, cannot come in the middle of it. Link::cancel() keeps the task's JoinHandle instead of its AbortHandle, aborts the task, and removes the part file and reports Cancelled from a task of its own after the aborted one has stopped: the file the task made is then there to be found, or the task never got to make one. Cancelled is therefore reported after the removal and after the task has stopped, where it was reported before both. The test goes back to the shape it had before 61458df: it cancels as soon as the transfer is Started (and now fails loudly if it never was). That shape failed in 10 of 100 runs of the voelin-core lib tests three at a time with 16 busy loops beside them on a 32-core machine, and in the final runs of the CI test step in the runner image of this task (the second of three); with this change it failed in none of 200 such runs. The link and files tests pass. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/files.rs | 25 +++++++++------- crates/voelin-core/src/link/session_link.rs | 32 ++++++++++++--------- crates/voelin-core/src/link/tests.rs | 15 +++++----- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/crates/voelin-core/src/files.rs b/crates/voelin-core/src/files.rs index d0e416d..8ea23fc 100644 --- a/crates/voelin-core/src/files.rs +++ b/crates/voelin-core/src/files.rs @@ -199,19 +199,22 @@ async fn receive( let mut done = offset; match sink { Sink::File { part, dest, append } => { + // The directory and the file are made in one step, without a pause in + // which the task could be stopped: a cancel stops the task, waits for + // it and then removes the part file, so what the task made must be + // there by then (a pending open on the blocking pool would not be). if let Some(dir) = part.parent().filter(|d| !d.as_os_str().is_empty()) { - tokio::fs::create_dir_all(dir) - .await - .map_err(|e| format!("{}: {e}", dir.display()))?; + std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?; } - let mut file = tokio::fs::OpenOptions::new() - .create(true) - .write(true) - .append(*append) - .truncate(!*append) - .open(part) - .await - .map_err(|e| format!("{}: {e}", part.display()))?; + let mut file = tokio::fs::File::from_std( + std::fs::OpenOptions::new() + .create(true) + .write(true) + .append(*append) + .truncate(!*append) + .open(part) + .map_err(|e| format!("{}: {e}", part.display()))?, + ); let received = async { while done < size { let n = stream.read(&mut buf).await.map_err(|e| e.to_string())?; diff --git a/crates/voelin-core/src/link/session_link.rs b/crates/voelin-core/src/link/session_link.rs index c1ecb59..33ada6b 100644 --- a/crates/voelin-core/src/link/session_link.rs +++ b/crates/voelin-core/src/link/session_link.rs @@ -77,7 +77,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::time::{Duration, Instant}; use tokio::sync::mpsc; -use tokio::task::AbortHandle; +use tokio::task::JoinHandle; use tracing::{debug, info, warn}; use voelin_audio::EncodedVoice; use voelin_model::replica::{Replica, SCHEMA_GENERATION, ScopeId}; @@ -325,7 +325,7 @@ async fn drive( /// A transfer a user can cancel. struct Running { - task: AbortHandle, + task: JoinHandle<()>, part: Option, report: Report, /// The server has opened it (a part file may exist). @@ -1479,7 +1479,7 @@ impl Conn { receive.await; } }); - self.running(transfer, Running { task: task.abort_handle(), part, report, started }); + self.running(transfer, Running { task, part, report, started }); } fn upload( @@ -1560,7 +1560,7 @@ impl Conn { let stored = async move { done.await.map(|_| ()).map_err(|e| text(&e, false)) }; files::upload_to(body, stored, from, size, offset, progress, task_report).await; }); - self.running(transfer, Running { task: task.abort_handle(), part: None, report, started }); + self.running(transfer, Running { task, part: None, report, started }); } fn running(&mut self, transfer: Option, running: Running) { @@ -1572,15 +1572,21 @@ impl Conn { fn cancel(&mut self, id: TransferId) { match self.transfers.remove(&id) { - Some(running) if !running.task.is_finished() => { - running.task.abort(); - // A part file exists once the server has opened the transfer. - if running.started.load(Ordering::Acquire) - && let Some(part) = running.part - { - let _ = std::fs::remove_file(part); - } - (running.report)(TransferState::Cancelled); + Some(Running { task, part, report, started }) if !task.is_finished() => { + task.abort(); + // The part file goes once the task has stopped, not at once: the task + // opens it in one step (files::download), so it is there or it never + // will be, and a removal that came before the open would leave it. + tokio::spawn(async move { + let _ = task.await; + // A part file exists once the server has opened the transfer. + if started.load(Ordering::Acquire) + && let Some(part) = part + { + let _ = std::fs::remove_file(part); + } + report(TransferState::Cancelled); + }); } _ => debug!(id, "cancel: no such transfer (finished?)"), } diff --git a/crates/voelin-core/src/link/tests.rs b/crates/voelin-core/src/link/tests.rs index 5d71f0a..6645675 100644 --- a/crates/voelin-core/src/link/tests.rs +++ b/crates/voelin-core/src/link/tests.rs @@ -598,20 +598,21 @@ async fn a_file_is_downloaded_through_the_connection_the_link_opens() { report, }); let LinkCmd::OpenRead { reply, .. } = rig.inner_cmd().await else { panic!("a connection") }; - // A file whose bytes do not come: the transfer waits in the middle, with - // its part file made. `Started` is reported just before the part file is - // opened, and a cancel in between would find nothing to remove while the - // open still goes on, so the part file is what is waited for. + // A file whose bytes do not come: the transfer waits in the middle. let (server, client) = tokio::io::duplex(64); let _ = reply.send(Ok((1 << 20, Box::pin(client)))); for _ in 0..500 { - if part.exists() { + if states.lock().unwrap().iter().any(|s| matches!(s, TransferState::Started { .. })) { break; } tokio::time::sleep(Duration::from_millis(10)).await; } - assert!(part.exists(), "the transfer made its part file: {:?}", states.lock().unwrap()); - assert!(states.lock().unwrap().iter().any(|s| matches!(s, TransferState::Started { .. }))); + assert!( + states.lock().unwrap().iter().any(|s| matches!(s, TransferState::Started { .. })), + "the transfer started: {:?}", + states.lock().unwrap() + ); + // Cancelled the moment it is Started, when its part file may be opening. rig.give(LinkCmd::CancelTransfer(3)); assert_eq!(final_state(&states).await, TransferState::Cancelled); rig.quiet(); From e807df40e594b0dc779cd80930790177e479440e Mon Sep 17 00:00:00 2001 From: faumaray Date: Sun, 25 Oct 2026 02:04:08 +0300 Subject: [PATCH 12/12] docs: ci.md quotes the right git error, removes root's files, names the bare clone, follows main's loopback and D-Bus tests; .scratch/ ignored Co-Authored-By: Claude Fable 5.1 --- .gitignore | 2 ++ docs/ci.md | 33 ++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 004fc92..f3070a4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /dev/.state/ /dist/ /.cargo/ +# agent scratch of a worktree (the MAO policy in CLAUDE.md) +/.scratch/ diff --git a/docs/ci.md b/docs/ci.md index b41b5c0..538eb27 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -116,9 +116,11 @@ check a change to the tests the way CI runs them, with every failing test of every crate listed in one go (`--no-fail-fast`): ```sh -# A bare clone of the private VoelinProtocol repository (see below the block). +# A bare clone of the private VoelinProtocol repository (see below the block): +# git clone --bare ssh://gitea@git.faumaray.com/Voelin/VoelinProtocol.git : "${PROTOCOL_GIT:?path of a bare clone of VoelinProtocol}" -# Root owns what the container writes: keep it in a directory of its own. +# Root owns what the container writes: keep it in a directory of its own +# (.scratch/ is in .gitignore; see below the block for its removal). mkdir -p .scratch docker run --rm --init -v "$PWD":/src -w /src -e HOME=/root \ -v "$PROTOCOL_GIT":/protocol.git:ro -e CARGO_NET_GIT_FETCH_WITH_CLI=true \ @@ -149,10 +151,15 @@ instead: `PROTOCOL_GIT` is mounted at `/protocol.git` and git is told to use it in place of the SSH URL (with `CARGO_NET_GIT_FETCH_WITH_CLI=true`, as in CI, so that cargo runs the `git` command), which leaves `Cargo.lock` as it is. The `git config` is run with `-C /` because a git worktree's `.git` file points -outside the mount, and `git config` in `/src` then fails with `fatal: gitfile -does not point to a valid repository`. To use the deploy key instead, set it up -as described below and leave out the `PROTOCOL_GIT` lines and the `git config` -command. +outside the mount, and `git config` in `/src` then fails with `fatal: not a git +repository: (null)` (exit 128). To use the deploy key instead, set it up as +described below and leave out the `PROTOCOL_GIT` lines and the `git config` +command. What the container wrote under `.scratch/` belongs to root; remove it +from a container as well: + +```sh +docker run --rm -v "$PWD/.scratch":/s alpine:3.20 rm -rf /s/target /s/cargo /s/rustup +``` What the image lacks, and what the tests do about it. A test that is about the missing piece returns without testing it, in most cases after printing a @@ -164,7 +171,7 @@ not need the piece. |---|---| | Regular user (root writes anywhere and creates missing directories) | Nothing relies on a permission bit or a missing directory failing. A path that cannot be written is built from something that fails for root too: below a regular file (`ENOTDIR`) or naming a directory (`EISDIR`), as `an_unwritable_path_fails_at_once` of the recorder does. | | Sound card (`/dev/snd`), PipeWire and WirePlumber daemons | `libpipewire` and ALSA are there to build against only. `tests/pipewire_apps.rs` needs `pipewire`, `wireplumber` and `dbus-daemon` and, without them, prints a skipped line that names them. The camera tests are `#[ignore]`d (a camera and PipeWire). | -| D-Bus session bus | `voelin-platform`'s portal proxy test returns with `no session bus: run under dbus-run-session`; the notification and capture-portal tests run only where no bus is configured, and check that talking to a missing service fails cleanly. | +| D-Bus session bus | `voelin-platform`'s portal proxy test runs itself again under `dbus-run-session` on a bus of its own and, where that cannot be run, prints `skipped, nothing was checked: dbus-run-session cannot be run`; the notification and capture-portal tests run only where no bus is configured, and check that talking to a missing service fails cleanly. | | GPU, `/dev/dri`, VA-API, `/dev/udmabuf` | The VA-API and DMA-BUF tests print a skipped line that names what is missing: a usable `h264_vaapi`, `/dev/udmabuf` or VA-API surfaces to export. | | FFmpeg libraries, `ffmpeg` and `ffprobe` | The FFmpeg tests of `voelin-media` and `voelin-core` print a skipped line that names what is missing (the libraries, `ffmpeg`, `ffprobe`). The studio tests that read a recording back with `ffprobe` write and check the file themselves and skip only the `ffprobe` check; the RTMP tests need all three and skip. | | H.264 encoder (no FFmpeg, no GPU, no OpenH264 library: `VOELIN_OPENH264_LIB` is unset and the download test is `#[ignore]`d) | Tests that need an H.264 encoder print a skipped line that says no H.264 encoder is there. Tests of codec choice state what `preferred_codec` promises with whatever the machine can encode. VP8 and VP9 (libvpx) are built in, so their round trips run. | @@ -173,14 +180,10 @@ not need the piece. | TeamSpeak dev servers | Without `VOELIN_LIVE=1` the live tests return at once (some print `skipped: set VOELIN_LIVE=1 with the dev servers running`); the gateway's live test is `#[ignore]`d (`needs a running tsgw and TeamSpeak server`). | | DNS and internet while the tests run (the job needs the network for apt, rustup and crates before they start) | The tests use no DNS or internet; those that would are `#[ignore]`d with the reason: four resolver tests of `tsclientlib` (`needs DNS and the internet`) and the OpenH264 download test. | -`localhost` resolves to `::1` first in this image (it also has `127.0.0.1`), -and the tests that reach a server bound to `127.0.0.1` through `localhost` -pass because the connection to `::1` is refused at once. On a machine where -connections to `::1` hang instead (a development machine with a VPN does -that), two `voelin-core` tests fail whatever the change under test is: -`discover::tests::without_records_the_gateway_itself_is_asked` and -`web::tests::pictures_go_through_the_proxy_named_for_each_hop`. That is a -property of that machine, not of the image. +`localhost` resolves to `::1` first in this image (it also has `127.0.0.1`). +The tests that reach a server of their own go to `127.0.0.1` by name, not +through `localhost`, so a machine where connections to `::1` hang (a +development machine with a VPN does that) changes nothing for them. ### VoelinProtocol access