#!/bin/sh # Build and run the MplexCopyMode differential test. Writes only under taicpp/build/f4. # usage: tests/mplex_copy_run.sh [fuzz_count] [seed] (SAN=1 builds with ASan and UBSan) set -e here=$(cd "$(dirname "$0")" && pwd) tc=$(cd "$here/.." && pwd) repo=$(cd "$tc/.." && pwd) out="$tc/build/f4" mkdir -p "$out" srcs="" for f in "$tc"/src/mplex/*.cpp; do case "$f" in */mplex_server.cpp|*/mplex_commands.cpp|*/mplex_client.cpp) continue ;; esac srcs="$srcs $f" done flags="-O2" bin="$out/mplex_copy_test" if [ -n "$SAN" ]; then flags="-g -O1 -fsanitize=address,undefined" bin="$out/mplex_copy_test_san" fi # The test supplies its own MplexServer stub and the MplexCommands destructor it needs. g++ -std=c++23 -Wall -Wextra $flags -DF4_STUB_COMMANDS -I"$tc/src/mplex" "$tc/tests/mplex_copy_test.cpp" $srcs \ -Wl,--unresolved-symbols=ignore-in-object-files -o "$bin" python3 -I "$tc/tests/mplex_copy_gen.py" "$repo" "$out/scenarios.txt" "${1:-3600}" "${2:-20251025}" "$bin" "$out/scenarios.txt"