#!/usr/bin/env just --justfile # # Language-specific recipes for the Rust workspace under rs/. Invoked from # the repo root as `just rs ` via the `mod rs` import. # # The Rust crates form a single workspace whose root Cargo.toml lives at # the repository root, so these recipes run from the repo root rather than # from rs/ (cargo resolves paths relative to the workspace root either way). set working-directory := '..' # The `*-fuzz` crates are workspace members only so they share the root lockfile; libFuzzer # needs a nightly toolchain and sanitizer flags, so `just rs fuzz` is the one recipe # that may compile it. Every `--workspace` below therefore carries this, as does # sh/rs/select.sh, since it cannot read this. no_fuzz := "--exclude moq-net-fuzz --exclude moq-quic-fuzz --exclude moq-mux-fuzz --exclude moq-rtmp-fuzz" default: just check # Model-check a TLA+ spec with TLC, e.g. `just rs tla moq-net/verify/route/RouteHandoff.tla`. # Pass `-config rs/.cfg` for a config not named after the spec, and # `../.tla` for a spec outside `rs/`, such as a generated one in `.tmp/`. # sh/tlc.py says how a run shares the host. tla spec *args: python3 sh/tlc.py rs/{{ spec }} {{ args }} # Prove a Tamarin model's lemmas, e.g. `just rs tamarin moq-net/verify/route-key/RouteKey.spthy`. # Pass `-D=` for a variant the model defines. tamarin spec *args: nix shell --inputs-from . nixpkgs#tamarin-prover --command tamarin-prover --prove {{ args }} rs/{{ spec }} # Default features for the selected packages; `features` covers the feature # matrix nightly and on release PRs. No `cargo check` pass: clippy is a # superset of it, and the two use different rustc wrappers, so running both # compiles the workspace twice. # # A bare `just rs check` is default-members, which skips moq-c, moq-ffi, # and moq-gst; pass `--workspace` for all of it. # Compile, lint, format-check, doc-check, and verify dependency hygiene. [positional-arguments] check *args: bash sh/local.sh cargo clippy --locked --all-targets "$@" -- -D warnings just rs lint "$@" # `check` with clippy enforced by the `test` build. A selection can hold # nothing testable. # Compile, lint, and test in one build, plus everything else `check` verifies. [positional-arguments] check-test *args: just rs test --no-tests=pass "$@" just rs lint "$@" # Everything `check` verifies besides clippy. [positional-arguments] lint *args: python3 sh/rs/stats-docs.py # The environment is process-wide, so nothing writes it. A text check, because the # clock lint's test allowances also silence clippy's disallowed_methods. git grep --untracked -nE '(^|[^[:alnum:]_])(set_var|remove_var)[[:space:]]*\(' -- 'rs/*.rs'; [ $? -eq 1 ] || { echo "error: a write to the process environment: pass the value down, or run a test in a child with test_env::Env" >&2; exit 1; } cargo fmt --all --check RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked --no-deps "$@" cargo shear --deny-warnings # The workspace-hack's table order is `cargo hakari`'s, which `cargo sort` disagrees with. cargo sort --check --no-format . $(cargo metadata --locked --no-deps --format-version 1 | jq -r '.packages[] | select(.name != "workspace-hack") | .manifest_path | rtrimstr("/Cargo.toml")') cargo hakari generate --diff python3 sh/rs/hakari.py python3 sh/rs/crypto.py # Auto-fix clippy/format/shear/sort. [positional-arguments] fix *args: bash sh/local.sh cargo clippy --locked --fix --allow-staged --allow-dirty --all-targets "$@" cargo fmt --all cargo shear --fix cargo hakari generate cargo sort --no-format . $(cargo metadata --locked --no-deps --format-version 1 | jq -r '.packages[] | select(.name != "workspace-hack") | .manifest_path | rtrimstr("/Cargo.toml")') # Regenerate nix/Cargo.nix, the per-crate Nix build, after a manifest or lock change. [positional-arguments] cargo-nix *args: sh/rs/cargo-nix.sh "$@" # Like `check`, but only the crates in a changed-file list plus their dependents. check-changed $LIST: sh/rs/select.sh check "$LIST" # Like `lint`, but only the crates in a changed-file list plus their dependents. lint-changed $LIST: sh/rs/select.sh lint "$LIST" # Like `check-test`, but only the crates in a changed-file list plus their dependents. check-test-changed $LIST: sh/rs/select.sh check-test "$LIST" # Like `fix`, but only the crates in a changed-file list plus their dependents. fix-changed $LIST: sh/rs/select.sh fix "$LIST" # Like `test`, but only the crates in a changed-file list plus their dependents. test-changed $LIST: sh/rs/select.sh test "$LIST" # Compile moq-tokio at its feature extremes; --all also isolates crypto and transport modes. [positional-arguments] tokio-features *args: sh/rs/tokio-features.sh "$@" # Runs the `#[cfg(windows)]` code past the compiler, which the Linux gate # skips; platform.yml runs it on a Windows runner, scoped like `check-changed` # so a release PR compiles only the affected crates. Default # features, since jemalloc doesn't build on MSVC. # Compile what the branch changed since BASE on a Windows host, or everything with `--all`. windows $BASE="": sh/rs/platform.sh "$BASE" # Test the platform-sensitive crates on Windows, independent of the diff. windows-test: #!/usr/bin/env bash set -euo pipefail source sh/checks.sh run just rs test --manifest-path rs/moq-auth/Cargo.toml run just rs test -p kio -p hang -p moq-tokio -p moq-sock -p moq-relay run just rs test -p moq-video --no-default-features --features render -E 'test(/^render::export::/)' finish # Run io_uring tests when the branch affects the relay or its dependencies. [positional-arguments] uring-changed base="": #!/usr/bin/env bash set -euo pipefail changed=$(mktemp) trap 'rm -f "$changed"' EXIT bash sh/changed.sh "$1" > "$changed" bash sh/rs/select.sh uring "$changed" # Compile and test the io_uring relay path, which is off the default feature set. # Linux-only; CI_STRICT requires a supported kernel instead of skipping tests. [positional-arguments] uring *args: just rs uring-check "$@" bash sh/rs/nextest.sh cargo nextest run --locked -p moq-uring -p moq-relay --features moq-relay/io-uring --tests "$@" # Signal ownership and scoped tracing must also survive sharing one process. cargo test --locked -p moq-relay --test integration # Needs a second IPv6 address on lo, which the io_uring CI lanes add. bash sh/rs/nextest.sh cargo nextest run --locked -p moq-uring --test integration --run-ignored only -E 'test(=local_addr::a_v6_wildcard_answers_from_the_address_reached)' "$@" bash sh/local.sh cargo clippy --locked -p moq-uring -p moq-relay --features moq-relay/io-uring,moq-relay/qlog --all-targets "$@" -- -D warnings bash sh/rs/nextest.sh cargo nextest run --locked -p moq-uring --features qlog --tests "$@" # Compile the io_uring relay path, off the default feature set. [positional-arguments] uring-check *args: bash sh/local.sh cargo clippy --locked -p moq-uring -p moq-relay --features moq-relay/io-uring --all-targets "$@" -- -D warnings # Without the default `quic`, so moq-tokio's `driver` is off: the relay's io_uring path must not lean on it. bash sh/local.sh cargo clippy --locked -p moq-relay --no-default-features --features io-uring --all-targets "$@" -- -D warnings # The Apple-gated code in moq-video, moq-audio, and moq-sock, which # platform.yml compiles on a Mac runner alongside `windows`. # Compile what the branch changed since BASE on a macOS host, or everything with `--all`. macos $BASE="": sh/rs/platform.sh "$BASE" # Test the platform-sensitive crates on macOS, independent of the diff. macos-test: #!/usr/bin/env bash set -euo pipefail source sh/checks.sh run just rs test --manifest-path rs/moq-auth/Cargo.toml run just rs test -p kio -p hang -p moq-tokio -p moq-sock run just rs test -p moq-video --no-default-features -E 'test(encode::backend::videotoolbox::tests)' # Runner has no camera; these tests need none. run just rs test -p moq-video --no-default-features --features capture -E 'test(/^capture::avfoundation::tests::/)' run just rs test -p moq-video --no-default-features --features render -E 'test(/^render::export::/)' # The runner's paravirtual Metal device proves the IOSurface import, ignored elsewhere. run just rs test -p moq-video --no-default-features --features render --lib --run-ignored only \ -E 'test(/^render::renderer::tests::(the_metal_import_matches_the_cpu_path|imports_survive_decoder_pool_recycling)$/)' finish # Compile and lint the capture and playback features, which the default check skips. [positional-arguments] capture *args: bash sh/local.sh cargo clippy --locked -p moq-video -p moq-audio --all-targets --features moq-video/capture,moq-audio/capture,moq-audio/playback "$@" -- -D warnings # moq-net without its `async` feature: the lib, its tests, and its docs. no-async: bash sh/local.sh cargo clippy --locked -p moq-net --no-default-features --lib --tests -- -D warnings RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-net --no-default-features --no-deps # Lint media tests without the device features the gate's test build enables. media-defaults: bash sh/local.sh cargo clippy --locked -p moq-audio -p moq-video --tests -- -D warnings # The capture and playback tests drive synthetic devices, so they need no hardware. # Test the capture and playback features, which the default test pass skips. [positional-arguments] capture-test *args: just rs test -p moq-video -p moq-audio --features moq-video/capture,moq-audio/capture,moq-audio/playback "$@" # Stream V4L2 capture from the kernel's vivid virtual camera (`sudo modprobe vivid` # first); without one the tests skip, or fail under CI_STRICT. v4l2: just rs test -p moq-video --no-default-features --features capture --lib --run-ignored only -E 'test(/^capture::v4l2::tests::vivid::/)' # Compare SHM and GetImage through production capture on the current X11 display. x11-bench: just rs test --release -p moq-video --no-default-features --features capture -E 'test(x11_capture_workload)' --run-ignored only --no-capture # Compare RGB conversion allocation separately, without an X server. x11-rgb-bench: just rs test --release -p moq-video --no-default-features --features capture -E 'test(x11_rgb_workload)' --run-ignored only --no-capture # Use an isolated virtual X server and retain paired measurements for comparison. x11-bench-ci: #!/usr/bin/env bash set -euo pipefail log="${MOQ_X11_BENCH_LOG:-.tmp/x11-capture-benchmark.log}" mkdir -p "$(dirname "$log")" { git rev-parse HEAD rustc --version xvfb-run -a -s "-screen 0 1920x1080x24 -nolisten tcp" just rs x11-bench just rs x11-rgb-bench } 2>&1 | tee "$log" # moq-video's MediaCodec code is `#[cfg(target_os = "android")]`. Needs an NDK, # which the dev shell lacks, so android.yml runs it outside Nix with the # workspace-hack disabled (`cargo hakari disable && cargo update --workspace`). # Do the same locally, then restore Cargo.lock and rs/workspace-hack. `check` rather # than a denying clippy: the capture plumbing is dead on a target without a # capture backend. # Compile the Android backends, which the host-target check skips, and assert the # moq-ffi library links logcat: `Log::init` is silent on Android without it. [positional-arguments] android *args: bash sh/local.sh cargo ndk -t arm64-v8a --platform 26 check --locked -p moq-video --all-targets "$@" bash sh/local.sh cargo ndk -t arm64-v8a --platform 26 -o target/android-jni build-ffi "$@" nm -D --undefined-only target/android-jni/arm64-v8a/libmoq_ffi.so | grep -q __android_log_ # Run moq-video's ignored MediaCodec tests on the Android device or emulator adb # reaches. Needs an NDK and the workspace-hack disabled, like `android`; # android.yml's `emulator` job runs it on an x86_64 emulator. [positional-arguments] android-test *args: sh/rs/android-test.sh "$@" # Audit dependencies against deny.toml. Nightly: advisories land without a diff. audit: bash sh/local.sh cargo deny check --show-stats # Outside nextest because the staticlib link alone outlasts its hang budget. # Compile and run moq-c's C fixtures, and the C doc samples, against libmoq.a. Must run on Unix. c-tests: sh/rs/c-tests.sh # The workspace-hack would supply third-party features a crate forgets to # declare, so CI runs this after `cargo hakari disable && cargo update # --workspace`; do the same locally, then `git checkout Cargo.lock rs/workspace-hack`. # Compile the full feature matrix, including isolated combinations and their tests. features: #!/usr/bin/env bash set -euo pipefail source sh/checks.sh run just rs net-features --all run just rs coroutines run just rs quic-features --all run just rs crypto-key run just rs tokio-features --all run just rs media-features --all run bash sh/local.sh cargo check --locked --workspace {{ no_fuzz }} --all-targets --no-default-features run bash sh/local.sh cargo check --locked -p moq-relay --no-default-features run just rs test -p moq-relay --no-default-features run bash sh/local.sh cargo check --locked -p moq-cli --no-default-features run just rs test -p moq-cli --no-default-features --features capture,websocket -E 'test(capture_window)' run just rs test -p moq-cli --no-default-features --features capture,pipewire,websocket -E 'test(capture_window)' run bash sh/local.sh cargo check --locked -p moq-bench --no-default-features run bash sh/local.sh cargo check --locked -p moq-boy --no-default-features # Alone, since the workspace's `kio/sim` dev-dependencies would unify `kio/async` back in. run bash sh/local.sh cargo check --locked --manifest-path rs/moq-auth/Cargo.toml --lib --all-features run bash sh/local.sh cargo check --locked -p moq-hls -p moq-rtmp -p moq-webrtc --no-default-features --all-targets run bash sh/local.sh cargo clippy --locked --workspace {{ no_fuzz }} --all-targets --all-features -- -D warnings run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked --workspace {{ no_fuzz }} --all-features --no-deps run bash sh/rs/nextest.sh cargo nextest run --locked --workspace {{ no_fuzz }} --all-targets --all-features finish # Compile and test the explicit-time model without async helpers or sessions. [positional-arguments] net-features *args: bash sh/rs/net-features.sh "$@" # Prove the poll-only library builds compile no coroutines and document cleanly. coroutines: #!/usr/bin/env bash set -euo pipefail source sh/checks.sh run bash sh/rs/coroutines.sh kio -- --no-default-features --features macros,runtime,manual,serde run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p kio --no-deps --no-default-features --features macros,runtime,manual,serde run bash sh/rs/coroutines.sh moq-net -- --no-default-features run bash sh/rs/coroutines.sh moq-json -- --no-default-features run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-json --no-deps --no-default-features run bash sh/rs/coroutines.sh hang -- --no-default-features run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p hang --no-deps --no-default-features run bash sh/rs/coroutines.sh moq-mux -- --no-default-features run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-mux --no-deps --no-default-features run bash sh/rs/coroutines.sh moq-hls -- --no-default-features run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-hls --no-deps --no-default-features run bash sh/rs/coroutines.sh moq-stats -- --no-default-features run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-stats --no-deps --no-default-features run bash sh/rs/coroutines.sh moq-crypto -- --no-default-features --features sign,e2ee,provider,serde run env RUSTDOCFLAGS="-D warnings" bash sh/local.sh cargo doc --locked -p moq-crypto --no-deps --no-default-features --features sign,e2ee,provider,serde run bash sh/rs/coroutines.sh rs/moq-auth/Cargo.toml -- --no-default-features finish # Prove moq-crypto's key-only build, which moq-auth depends on, leaves out the transport, then lint and test it alone; a workspace build unifies the default features back in. crypto-key: #!/usr/bin/env bash set -euo pipefail source sh/checks.sh key_only_dependencies() { graph=$(cargo tree --locked -p moq-crypto --no-default-features --features serde -e normal --prefix none) || return if grep -E '^moq-net ' <<<"$graph"; then echo "moq-crypto without sign or e2ee must not depend on moq-net" >&2 return 1 fi } run key_only_dependencies run bash sh/local.sh cargo clippy --locked -p moq-crypto --no-default-features --all-targets -- -D warnings run bash sh/local.sh cargo clippy --locked -p moq-crypto --no-default-features --features serde --all-targets -- -D warnings run bash sh/rs/nextest.sh cargo nextest run --locked -p moq-crypto --no-default-features --features serde finish # Prove moq-quic leaves kio's dev-only clock runtime to its consumers, and lints without its default features; a workspace build unifies both back in. [positional-arguments] quic-features *args: #!/usr/bin/env bash set -euo pipefail targets=(--tests) if [[ $# == 1 && $1 == --all ]]; then targets=(--all-targets) elif [[ $# != 0 ]]; then echo 'usage: just rs quic-features [--all]' >&2 exit 2 fi source sh/checks.sh dependencies() { graph=$(cargo tree --locked -p moq-quic -e normal --prefix none) || return if grep -E '^tokio ' <<<"$graph"; then echo "moq-quic must not depend on a native runtime" >&2 return 1 fi } run dependencies run bash sh/local.sh cargo clippy --locked -p moq-quic "${targets[@]}" --no-default-features -- -D warnings finish # Compile media boundaries (--all isolates every mode) and prove expensive # native/render dependencies are absent when their features are excluded. [positional-arguments] media-features *args: sh/rs/media-features.sh "$@" # nextest kills a wedged test (`.config/nextest.toml` sets the timeout), but # skips doctests; `just rs doctest` covers those. clippy-driver as the workspace # wrapper enforces lint findings from the same compile. `--tests` builds library, # binary, and integration-test targets, including binary-only crates. The gate # (sh/rs/select.sh's `test`) adds `--benches --examples` and the features those # targets require, so their lints fail the PR rather than Nightly; nextest's # default filter leaves the benches unrun. `build.warnings` denies warnings # without changing cargo's artifact fingerprint, unlike RUSTFLAGS. # A test whose timer waits on the host clock aborts (see `kio::clock::host_time`). # The ignored tests are benchmarks and hardware tests, which run on real time by design. # Run library, binary, and integration tests, enforcing clippy from the same compile. [positional-arguments] test *args: {{ if args =~ '--run-ignored' { '' } else { 'KIO_DENY_HOST_TIMERS=1' } }} CARGO_BUILD_WARNINGS=deny RUSTC_WORKSPACE_WRAPPER={{ quote(require("clippy-driver")) }} bash sh/rs/nextest.sh cargo nextest run --locked --tests "$@" # Exercise the ignored hardware tests for every GPU vendor on this Linux host. gpu: sh/rs/gpu.sh # The media tasks run against a recorder rather than a device (see # `rs/moq-cli/src/play/fake.rs`), so this needs no speaker or display. Only the # binary's own tests: the integration tests spawn verbs `play` leaves alone, # and the default pass already runs them. # Test moq-cli's `play` feature, which default features leave out. [positional-arguments] play *args: CARGO_BUILD_WARNINGS=deny RUSTC_WORKSPACE_WRAPPER={{ quote(require("clippy-driver")) }} bash sh/rs/nextest.sh cargo nextest run --locked -p moq-cli --features play,openh264 --bins "$@" # Compile and run the `/// ```` examples, which nextest skips. [positional-arguments] doctest *args: bash sh/local.sh cargo test --locked --doc "$@" # Needs nightly with miri and rust-src; executes only in Nightly. See sh/rs/miri.sh # for what runs and why it splits in two. # Run kio's and moq-net's hand-written in-memory unsafe under Miri. [positional-arguments] miri *args: bash sh/rs/miri.sh "$@" # Run the moq-quic simulation's random workloads from a fresh seed, printing the settings that replay it, then the bandwidth probe's acceptance suite, the receive-timestamps comparison, and the realtime controllers' comparison. quic-sim: #!/usr/bin/env bash set -euo pipefail export MOQ_QUIC_SEED=${MOQ_QUIC_SEED:-$((RANDOM << 15 | RANDOM))} export MOQ_QUIC_CASES=${MOQ_QUIC_CASES:-4096} echo "MOQ_QUIC_SEED=$MOQ_QUIC_SEED MOQ_QUIC_CASES=$MOQ_QUIC_CASES" # Release keeps the sweep inside nextest's hang budget; the checks stay on so it still catches what a debug run would. export CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS=true CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS=true bash sh/rs/nextest.sh cargo nextest run --locked --release -p moq-quic --lib -E 'test(/^tests::sim::/)' # The bandwidth probe's acceptance suite, over fixed seeds: the merge gate runs only its short cases. bash sh/rs/nextest.sh cargo nextest run --locked --release -p moq-quic --lib --run-ignored only -E 'test(/^tests::probe::/)' # SCReAMv2's queue, throughput and reaction on the cellular presets: on the sim beside BBR3, then over real sockets through moq-shaper, one preset at a time. bash sh/rs/nextest.sh cargo nextest run --locked --release -p moq-quic --lib --run-ignored only --no-capture -E 'test(/^tests::scream::/)' bash sh/rs/nextest.sh cargo nextest run --locked --release -p moq-tokio --test integration --run-ignored only --no-capture --test-threads 1 -E 'test(/^scream::/)' # Forward delay against RTT as a queue-growth signal: deterministic in the simulation, then over real sockets through each cellular moq-shaper preset, one at a time so they do not add to each other's noise. bash sh/rs/nextest.sh cargo nextest run --locked --release -p moq-quic --lib --run-ignored only --no-capture -E 'test(/^tests::receive_ts::/)' bash sh/rs/nextest.sh cargo nextest run --locked --release -p moq-tokio --test integration --run-ignored only --no-capture --test-threads 1 -E 'test(/^receive_ts::/)' # Each realtime congestion controller against BBR3 over sim replicas of the cellular presets: queueing delay, throughput, reaction to the drop, and share beside CUBIC. bash sh/rs/nextest.sh cargo nextest run --locked --release -p moq-quic --lib --run-ignored only --no-capture -E 'test(/^tests::realtime::/)' # Prove the FFI simulcast publisher disables and resumes over a shaped BBR3 uplink. rung-disable: just rs test -p moq-ffi --lib --run-ignored only --no-capture -E 'test(/^test::rung::/)' # Prove downstream futures are Send at the default recursion limit on the # flake's pinned nightly. Nightly runs it; the land gate does not. send-depth: bash sh/rs/send-depth.sh # Run moq-cli's `moq export` process tests, which feed a real relay and wait out follows in real time. [positional-arguments] cli-export *args: just rs test -p moq-cli --test integration --run-ignored only -E 'test(/^export::/)' "$@" # Probe every segment moq-hls serves with ffprobe against its HLS playlists and DASH manifest. [positional-arguments] hls-conformance *args: just rs test -p moq-hls --test integration --run-ignored only -E 'test(/^conformance::/)' "$@" # Exercise small connection and stream receive windows over real QUIC sockets. quic-stress: just rs test -p moq-tokio --lib --run-ignored only -E 'test(/^quic::driver::tests::stress_/)' # Render CPU frames and export them for encoding through wgpu on Mesa's software # Vulkan driver, so no GPU is needed. render-sw: #!/usr/bin/env bash set -euo pipefail mesa=$(nix build --inputs-from . --no-link --print-out-paths nixpkgs#mesa) loader=$(nix build --inputs-from . --no-link --print-out-paths nixpkgs#vulkan-loader) icd=("$mesa"/share/vulkan/icd.d/lvp_icd.*.json) LD_LIBRARY_PATH="$loader/lib" VK_DRIVER_FILES="${icd[0]}" \ just rs test -p moq-video --features render --lib --run-ignored only \ -E 'test(/^render::renderer::tests::(the_declared_color_space_beats_the_size_guess|cpu_frames_survive_the_round_trip|config_size_overrides_the_frame_size|an_unimportable_gpu_frame_is_refused|the_output_follows_the_device)$/)' # Mesa's software driver exports no memory, so this covers the readback route. LD_LIBRARY_PATH="$loader/lib" VK_DRIVER_FILES="${icd[0]}" \ just rs test -p moq-video --features render,openh264 --lib --run-ignored only -E 'test(/^render::(readback::|export::(nv12::)?)tests::/)' # Run the ignored mDNS tests, which multicast on the host's network interfaces. multicast: just rs test -p moq-tokio --features mdns --lib --run-ignored only -E 'test(=mdns::tests::same_app_peers_find_each_other) | test(/^mdns::tests::daemon_/)' just rs test -p moq-relay --features cluster-lan --run-ignored only -E 'test(/^lan_mesh::/)' # Run the long TS recovery arms; a failing arm keeps its export and ledgers under $HARNESS_RUNS. ts-recovery: just rs test -p moq-mux --lib --run-ignored only -E 'test(/^container::ts::recovery_test::long_/)' # Run moq-audio's ignored output-device tests against a private PulseAudio null sink. audio-devices: #!/usr/bin/env bash set -euo pipefail dir=$(mktemp -d) trap 'rm -rf "$dir"' EXIT python3 test/lib/pulse.py --dir "$dir/run" -- \ just rs test -p moq-audio --features aec,pulseaudio --run-ignored only -E 'not test(/benchmark_/)' # Needs nightly and cargo-fuzz; CI replays the corpus on stable through each # crate's own tests instead. See the README in each rs//fuzz/. # Fuzz a target of any rs//fuzz/ by name: `just rs fuzz lite -- -max_total_time=300`. # `just rs fuzz --minimize lite` shrinks its corpus instead. [positional-arguments] fuzz target *args: sh/rs/fuzz.sh "$@" # No threshold: the report is for finding untested paths, not gating. # The LLVM tools come from the toolchain's `llvm-tools`. # Report native workspace or one crate's coverage under target/coverage/. coverage crate="workspace": bash sh/rs/coverage.sh '{{ crate }}' # Build the default workspace members. build: bash sh/local.sh cargo build --locked # Run the comparable epoll and io_uring UDP matrices. [positional-arguments] bench-udp *args: bash sh/local.sh cargo bench -p moq-uring --bench udp_tokio -- "$@" bash sh/local.sh cargo bench -p moq-uring --bench udp_uring -- "$@" # Measure a QUIC echo through the io_uring worker, ablating receive # batching, GRO, and GSO one at a time. Linux 6.12+ (skips loudly otherwise). [positional-arguments] bench-echo *args: bash sh/local.sh cargo bench -p moq-uring --bench echo_quic -- "$@" # Measure a full moq-lite session (publisher to subscriber) through the # io_uring worker, same ablations and per-iteration unit as bench-echo. # Linux 6.12+ (skips loudly otherwise). [positional-arguments] bench-session *args: bash sh/local.sh cargo bench -p moq-uring --bench session_lite -- "$@" # Publish crates before proposing the next release, so merged versions aren't proposed again. release: release-plz release --git-token "$GITHUB_TOKEN" release-plz release-pr --git-token "$GITHUB_TOKEN" # Build a .deb or .rpm locally: `just rs package moq-relay deb`. package crate packager: sh/rs/package.sh {{ crate }} {{ packager }} # Build and package a workspace binary as a release tarball. [positional-arguments] package-binary *args: sh/rs/package-binary.sh "$@" # Build and package a workspace binary as a Windows .zip. [positional-arguments] package-windows *args: sh/rs/package-windows.sh "$@" # Render an nfpm config from the environment and build a .deb or .rpm: CONFIG PACKAGER OUTPUT. [positional-arguments] package-nfpm *args: sh/rs/package-nfpm.sh "$@" # Build and package the moq-ffi native libraries, or only its bindings. [positional-arguments] package-ffi *args: rs/moq-ffi/build.sh "$@" # Build and package moq-c. [positional-arguments] package-moq-c *args: rs/moq-c/build.sh "$@" # Build and package the moq-gst GStreamer plugin. [positional-arguments] package-gst *args: rs/moq-gst/build.sh "$@" # Load a packaged moq-gst plugin into the host's GStreamer and find its elements. [positional-arguments] gst-smoke *args: rs/moq-gst/smoke.sh "$@" # Build the Criterion benches CodSpeed simulates; CI runs them with `cargo codspeed run`. # Only single-threaded benches without I/O, whose instruction counts repeat. CodSpeed skips # `iter_custom`, so targets made only of it are left out too. Nightly still measures them all. # Valgrind runs ADX but hides it from CPUID (https://bugs.kde.org/show_bug.cgi?id=494162), so # rind is built to skip that one startup check, or it refuses the simulated CPU. # CodSpeed rejects an upload of more than about 1,000 benchmarks, so CI builds and uploads each # shard (net, mux, rest) as its own matrix job, and CodSpeed merges them into one report. codspeed shard: #!/usr/bin/env bash set -euo pipefail build() { VALGRIND_BUG_494162=1 cargo codspeed build --locked -m simulation "$@"; } case "{{ shard }}" in net) build -p moq-net --features moq-net/fuzz \ --bench announce --bench auth --bench bandwidth --bench canonical --bench codec --bench frame \ --bench interests --bench priority --bench retirement --bench schedule --bench stats \ --bench synced --bench tail --bench tracks --bench varint --bench viewers ;; mux) build -p moq-mux \ --bench catalog --bench containers --bench decode_clock --bench export --bench jitter \ --bench parameter_sets --bench sync --bench ts_programs --bench ts_schedule --bench ts_video ;; rest) build -p kio -p moq-audio -p moq-crypto -p moq-json -p moq-pattern -p moq-quic -p moq-rtmp \ --features moq-audio/bus,moq-json/bench,moq-quic/fuzz \ --bench tasks --bench waiter --bench bus --bench protect --bench codec --bench table \ --bench matching --bench endpoint --bench receive --bench sent_packets --bench streams \ --bench chunk_interleaving # moq-auth's published release is its own dev-dependency, so `-p moq-auth` is ambiguous and # cargo-codspeed takes no `--manifest-path`: build it from its own directory. Each build # replaces only its own packages' benches, so `cargo codspeed run` runs both. cd rs/moq-auth && build --bench jwt ;; *) echo "unknown shard '{{ shard }}': expected net, mux, or rest" >&2 exit 1 ;; esac # Run the tests the arguments select in a release build, printing their output; benchmarks add `--run-ignored only`. [positional-arguments] bench-tests *args: bash sh/rs/nextest.sh cargo nextest run --locked --release --success-output immediate "$@" # Sweep retained RTMP chunk-stream IDs independently of message and chunk sizes. [positional-arguments] bench-rtmp *args: bash sh/local.sh cargo bench --locked -p moq-rtmp --bench chunk_interleaving -- "$@" # Refresh one credential across unrelated sessions and held token counts. [positional-arguments] bench-relay-auth *args: bash sh/local.sh cargo bench --locked -p moq-relay --bench auth -- "$@" # One relay's stats tick, plus the decode and aggregate tables. `--test` runs each tick once; the tables ignore it and print every configuration. [positional-arguments] bench-stats *args: bash sh/local.sh cargo bench --locked -p moq-stats --features bench --bench producer_tick --bench decode --bench aggregate -- "$@" # Exact TS receiver scheduling across PID and queued-unit fanout. [positional-arguments] bench-ts-schedule *args: bash sh/local.sh cargo bench --locked -p moq-mux --bench ts_schedule -- "$@" # Ingest an MPTS across program count, bitrate and stray PIDs, the strays against null packets that skip the accounting. [positional-arguments] bench-ts-programs *args: cargo bench --locked -p moq-mux --bench ts_programs -- "$@" # Sweep container export tracks and queued frames independently. [positional-arguments] bench-export *args: bash sh/local.sh cargo bench --locked -p moq-mux --bench export -- "$@" # Requested-pad catalog gating and resolved EOS lookup across renditions x touched pads. [positional-arguments] bench-gst-catalog *args: bash sh/local.sh cargo bench -p moq-gst --bench catalog "$@"