flan/test/programs/dev-pause.flan
Joseph Ferano f2be0a62dd A pause is waited for by name, and a build is not a socket
Two follow-ups to the marking commit.

`Dev.eval_expr`'s new wait matched `Stopped _`, which fires on the first
iteration when the program is already parked on something else — the
break loop allows evaluating, so that is reachable — and answers for a
thunk that has not run yet, on a reply whose own `:condition` names the
other condition. It now waits for `Stopped "Pause"`, which the agent
reports under a nested break because `condition_name` is overwritten on
the way in and restored on the way out. `dev-pause.flan` grows a
`Missing` and a `boom` so the test can park the program on something
else first and tell the two apart.

And the flake NEXT.md had as "seen once and unexplained": `the daemon
never listened` is not a race, it is an llc-and-link of the whole
program before `flan dev` binds — ~600ms idle, measured at 6.6s and 6.8s
with the rest of the suite beside it, against a 5s and 8s await. All
three test binaries now wait a minute; the watchdog is what bounds the
run. Two consecutive full runs green.
2026-09-13 13:07:25 +07:00

37 lines
1.3 KiB
Plaintext

;;;; A program to set a breakpoint in, for driving `C-u C-c C-c' from an editor.
;;;;
;;;; Unlike dev-break.flan it does not stop on its own: it starts running and
;;;; keeps running, because the claim being tested is that marking a form is
;;;; what stops it. Anything already stopped would prove nothing.
;;;;
;;;; What it needs is a function that keeps being called, so that a mark set
;;;; after startup is hit, and hit again after the mark is cleared. dev-loop.flan
;;;; calls [step] four times, which is too tight for that; this is dev-break.flan's
;;;; tail with nothing in front of it.
(import agent "vendor:agent")
(defvar ticks i64)
;;; Something to stop on that is *not* a breakpoint, so that a marked
;;; expression sent to an already-stopped program can be told from the break it
;;; was already sitting in. It is here rather than in an evaluated form for the
;;; reason dev-loop.flan gives: the break loop matches on a class the host was
;;; compiled with.
(defstruct Missing [id i32])
(defn boom [] i64
(restart-case
(do (error (Missing {.id 1})) 0)
(carry-on [] -1)))
(defn step [] i64
(set ticks (+ ticks 1))
ticks)
(defn main [] i32
(agent/start "/tmp/flan-dev-pause-fallback.sock")
(dotimes [i 4000]
(agent/wait 5)
(set ticks (step)))
0)