#!/usr/bin/env bash # test_reconstruction.sh - build & run the host behavioral tests for the reconstructed native code. # Compiles the arch-independent reconstruction sources (String, FileHandle) + the test harness for # the host and runs them, validating function-matching behaviour (not just compilation). set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJ="$(cd "$HERE/../.." && pwd)" CXX="${CXX:-g++}" OUT="$(mktemp -d)"; trap 'rm -rf "$OUT"' EXIT # The sources under test (arch-independent; no JNI/NDK needed for these units). SRCS=( "$PROJ/native/src/libg/engine/titan_string.cpp" "$PROJ/native/src/libg/engine/sub_1fe_cluster.cpp" "$PROJ/native/src/libg/io/file_handle.cpp" "$PROJ/native/test/test_reconstruction.cpp" ) echo "[*] Building host behavioral tests with $CXX" "$CXX" -std=c++17 -O0 -g -Wall -Wextra -fsanitize=address,undefined \ -I"$PROJ/native/include" -I"$PROJ/native/third_party/fmod/include" \ "${SRCS[@]}" -o "$OUT/test_reconstruction" echo "[+] BUILD OK -> running (with ASan+UBSan):" echo "$OUT/test_reconstruction"