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_allen_ui_stream_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_allen_ui_stream_test.sh` 52 lines ยท 3181 bytes Raw Blame History 1 #!/bin/sh 2 # ck_allen_ui_stream_test.sh -- a streamed answer keeps the letters already 3 # showing (L853, native/kernel/ui/tests/allen_ui_stream_test.c). The courier 4 # hands each later fragment over as the whole text so far through 5 # ck_allen_ui_said_more: it joins the words on screen, gliding a centred line 6 # that grew, and starts fresh only when the words are not those, are gone, or 7 # belong to a reply not yet shown. The old call (ck_allen_ui_said) must still 8 # blank the strip, so the checks can see the defect, and two mutants of the UI 9 # must be caught: a join that always refuses, and a continuation that ignores a 10 # fresh reply still waiting. Hosted only. Ends with "AIENOS_ALLEN_UI_STREAM: 11 # PASS" or "AIENOS_ALLEN_UI_STREAM: FAIL ". 12 set -u 13 cd "$(dirname "$0")/.." 14 K=native/kernel 15 CC=${HOSTCC:-cc} 16 W=$(mktemp -d "${TMPDIR:-/tmp}/ck_allen_ui_stream.XXXXXX") 17 trap 'rm -rf "$W"' EXIT 18 fail() { echo "AIENOS_ALLEN_UI_STREAM: FAIL $*"; exit 1; } 19 build() { # build OUT ALLEN_UI_C 20 $CC -std=gnu11 -O2 -Wall -Wextra -Werror -pthread -I "$K" -I "$K/ui" -o "$1" \ 21 $K/ui/tests/allen_ui_stream_test.c "$2" $K/svc/allen_code.c $K/ui/paint.c $K/ui/night.c \ 22 $K/ui/sky_real.c $K/ui/sky_data.c $K/ui/mind.c $K/ui/flow.c $K/ui/allen_font.c $K/ui/canvas.c \ 23 $K/svc/allen_scene.c $K/svc/allen_reply.c $K/svc/allen_notes.c $K/svc/allen_intent.c \ 24 $K/svc/setup_wizard.c $K/svc/setup_inv.c 25 } 26 build "$W/stream" $K/ui/allen_ui.c || fail "stream test does not build" 27 "$W/stream" join || fail "a later fragment blanked the letters" 28 "$W/stream" glide || fail "a fragment that wraps to a new line blanked the letters or left a partial redraw" 29 "$W/stream" restart || fail "the old call did not blank; the check cannot see the defect" 30 "$W/stream" mismatch || fail "a different reply was glued on" 31 "$W/stream" pending || fail "an early continuation restarted" 32 "$W/stream" faded || fail "a continuation after the words were gone did not start fresh" 33 "$W/stream" coalesced || fail "a continuation of a reply not yet shown was glued to the old words" 34 35 # Mutant 1: the join refuses every continuation. The join arm must fail. 36 awk ' 37 /^static int join_words\(const char \*reply, uint32_t t\)$/ { print; getline; print 38 print " return 0; /* mutant: every continuation starts over */"; next } 39 { print }' $K/ui/allen_ui.c > "$W/refuse.c" 40 grep -q "mutant: every continuation" "$W/refuse.c" || fail "the refusing mutant did not land" 41 build "$W/refuse" "$W/refuse.c" || fail "the refusing mutant does not build" 42 if "$W/refuse" join; then fail "the refusing mutant still passed the join arm"; fi 43 44 # Mutant 2: a continuation always joins, even when a fresh reply has not been 45 # taken yet. The coalesced arm must fail. 46 awk ' 47 /if \(note\.said_gen == ui\.seen_said\) \{/ { sub(/note\.said_gen == ui\.seen_said/, "1 /* mutant */") } 48 { print }' $K/ui/allen_ui.c > "$W/always.c" 49 grep -q "1 /\* mutant \*/" "$W/always.c" || fail "the always-join mutant did not land" 50 build "$W/always" "$W/always.c" || fail "the always-join mutant does not build" 51 if "$W/always" coalesced; then fail "the always-join mutant still passed the coalesced arm"; fi 52 echo "AIENOS_ALLEN_UI_STREAM: PASS"