#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)" BUILD_DIR="$ROOT_DIR/build/native" EXPECTED_EVENTS="$ROOT_DIR/tests/fixtures/canon/minimal_linear.events" "$ROOT_DIR/tools/build_native_probes.sh" check_exitcode() { local name="$1" local file="$BUILD_DIR/$name.exitcode" if [[ ! -f "$file" ]]; then echo "missing exitcode: $file" >&2 exit 1 fi local rc rc="$(tr -d '[:space:]' < "$file")" if [[ "$rc" != "0" ]]; then echo "$name failed with exit code $rc" >&2 if [[ -f "$BUILD_DIR/$name.stderr.log" ]]; then sed -n '1,160p' "$BUILD_DIR/$name.stderr.log" >&2 fi exit 1 fi } check_exitcode linuxcnc_interp_state_probe check_exitcode linuxcnc_namedparam_harness check_exitcode linuxcnc_interp_minimal_harness check_exitcode linuxcnc_interp_minimal_harness.run check_exitcode linuxcnc_rs274_compile_probe RUN_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.run.stdout.log" grep -Fq "read=0" "$RUN_STDOUT" grep -Fq "execute_line_1=0" "$RUN_STDOUT" grep -Fq "execute_line_2=0" "$RUN_STDOUT" grep -Fq "parse_line=0" "$RUN_STDOUT" while IFS= read -r expected_event; do [[ -z "$expected_event" ]] && continue grep -Fq "$expected_event" "$RUN_STDOUT" done < "$EXPECTED_EVENTS" echo "native probe validation complete"