;;;; A program that does call (agent/start ...) — but only after something ;;;; slow, which is the shape a real one has. ;;;; ;;;; sand.flan opens a window first and starts the agent afterwards, so on a ;;;; machine where window setup takes a while the socket appears seconds into ;;;; the run. [merged_serve] used to wait up to ten seconds for that socket ;;;; *before* starting its accept loop, so those seconds were charged to the ;;;; first thing the editor asked, every session. This fixture is that delay ;;;; with the window taken out: a sleep, then the agent, then an ordinary ;;;; poll loop. ;;;; ;;;; Two claims are checked against it in test_dev.ml: the session answers ;;;; while the sleep is still running, and a redefinition sent during the ;;;; sleep is installed once the program is up. ;;;; ;;;; The socket is no longer late, only the call is. The package's constructor ;;;; binds it before main when a daemon has said where, so the start below ;;;; arrives at an agent that is already listening and is a no-op answering the ;;;; same socket — which is what makes this fixture the double-start case under ;;;; a real daemon as well. (import agent "vendor:agent") (defonce frames i64) (defn step [] i64 7) (defn tick [] i64 (set frames (+ frames 1)) frames) (defn main [] i32 ;; Long enough for a test to connect, ask something and evaluate inside it, ;; and short enough that the rest of the test is not waiting on it. (sleep-seconds 3.0) (agent/start "/tmp/flan-dev-lateagent-fallback.sock") ;; dev-chatty.flan's count, for its reason: the test ends the session when ;; it is done, and a program that ran out of frames first would fail for ;; the wrong reason. (dotimes [i 24000] (tick) (agent/wait 1)) 0)