feat: add lab-rv32i-c-machine-timer card

This commit is contained in:
user
2026-07-21 19:14:20 +02:00
commit a0e116f24e
23 changed files with 4720 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail
root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
tmp_dir="$(mktemp -d /tmp/c11-card.XXXXXX)"
cleanup() {
rm -rf -- "$tmp_dir"
}
trap cleanup EXIT HUP INT TERM
"$root/scripts/render_card_layouts.sh" >/dev/null
"$root/scripts/render_new_pdf.sh" >/dev/null
pdf="$(find "$root/doc/pdf" -maxdepth 1 -type f \
-name 'mpabi-inf-c-11-machine-timer-*.pdf' -print -quit)"
test -n "$pdf"
qpdf --check "$pdf" >/dev/null
pdftotext -layout "$pdf" "$tmp_dir/card.txt"
blocks="$(rg -o 'A[1-8] (CONTEXT|STRUCTURE|DISPATCH|APPLICATION|FLOW|STATE|RUNTIME|PATTERNS)' \
"$tmp_dir/card.txt" | wc -l)"
test "$blocks" -eq 24
if awk 'BEGIN { RS="\f" } { compact=$0; gsub(/[[:space:]]/, "", compact); if (length(compact) < 100) exit 1 }' \
"$tmp_dir/card.txt"; then
:
else
echo "FAIL: empty or nearly empty PDF page" >&2
exit 1
fi
if awk 'BEGIN { RS="\f" } \
/A[1-8] (CONTEXT|STRUCTURE|DISPATCH|APPLICATION|FLOW|STATE|RUNTIME|PATTERNS)/ && !/TASK0[1-3]/ { exit 1 }' \
"$tmp_dir/card.txt"; then
:
else
echo "FAIL: A1-A8 block on a page without its TASK heading" >&2
exit 1
fi
jq -e '
.tasks_order == ["task01", "task02", "task03"] and
all(.tasks[];
[.viewpoints[].id] == ["A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8"] and
all(.viewpoints[]; .status == "enabled" or .status == "unavailable"))
' "$root/json/card_source.json" >/dev/null
node --check "$root/web/app.js"
printf 'PASS card: 3 tasks, 24 A blocks, valid PDF, no empty/anonymous page\n'