English
Checks
What verifies the correctness of ours, where it lives and how to run it. Details are in testing/; where to start on your machine — Running the tests from scratch.
| Level | Where | In detail |
|---|---|---|
Shared runner: log in /tmp, short summary | tests/run.py | runner |
| Rust unit and integration tests | src/, tests/ of every crate | workspace |
| Clippy, layers, feature sets, MIPS build (by hand) | tests/layers.py, tests/features.py | workspace |
| End-to-end scenarios in Docker against the reference | tests/e2e/ | e2e |
| On-the-wire compatibility with sing-box | tests/interop/ | interop |
| Admin API and dashboard (Python and browser) | tests/dashboard/ | dashboard |
| Measurements and the kernel compatibility matrix | janeblower/benchlab | benchmarks |
| Dependencies: vulnerabilities (RustSec), licenses, duplicates, sources | deny.toml, cargo deny check | below |
| Fuzzing | a fuzz/ crate next to the code it tests | Libraries, dns, mux |
| CI | .github/workflows/ci.yml | below |
Environment
- The toolchain is pinned in
rust-toolchain.toml(1.100.0, Clippy, rustfmt, thex86_64-unknown-linux-musltarget for E2E). The MIPS check is run by hand and requires nightly. CARGO_TARGET_DIRis optional: without it the build goes totarget/in the repository root. If several working trees share one build directory, export it before any build: it determines which binary E2E mounts into the container and which binary the dashboard tests find (OURS_BINARYdefaults to$CARGO_TARGET_DIR/debug/ours, without the variable —target/debug/ours).- Socket, netns and kTLS tests require privileges and kernel modules:
sudo modprobe -a nft_tproxy nf_tproxy_ipv4 nf_tproxy_ipv6 nft_fib_inet tls(the first fourtests/e2e/run.shloads itself;tlsis needed by thecargo testkTLS tests, which are built only with--features unstable-ktls).
Reference
The functional reference is sing-box 1.14.4 (the ghcr.io/sagernet/sing-box:v1.14.4 image by digest in tests/e2e/Dockerfile); VLESS extensions are checked against Xray. Behaviour that diverges from the reference on purpose is described in differences and checked separately.
Order
- While working — the tests of the affected crate (
cargo test -p <crate> --test <target>) and the E2E scenarios relevant to the task. - Once behaviour has settled — one final set: workspace tests, Clippy with
-D warnings,tests/layers.py,tests/features.py, the MIPS check; the E2E scenarios onoursand on the reference. - A change to documentation only needs no build: run
npm ci && npm run buildindocs/, which fails on a dead link, and read the diff.
The full tool output goes to a log file, the terminal gets the result and the log path: that is what the runner is for.
Dependencies
deny.toml in the root is the policy for cargo-deny: known vulnerabilities, unmaintained and yanked versions from the RustSec database are errors; licenses — only from the allowed list (GPL-3.0-or-later is ours, the rest are compatible permissive ones); duplicate versions are a warning; sources — crates.io and the quinn fork. Exceptions are recorded in deny.toml with the reason next to them.
sh
cargo install cargo-deny --locked
cargo deny checkThe vulnerability database changes without commits to the repository, so this check is worth running on a schedule, not only on changes. A new dependency under a license not on the list is a reason to decide whether it is compatible with the GPL and to add it to allow; the license texts for a release are collected by dist/third-party-licenses.py.
CI
.github/workflows/ci.yml runs on pushes to master, on v* release tags, on pull requests and manually (workflow_dispatch). It checks formatting, builds the workspace, runs cargo test --workspace, Clippy, tests/layers.py, tests/tracked.py, the Python tests in tests/ and the dashboard tests, builds a static musl binary, checks the build with the oldest supported Rust version (rust-version) and the aarch64 cross build, runs the tests on big-endian 32-bit PowerPC under qemu, checks dependencies against deny.toml, fuzzes and runs E2E on ours and sing-box.
A pull request or a push to master does not fuzz: a short run finds next to nothing that a campaign of hours did not. It runs each target of the fuzz crates whose code or workspace dependencies the change touches (tests/fuzz_affected.py) once over its saved inputs, the past failures (fuzz/regressions/) and the campaigns' minimized corpora (fuzz/seeds/), which also keeps the targets building. A change to Cargo.lock, the root Cargo.toml, the toolchain or CI, and a manual run, take every fuzz crate. A release tag replays every target and then fuzzes each for 60 seconds, starting from the corpus the previous release left (the fuzz-corpus artifact of a release tag run, kept 90 days; its regular files only) and leaving its own. Finding bugs is the campaigns' job. The nightly is pinned in ci.yml (FUZZ_TOOLCHAIN) so that the cache of sanitized third-party dependencies, saved by master runs that built every fuzz crate, stays valid.