#!/usr/bin/env bash # Build and run the host-side wM-Bus frame tests under AddressSanitizer. # The sanitizer is the point: these tests feed adversarial lengths through # the CRC walk, and only ASan makes an out-of-bounds read observable. set -euo pipefail cd "$(dirname "$0")" CC=${CC:-gcc} OUT=$(mktemp -d) trap 'rm -rf "$OUT"' EXIT "$CC" -std=c11 -O1 -g -Wall -Wextra -Werror \ -fsanitize=address,undefined -fno-omit-frame-pointer \ -o "$OUT/test_wmbus" test_wmbus.c ../main/wmbus.c "$OUT/test_wmbus" "$CC" -std=c11 -O1 -g -Wall -Wextra -Werror \ -fsanitize=address,undefined -fno-omit-frame-pointer \ -I../main -o "$OUT/test_duty_ledger" \ test_duty_ledger.c ../main/duty_ledger.c "$OUT/test_duty_ledger" "$CC" -std=c11 -O1 -g -Wall -Wextra -Werror \ -fsanitize=address,undefined -fno-omit-frame-pointer \ -I../main -o "$OUT/test_t1_long" \ test_t1_long.c ../main/wmbus.c "$OUT/test_t1_long" "$CC" -std=c11 -O1 -g -Wall -Wextra -Werror \ -I../main -o "$OUT/test_font_render" test_font_render.c "$OUT/test_font_render" | tail -1