summaryrefslogtreecommitdiffstats
path: root/scripts/test-disk.sh
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 13:14:07 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 13:14:07 +0200
commit6eb14b64209b9d24554c587f610d7e300ef809ea (patch)
treec308507a2140680eb82fdb8b360aa346e7c5c9fe /scripts/test-disk.sh
parentBump workspace to edition 2024 (diff)
downloadrs-dos-6eb14b64209b9d24554c587f610d7e300ef809ea.tar.gz
rs-dos-6eb14b64209b9d24554c587f610d7e300ef809ea.zip
shell: keyword redirection + post-filter flags (ADR 0002)
Implement the shell experience redesign: one canonical grammar for every command — 'cmd args [USE src] [TIL marker] [filters...] [output kw dst]'. - Keyword redirection (uppercase-only, aliases valid, fully reserved): WRITING/WRITE overwrite, TO append, USE/USING input source, TIL/UNTIL heredoc/terminator (exact full-line marker). > >> < << are removed; '>' is plain text. - Post-filter stages applied left to right over a line stream, each repeatable: -h N (head kills the upstream), -t N (tail holds a rolling window, flushes at EOF/^C), -g PAT (smart-case literal substring), -p (screenful pager, terminal only). A file sink replaces the screen; -p is a no-op with one. - C-style quoting: "..." groups and literalizes, \x escapes one char; quoted/escaped text is never an operator, never split. - Input consumers: cat/hexdump, path-less only (stdin until ^D, USE f, TIL m heredoc, USE f TIL m truncation). Other commands reject input keywords; paths + input keyword is a syntax error. - ^D is EOF everywhere and never powers off; poweroff/exit are the only shutdown verbs. - help rewritten; test-disk.sh and sendkeys.py use the keyword syntax. Verified in QEMU: 26 grammar checks on fresh and reused disks, disk round trip, pager pacing, -h stopping /dev/mem at N lines, ^C flushing a -t window. Two bugs found during verification and fixed: 1. WRITING over an existing file wrote after stale NUL padding — fs::size() is stale after set_len(0); the sink writes at offset 0 after truncation. 2. USE f TIL m leaked the post-marker remainder — the final partial-line emit ran after the marker break; guarded with a stopped flag.
Diffstat (limited to 'scripts/test-disk.sh')
-rwxr-xr-xscripts/test-disk.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/test-disk.sh b/scripts/test-disk.sh
index f7337ef..11a9b05 100755
--- a/scripts/test-disk.sh
+++ b/scripts/test-disk.sh
@@ -99,14 +99,14 @@ VOL_UID="$(grep -a 'fat: mounted' "$LOG" | sed -n 's/.*at \/disk\/\([^ )]*\).*/\
99[ -n "$VOL_UID" ] || fail "no FAT32 volume was mounted (look for 'fat: mounted' in the log)" 99[ -n "$VOL_UID" ] || fail "no FAT32 volume was mounted (look for 'fat: mounted' in the log)"
100echo " mounted volume UID: $VOL_UID" 100echo " mounted volume UID: $VOL_UID"
101 101
102echo "==> 4/6 drive the shell (ls / mkdir / echo > / cat / poweroff)" 102echo "==> 4/6 drive the shell (ls / mkdir / echo WRITING / cat / poweroff)"
103# The filename is deliberately >13 chars so the FAT LFN path gets 103# The filename is deliberately >13 chars so the FAT LFN path gets
104# multi-entry entries (they're stored last-first on disk). 104# multi-entry entries (they're stored last-first on disk).
105TESTFILE="disk-test-$STAMP.txt" 105TESTFILE="disk-test-$STAMP.txt"
106python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \ 106python3 "$SCRIPT_DIR/sendkeys.py" --sock "$SOCK" \
107 "ls /disk" \ 107 "ls /disk" \
108 "mkdir /disk/$VOL_UID/sub" \ 108 "mkdir /disk/$VOL_UID/sub" \
109 "echo disk-test-$STAMP > /disk/$VOL_UID/sub/$TESTFILE" \ 109 "echo disk-test-$STAMP WRITING /disk/$VOL_UID/sub/$TESTFILE" \
110 "cat /disk/$VOL_UID/sub/$TESTFILE" \ 110 "cat /disk/$VOL_UID/sub/$TESTFILE" \
111 "poweroff" 111 "poweroff"
112 112