adds test harness

This commit is contained in:
2026-03-22 18:27:07 +01:00
parent bbad53cc1a
commit 78163ebb99
4 changed files with 144 additions and 19 deletions

View File

@@ -0,0 +1,40 @@
#!/bin/bash
set -euo pipefail
simulator="$1"
isa="$2"
elf="$3"
pass_pattern="$4"
fail_pattern="$5"
if [ ! -x "$simulator" ]; then
echo "Simulator not found or not executable: $simulator" >&2
exit 2
fi
if [ ! -f "$elf" ]; then
echo "ELF not found: $elf" >&2
exit 2
fi
log_file=$(mktemp)
trap 'rm -f "$log_file"' EXIT
"$simulator" \
--isa="$isa" \
-f "$elf" \
-p tb.top.core.finish_condition=1 \
-m 10s \
| tee "$log_file"
if grep -Fq "$fail_pattern" "$log_file"; then
echo "ThreadX regression reported failure pattern: $fail_pattern" >&2
exit 1
fi
if ! grep -Fq "$pass_pattern" "$log_file"; then
echo "Missing expected success pattern in simulator output: $pass_pattern" >&2
exit 1
fi
exit 0