Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/scripts/ck_spark_report_test.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / scripts / ck_spark_report_test.sh` 41 lines ยท 2021 bytes Raw Blame History 1 #!/bin/sh 2 # ck_spark_report_test.sh -- host test of the Spark boot report (L198): frames 3 # built by native/net/aienos_report.c (tag AIENUX-SPARK-REPORT) for a 40 KiB 4 # report, sent out of order and twice over loopback to the shared receiver 5 # tools/ck_imac_report_listen.c, which must rebuild it byte for byte as 6 # spark-.unauthenticated.txt and still accept the iMac's parts (scripts/ck_imac_report_test.sh). 7 # Hosted only; the RTL8127 itself is covered by native/net tests/rtl8127_test.c. 8 # Ends with "AIENUX_SPARK_REPORT: PASS" or "AIENUX_SPARK_REPORT: FAIL ". 9 set -u 10 cd "$(dirname "$0")/.." 11 K=native/kernel 12 N=native/net 13 W=$(mktemp -d "${TMPDIR:-/tmp}/ck_spark_report.XXXXXX") 14 trap 'kill $LP 2>/dev/null; rm -rf "$W"' EXIT 15 LP= 16 fail() { echo "AIENUX_SPARK_REPORT: FAIL $*"; exit 1; } 17 CC=${HOSTCC:-cc} 18 CF="-std=gnu11 -O2 -Wall -Wextra -Werror" 19 $CC $CF -o "$W/listen" $K/tools/ck_imac_report_listen.c || fail "listener does not build" 20 $CC $CF -o "$W/send" $N/tests/report_send.c $N/aienos_report.c $N/aienos_net.c || fail "sender does not build" 21 i=0 22 while [ $i -lt 40960 ]; do printf 'spark boot report line %05d\n' $((i / 29)); i=$((i + 29)); done | head -c 40960 > "$W/sent.txt" 23 PORT=$((47900 + $$ % 90)) 24 mkdir -p "$W/out" 25 "$W/listen" $PORT "$W/out" 20 & 26 LP=$! 27 i=0 28 until grep -q "^ready port=$PORT" "$W/out/listen.log" 2>/dev/null; do 29 i=$((i + 1)); [ $i -gt 50 ] && fail "listener not ready: $(cat "$W/out/listen.log" 2>/dev/null)" 30 sleep 0.1 31 done 32 "$W/send" $PORT "$W/sent.txt" >/dev/null || fail "send" 33 i=0 34 until grep -q "^complete run=`fedcba9876543210` " "$W/out/listen.log"; do 35 i=$((i + 1)); [ $i -gt 50 ] && fail "report not completed: $(cat "$W/out/listen.log")" 36 sleep 0.1 37 done 38 cmp -s "$W/sent.txt" "$W/out/spark-`fedcba9876543210`.unauthenticated.txt" || fail "rebuilt report differs" 39 [ "$(grep -c '^complete ' "$W/out/listen.log")" = 1 ] || fail "report written more than once" 40 grep -q '^ignored' "$W/out/listen.log" && fail "listener ignored a valid part" 41 echo "AIENUX_SPARK_REPORT: PASS"