Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m0/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,5 @@ The historical samples locate candidates; they are not controlled benchmarks.
- [A jq error in the Rust selection fails the run](/quest/m0/ci/check-selection.md) - `just check`'s Rust selection fails the run when one of its jq filters errors, instead of selecting less
- [The workspace-hack refuses trybuild edges and spares non-media builds](/quest/m0/ci/hakari-followups.md) - `hakari.py` refuses trybuild dev-dependency edges, and non-media Linux test builds stop needing libpipewire and libclang
- [Pullfrog reviews finish inside their time limit](/quest/m0/ci/pullfrog-timeout.md) - A Pullfrog review of a large PR finishes instead of failing on the action's run limit
- [Long test runs keep their built binaries](/quest/m0/ci/shared-target.md) - A long `just test interop` or wire-compat run never fails because the binaries it built were removed from the shared Cargo target mid-run, such as by mbx pruning its managed build storage
- [One nextest pin](/quest/m0/ci/nextest-pin.md) - cargo-nextest's version lives in one place
- [The flake lane skips hosts that can't map user namespaces](/quest/m0/ci/userns-uid-map.md) - `check flake` skips instead of failing where `/proc/self/uid_map` is unwritable
33 changes: 0 additions & 33 deletions quest/m0/ci/shared-target.md

This file was deleted.

5 changes: 5 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Every run owns three things and touches nothing else.
holding every log, generated config, and capture. `HARNESS_RUNS` moves the root.
Client builds go here too (the Python venv, the staged Go modules, the browser
page), so two runs from one checkout never rebuild a client the other is running.
Interop and wire-compat also stage their Cargo executables, headers, static libraries,
and GStreamer plugin here immediately after building, as hard links or copies across
filesystems. Every later execution, link, and plugin load uses these run-owned paths,
so collecting shared Cargo output cannot remove an artifact a running matrix still
needs. Binary overrides are staged too, including nested wire-compat cells.

**Reserved ports.** A port is claimed by creating a directory under
`/tmp/moq-test-ports-<uid>` (`HARNESS_PORT_ROOT`), held for the whole run, and
Expand Down
17 changes: 10 additions & 7 deletions test/interop/compat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ release_binary moq-cli moq
release_binary moq-relay moq-relay
cargo build --locked -p moq-cli -p moq-relay
TARGET=$(cargo metadata --no-deps --format-version 1 | python3 -c 'import json,sys;print(json.load(sys.stdin)["target_directory"])')
CURRENT="$TARGET/debug/moq"
harness_stage current/moq "$TARGET/debug/moq"
harness_stage current/moq-relay "$TARGET/debug/moq-relay"
CURRENT="$HARNESS_RUN/current/moq"
RELEASED="$HARNESS_RUN/released/bin/moq"
"$CURRENT" --help >"$HARNESS_RUN/current-help"
"$RELEASED" --help >"$HARNESS_RUN/released-help"
Expand Down Expand Up @@ -130,13 +132,14 @@ hang = $dependency
bytes = "1"
TOML
cargo build --manifest-path "$HARNESS_RUN/hang-$source/Cargo.toml" --target-dir "$TARGET/compat-hang-$source"
"$TARGET/compat-hang-$source/debug/compat-container" encode "$HARNESS_RUN/$source.catalog" "$HARNESS_RUN/$source.frame"
harness_stage "hang-$source/compat-container" "$TARGET/compat-hang-$source/debug/compat-container"
"$HARNESS_RUN/hang-$source/compat-container" encode "$HARNESS_RUN/$source.catalog" "$HARNESS_RUN/$source.frame"
done
bun "$DIR/compat/client.ts" encode "$HARNESS_RUN/js-current.catalog" "$HARNESS_RUN/js-current.frame"
bun "$HARNESS_RUN/js/client.ts" encode "$HARNESS_RUN/js-released.catalog" "$HARNESS_RUN/js-released.frame"
for source in current released js-current js-released; do
for consumer in current released; do
"$TARGET/compat-hang-$consumer/debug/compat-container" decode "$HARNESS_RUN/$source.catalog" "$HARNESS_RUN/$source.frame"
"$HARNESS_RUN/hang-$consumer/compat-container" decode "$HARNESS_RUN/$source.catalog" "$HARNESS_RUN/$source.frame"
done
bun "$DIR/compat/client.ts" decode "$HARNESS_RUN/$source.catalog" "$HARNESS_RUN/$source.frame"
bun "$HARNESS_RUN/js/client.ts" decode "$HARNESS_RUN/$source.catalog" "$HARNESS_RUN/$source.frame"
Expand Down Expand Up @@ -205,7 +208,7 @@ live_publisher() {
# relay, and package set, and can never be covered by a planned break.
while read -r source version <&3; do
case "$source" in
current) relay="$TARGET/debug/moq-relay" pub="$CURRENT" js="$DIR/compat" ;;
current) relay="$HARNESS_RUN/current/moq-relay" pub="$CURRENT" js="$DIR/compat" ;;
released) relay="$HARNESS_RUN/released/bin/moq-relay" pub="$RELEASED" js="$HARNESS_RUN/js" ;;
*)
echo "unknown media control source: $source" >&2
Expand Down Expand Up @@ -233,15 +236,15 @@ while read -r version <&3; do
released_relay="$HARNESS_RUN/released/bin/moq-relay"
# Each moq-net library states whether the draft has FETCH, so a FETCH cell that
# fails is a failure, never a skip. Dropping a released capability fails too.
current_fetch=$("$TARGET/compat-hang-current/debug/compat-container" fetch-supported "$version")
released_fetch=$("$TARGET/compat-hang-released/debug/compat-container" fetch-supported "$version")
current_fetch=$("$HARNESS_RUN/hang-current/compat-container" fetch-supported "$version")
released_fetch=$("$HARNESS_RUN/hang-released/compat-container" fetch-supported "$version")
cell fetch-capability "$version" both both fetch_kept "$released_fetch" "$current_fetch"
if [[ "$released_fetch" != true || "$current_fetch" != true ]]; then
echo "SKIP $version fetch and js-publish: no FETCH on this draft in both libraries"
skipped=$((skipped + 8))
fi
for relay_source in current released; do
if [[ "$relay_source" == current ]]; then relay="$TARGET/debug/moq-relay"; else relay="$released_relay"; fi
if [[ "$relay_source" == current ]]; then relay="$HARNESS_RUN/current/moq-relay"; else relay="$released_relay"; fi
for source in current released; do
# Each side's compat client, with its version-pinning transport beside it.
if [[ "$source" == current ]]; then
Expand Down
76 changes: 48 additions & 28 deletions test/interop/interop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ plan_pass() {
}
plan_cases

