flan/test/test_cider.ml
Joseph Ferano 3ace7c262f A hang is a failure the suite never reported
The mutation pass turned up one defect that did not make the suite go
red: a reader branch that forgets to advance reads the same character
for ever, and dune test waits as long as it is left to. In CI that is a
job killed by the runner with nothing named and no output to read.

watchdog.ml puts an alarm on every test binary — generous, because an
alarm that fires on a slow machine is a flake — and a five-second one
around each read in test_flan, where the budget really is small. The
first read that does not return wedges the rest, so a looping reader
costs five seconds and names the row instead of costing eight minutes
or never finishing. Both were watched: the string-escape loop now fails
in five seconds with the case named, and the per-binary backstop was
armed short and observed to fire.
2026-09-12 10:49:07 +07:00

31 lines
1.3 KiB
OCaml

(* The inspector and the break buffer, driven from fixtures.
Unlike test_emacs.ml there is no daemon and no running program behind this,
and that is the point rather than a shortcut. Both buffers are functions
from a reply's data to text with properties on it, and every interesting way
they can be wrong is on that side: a struct the reader mis-parses, a
shadowed restart drawn as though it could be taken, a section quietly
omitted where it should have been refused. Fixtures also reach the states a
live program is hard to hold still in — a value past the renderer's depth
bound, two restarts sharing a name, a frame with locals in it at all.
Skipped, not failed, where there is no emacs: the compiler does not depend
on one. *)
(* The watchdog first: a hang is the one failure mode that reports
nothing at all. See watchdog.ml. *)
let () = Watchdog.arm ~seconds:600 "test_cider"
let () =
if Sys.command "command -v emacs > /dev/null 2>&1" <> 0 then
print_endline "cider: skipped (no emacs on PATH)"
else
let code =
Sys.command
"emacs -Q --batch -L ../../../emacs -l ../../../emacs/test-flan-cider.el 2>&1"
in
if code = 0 then print_endline "cider: all tests passed"
else begin
Printf.printf "\nthe inspector/break buffer tests exited %d\n" code;
exit 1
end