summaryrefslogtreecommitdiff
path: root/test/snapshots/acmefs.snap
diff options
context:
space:
mode:
Diffstat (limited to 'test/snapshots/acmefs.snap')
-rw-r--r--test/snapshots/acmefs.snap40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/snapshots/acmefs.snap b/test/snapshots/acmefs.snap
new file mode 100644
index 00000000..e338245b
--- /dev/null
+++ b/test/snapshots/acmefs.snap
@@ -0,0 +1,40 @@
+# acme's control filesystem, end to end: a process OUTSIDE pardes opens a pane,
+# fills its body, reads it back through the same tree, and finally drives a
+# builtin by writing an event record — the acme remote-control door.
+#
+# Everything here runs through a real FUSE mount served by the real binary, so
+# a failure means the mount, the protocol, the transaction or the semantics —
+# there is nothing else in the path.
+#
+# The mount lives OUTSIDE this script's own directory, and the script unmounts
+# it at both ends. Two reasons, both about how this harness works: it kills the
+# app with SIGKILL, so pardes never gets to unmount (that is what
+# fuse.sweepStale exists for, but a `--fs=<dir>` this explicit is not ours to
+# sweep), and a stale ENOTCONN mount inside the per-script directory would make
+# the next run's `rm -rf` — and therefore its mkdir — fail.
+run sh -c 'fusermount3 -u -z /tmp/pardes-acmefs-snap 2>/dev/null; rm -rf /tmp/pardes-acmefs-snap; exit 0'
+start 30 100 --fs=/tmp/pardes-acmefs-snap
+wait 8000 New Newcol
+stable 700 20000
+# the tree acme(4) describes, served by pardes
+run sh -c 'ls /tmp/pardes-acmefs-snap > tree.txt 2>&1'
+snapfile tree tree.txt
+# `new` creates a pane on ACCESS, and its ctl reads back the pane's own id
+# (field 1 of acme's five). Writing body appends, so the pane holds the bytes.
+run sh -c 'M=/tmp/pardes-acmefs-snap; id=$(cut -c1-11 < $M/new/ctl | tr -d " "); echo $id > id.txt; printf "hello from outside\n" >> $M/$id/body'
+wait 8000 hello from outside
+stable 700 15000
+snap fs-body-written
+# ...and reading it back is the same filesystem answering about live state
+run sh -c 'M=/tmp/pardes-acmefs-snap; id=$(cat id.txt); cat $M/$id/body > body.txt; cut -c1-11 < $M/$id/ctl | tr -d " " > ctlid.txt; sed -n 1p $M/index | cut -c1-11 | tr -d " " > firstid.txt'
+snapfile body body.txt
+snapfile ctlid ctlid.txt
+snapfile firstid firstid.txt
+# THE DOOR: put a builtin in the pane's tag, then write an event record naming
+# its byte range. pardes executes it exactly as a middle click would — which is
+# how an acme client has always run editor commands, and is code execution by
+# design (see examples/README.md).
+run sh -c 'M=/tmp/pardes-acmefs-snap; id=$(cat id.txt); q0=$(wc -c < $M/$id/tag); printf " Newcol" >> $M/$id/tag; q1=$(wc -c < $M/$id/tag); printf "Mx%d %d\n" $((q0 + 1)) $q1 > $M/$id/event'
+stable 700 15000
+snap fs-event-exec
+run sh -c 'fusermount3 -u -z /tmp/pardes-acmefs-snap 2>/dev/null; rm -rf /tmp/pardes-acmefs-snap; exit 0'