(executable
 (name fuzz)
 (libraries vaccel nox-protobuf alcobar))

(rule
 (alias runtest)
 (package vaccel)
 (enabled_if
  (<> %{profile} afl))
 (deps fuzz.exe)
 (action
  ; --timeout 60 keeps the once-run scale driver's heavy iteration from
  ; tripping the default 2s per-iteration alarm on a slow CI host.
  (run %{exe:fuzz.exe} --timeout 60)))

(rule
 (alias fuzz)
 (package vaccel)
 (enabled_if
  (= %{profile} afl))
 (deps fuzz.exe)
 (action
  (progn
   (run %{exe:fuzz.exe} --gen-corpus corpus)
   (run afl-fuzz -V 60 -i corpus -o _fuzz -- %{exe:fuzz.exe} @@))))
