Skip to content

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.

LevelWhereIn detail
Shared runner: log in /tmp, short summarytests/run.pyrunner
Rust unit and integration testssrc/, tests/ of every crateworkspace
Clippy, layers, feature sets, MIPS build (by hand)tests/layers.py, tests/features.pyworkspace
End-to-end scenarios in Docker against the referencetests/e2e/e2e
On-the-wire compatibility with sing-boxtests/interop/interop
Admin API and dashboard (Python and browser)tests/dashboard/dashboard
Measurements and the kernel compatibility matrixjaneblower/benchlabbenchmarks
Dependencies: vulnerabilities (RustSec), licenses, duplicates, sourcesdeny.toml, cargo deny checkbelow
Fuzzinga fuzz/ crate next to the code it testsLibraries, dns, mux
CI.github/workflows/ci.ymlbelow

Environment ​

  • The toolchain is pinned in rust-toolchain.toml (1.100.0, Clippy, rustfmt, the x86_64-unknown-linux-musl target for E2E). The MIPS check is run by hand and requires nightly.
  • CARGO_TARGET_DIR is optional: without it the build goes to target/ 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_BINARY defaults 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 four tests/e2e/run.sh loads itself; tls is needed by the cargo test kTLS 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 ​

  1. While working — the tests of the affected crate (cargo test -p <crate> --test <target>) and the E2E scenarios relevant to the task.
  2. 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 on ours and on the reference.
  3. A change to documentation only needs no build: run npm ci && npm run build in docs/, 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 check

The 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.

GPL-3.0-or-later