#!/usr/bin/env sh set -eu cxx=${CXX_HOST:-c++} build_dir=${1:-host-build} mkdir -p "$build_dir" $cxx -std=c++17 -Wall -Wextra -Werror -pedantic \ -fsanitize=address,undefined -fno-omit-frame-pointer \ -Itests/host-shim -Iinclude tests/queue_host.cpp -o "$build_dir/queue_host" ASAN_OPTIONS=detect_leaks=1 "$build_dir/queue_host" $cxx -std=c++17 -Wall -Wextra -Werror -pedantic \ -Itests/host-shim -Iinclude -c tests/queue_trivial_positive.cpp \ -o "$build_dir/trivial-positive.o" if $cxx -std=c++17 -Wall -Wextra -pedantic \ -Itests/host-shim -Iinclude -c tests/queue_nontrivial_negative.cpp \ -o "$build_dir/nontrivial-negative.o" >"$build_dir/nontrivial-negative.log" 2>&1; then echo "non-trivial queue message compiled successfully" >&2 exit 1 fi grep -Fq 'Queue requires T to be trivially copyable' \ "$build_dir/nontrivial-negative.log" || { echo "negative type gate failed for an unexpected reason" >&2 cat "$build_dir/nontrivial-negative.log" >&2 exit 1 } echo "PASS host: typed byte copy, FIFO/full/empty and non-trivial type gate"