adds test harness
This commit is contained in:
40
test/threadx/run_threadx_simple_test.sh
Executable file
40
test/threadx/run_threadx_simple_test.sh
Executable 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
|
||||
Reference in New Issue
Block a user