TARGET_BASE="" # cargo target dir (resolved in require_tools)
TARGET_BASE="" # cargo target dir (resolved in require_tools)
EXAMPLES="$HARNESS_RUN/examples"
PY="" # python interpreter with the workspace moq build (set in prepare)
C_INTEROP="" # compiled C client binary (set in prepare)
GO_INTEROP="" # compiled Go client binary (set in prepare)
Expand Down Expand Up @@ -586,28 +587,42 @@ require_tools() {
# Build moq-relay + moq-cli from the workspace. The relay is the spine of the
# test, so a failure here aborts rather than marking a single client broken.
build_relay_cli() {
local flag=() build_examples=0
[[ "$PROFILE" == "release" ]] && flag=(--release)
if [[ -n "$RELAY" && -n "$MOQ" ]]; then
[[ -x "$RELAY" && -x "$MOQ" ]] || {
echo "override binaries are not executable" >&2
exit 1
}
return
fi
local flag=()
[[ "$PROFILE" == "release" ]] && flag=(--release)
echo "building moq-relay + moq-cli ($PROFILE)..."
# ${arr[@]+...} guard: bash 3.2 (macOS /bin/bash) errors on "${flag[@]}" for
# an empty (debug) array under `set -u`.
(cd "$WORKSPACE" && cargo build --locked ${flag[@]+"${flag[@]}"} -p moq-relay -p moq-cli) || {
echo "error: failed to build moq-relay / moq-cli" >&2
exit 1
}
if [[ "$MEDIA" -eq 0 ]]; then
(cd "$WORKSPACE" && cargo build --locked ${flag[@]+"${flag[@]}"} -p moq-cli --example interop-tail --example interop-catalog --example interop-audio --example interop-hls --example interop-control --example interop-goaway --example interop-goaway-client --example interop-finish)
else
build_examples=1
echo "building moq-relay + moq-cli ($PROFILE)..."
# ${arr[@]+...} guard: bash 3.2 (macOS /bin/bash) errors on "${flag[@]}" for
# an empty (debug) array under `set -u`.
(cd "$WORKSPACE" && cargo build --locked ${flag[@]+"${flag[@]}"} -p moq-relay -p moq-cli) || {
echo "error: failed to build moq-relay / moq-cli" >&2
exit 1
}
[[ -n "$RELAY" ]] || RELAY="$TARGET_BASE/$PROFILE/moq-relay"
# The `moq-cli` crate ships its binary as `moq` (a `[[bin]]` override).
[[ -n "$MOQ" ]] || MOQ="$TARGET_BASE/$PROFILE/moq"
fi
harness_stage bin/moq-relay "$RELAY"
harness_stage bin/moq "$MOQ"
RELAY="$HARNESS_RUN/bin/moq-relay"
MOQ="$HARNESS_RUN/bin/moq"
if [[ -n "${INTEROP_SUB_MOQ:-}" ]]; then
harness_stage bin/moq-sub "$INTEROP_SUB_MOQ"
INTEROP_SUB_MOQ="$HARNESS_RUN/bin/moq-sub"
fi
if [[ "$build_examples" -eq 1 && "$MEDIA" -eq 0 ]]; then
local example args=() examples=(interop-tail interop-catalog interop-audio interop-hls interop-control interop-goaway interop-goaway-client interop-finish)
for example in "${examples[@]}"; do args+=(--example "$example"); done
(cd "$WORKSPACE" && cargo build --locked ${flag[@]+"${flag[@]}"} -p moq-cli "${args[@]}")
for example in "${examples[@]}"; do
harness_stage "examples/$example" "$TARGET_BASE/$PROFILE/examples/$example"
done
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
[[ -n "$RELAY" ]] || RELAY="$TARGET_BASE/$PROFILE/moq-relay"
# The `moq-cli` crate ships its binary as `moq` (a `[[bin]]` override).
[[ -n "$MOQ" ]] || MOQ="$TARGET_BASE/$PROFILE/moq"
}

# Build the workspace Python packages as wheels (maturin builds rs/moq-ffi, hatchling
Expand Down Expand Up @@ -774,6 +789,8 @@ prepare_c() {
mark_broken c "moq-c artifacts missing ($header / $lib)"
return
}
harness_stage c/include/moq.h "$header"
harness_stage c/libmoq.a "$lib"
# cargo can't inject libmoq.a's native deps into an external link, so read
# them from the same list moq-c.pc and CMake use.
local native_libs
Expand All @@ -790,7 +807,7 @@ prepare_c() {
esac
done <"$native_libs"
C_INTEROP="$HARNESS_RUN/c-interop"
if ! "$cc" "$CLIENTS/c/subscribe.c" -I"$out_dir/include" -L"$TARGET_BASE/$PROFILE" -lmoq "${os_libs[@]}" -o "$C_INTEROP" >"$HARNESS_RUN/c-compile.log" 2>&1; then
if ! "$cc" "$CLIENTS/c/subscribe.c" -I"$HARNESS_RUN/c/include" "$HARNESS_RUN/c/libmoq.a" "${os_libs[@]}" -o "$C_INTEROP" >"$HARNESS_RUN/c-compile.log" 2>&1; then
mark_broken c "cc compile failed"
sed 's/^/ /' "$HARNESS_RUN/c-compile.log" >&2 || true
fi
Expand Down Expand Up @@ -819,7 +836,10 @@ prepare_gst() {
sed 's/^/ /' "$HARNESS_RUN/gst-build.log" >&2 || true
return
fi
GST_PLUGIN_DIR="$TARGET_BASE/$PROFILE"
local extension=so
[[ "$(uname -s)" != Darwin ]] || extension=dylib
harness_stage "gst/libgstmoq.$extension" "$TARGET_BASE/$PROFILE/libgstmoq.$extension"
GST_PLUGIN_DIR="$HARNESS_RUN/gst"
# Use the packaging smoke check's isolated discovery and factory assertions.
if ! "$WORKSPACE/rs/moq-gst/smoke.sh" "$GST_PLUGIN_DIR" >"$HARNESS_RUN/gst-inspect.log" 2>&1; then
mark_broken gst "moqsrc not exposed (plugin failed to load against this GStreamer)"
Expand Down Expand Up @@ -1380,7 +1400,7 @@ PYCODE
local n connect audio_pid="" audio_status=0
rust_connect "$url"
if [[ "$AUDIO" -eq 1 ]]; then
timeout -k 3 "$TIMEOUT" "$TARGET_BASE/$PROFILE/examples/interop-audio" \
timeout -k 3 "$TIMEOUT" "$EXAMPLES/interop-audio" \
"$url" "$broadcast" "$audio_out" "$AUDIO_MS" "$(cell_version rust)" &
audio_pid=$!
fi
Expand Down Expand Up @@ -1610,7 +1630,7 @@ run_finish_client() {
if [[ "$role" == publish ]]; then args+=(--finish-ack "$ack"); else args+=(--finish --frames 10); fi
case "$lang/$role" in python/publish | go/publish | cpp/publish) args+=(--tone "$(publisher_tone "$lang")") ;; esac
case "$lang" in
rust) timeout -k 3 "$limit" "$TARGET_BASE/$PROFILE/examples/interop-finish" "${args[@]}" ;;
rust) timeout -k 3 "$limit" "$EXAMPLES/interop-finish" "${args[@]}" ;;
python) timeout -k 3 "$limit" "$PY" "$CLIENTS/python/interop.py" "${args[@]}" ;;
go) timeout -k 3 "$limit" "$GO_INTEROP" "${args[@]}" ;;
cpp) timeout -k 3 "$limit" "$CPP_INTEROP" "${args[@]}" ;;
Expand Down Expand Up @@ -1830,7 +1850,7 @@ run_tail_client() {
extra=("$version")
fi
case "$lang" in
rust) timeout -k 3 "$limit" "$TARGET_BASE/$PROFILE/examples/interop-tail" "$role" "$url" "$broadcast" ${extra[@]+"${extra[@]}"} ;;
rust) timeout -k 3 "$limit" "$EXAMPLES/interop-tail" "$role" "$url" "$broadcast" ${extra[@]+"${extra[@]}"} ;;
js-native-node) (cd "$CLIENTS/js-native" && timeout -k 3 "$limit" node --import tsx tail.ts "$role" "$url" "$broadcast" ${extra[@]+"${extra[@]}"}) ;;
js-native-bun) (cd "$CLIENTS/js-native" && timeout -k 3 "$limit" bun tail.ts "$role" "$url" "$broadcast" ${extra[@]+"${extra[@]}"}) ;;
*)
Expand Down Expand Up @@ -2247,12 +2267,12 @@ run_control_case() {
local runtime="$1" kind="$2" version name="$2-$1" started=$SECONDS
local cell=(case="$kind" publisher=rust subscriber="$runtime" log="$LOGS/$name.log")
version=$(pinned_version)
local command=("$TARGET_BASE/$PROFILE/examples/interop-control" "$kind" "$version" "${runtime##*-}")
local command=("$EXAMPLES/interop-control" "$kind" "$version" "${runtime##*-}")
case "$kind" in
status) cell=(case="wire track status" publisher=rust subscriber="$runtime" log="$LOGS/$name.log") ;;
goaway) command=("$TARGET_BASE/$PROFILE/examples/interop-goaway" "$version" "${runtime##*-}") ;;
goaway) command=("$EXAMPLES/interop-goaway" "$version" "${runtime##*-}") ;;
reverse-goaway)
command=("$TARGET_BASE/$PROFILE/examples/interop-goaway-client" "$version")
command=("$EXAMPLES/interop-goaway-client" "$version")
cell=(case=goaway publisher="$runtime" subscriber=rust log="$LOGS/$name.log")
;;
esac
Expand Down Expand Up @@ -2283,7 +2303,7 @@ relay_inflated() {
run_catalog_publisher() {
local fifo="$1"
shift
timeout -k 3 $((TIMEOUT * 2)) "$TARGET_BASE/$PROFILE/examples/interop-catalog" "$@" <"$fifo" 9>&-
timeout -k 3 $((TIMEOUT * 2)) "$EXAMPLES/interop-catalog" "$@" <"$fifo" 9>&-
}

# shellcheck disable=SC2329 # invoked indirectly via harness_spawn
Expand Down Expand Up @@ -2359,7 +2379,7 @@ run_hls_publisher() {
local fifo="$1" runtime="$2"
shift 2
case "$runtime" in
rust) timeout -k 3 $((TIMEOUT * 2)) "$TARGET_BASE/$PROFILE/examples/interop-hls" publish "$@" <"$fifo" 9>&- ;;
rust) timeout -k 3 $((TIMEOUT * 2)) "$EXAMPLES/interop-hls" publish "$@" <"$fifo" 9>&- ;;
js-native-node) (cd "$CLIENTS/js-native" && timeout -k 3 $((TIMEOUT * 2)) node --import tsx hls.ts "$@" <"$fifo" 9>&-) ;;
js-native-bun) (cd "$CLIENTS/js-native" && timeout -k 3 $((TIMEOUT * 2)) bun hls.ts "$@" <"$fifo" 9>&-) ;;
esac
Expand All @@ -2383,7 +2403,7 @@ run_hls_records() {
for publisher in rust "$runtime"; do
harness_spawn "$name-$publisher-pub" "$LOGS/$name-$publisher-pub.log" run_hls_publisher "$fifo" "$publisher" "$(token_url --publish "$broadcast-$publisher/**")" "$broadcast-$publisher"
pid="$HARNESS_PID"
harness_spawn "$name-$publisher-read" "$LOGS/$name-$publisher-read.log" timeout -k 3 "$TIMEOUT" "$TARGET_BASE/$PROFILE/examples/interop-hls" read "$(token_url --subscribe "$broadcast-$publisher/**")" "$broadcast-$publisher"
harness_spawn "$name-$publisher-read" "$LOGS/$name-$publisher-read.log" timeout -k 3 "$TIMEOUT" "$EXAMPLES/interop-hls" read "$(token_url --subscribe "$broadcast-$publisher/**")" "$broadcast-$publisher"
harness_wait "$HARNESS_PID" || why="${why:-$publisher records unreadable}"
printf 'clean end\n' >&9
harness_wait "$pid" || true
Expand Down
Loading
Loading