; Regenerate using dune build @gendune --auto-promote

(include dune.inc)

(rule
 (alias gendune)
 (deps
  (source_tree .))
 (target dune.inc.gen)
 (action
  (with-stdout-to
   dune.inc.gen
   (run ./gen_dune.exe))))

(rule
 (alias gendune)
 (action
  (diff dune.inc dune.inc.gen)))

(executable
 (name gen_dune)
 (libraries liquidsoap_build_tools)
 (modules gen_dune))

(rule
 (alias citest)
 (package liquidsoap)
 (deps
  ../../src/bin/liquidsoap.exe
  (package liquidsoap)
  (:stdlib ../../src/libs/stdlib.liq)
  (:run_test ../run_test.exe))
 (action
  (run
   %{run_test}
   "server port"
   liquidsoap
   --check
   "harbor.http.register.simple(port=2000,method=\"GET\",\"/foo\",(fun (_) -> \"test\"))")))

(rule
 (alias citest)
 (package liquidsoap)
 (deps
  ../../src/bin/liquidsoap.exe
  (package liquidsoap)
  (:stdlib ../../src/libs/stdlib.liq)
  (:run_test ../run_test.exe))
 (action
  (pipe-stdout
   (echo "print(123)")
   (run %{run_test} "stdin script" liquidsoap --check "-"))))

(rule
 (alias citest)
 (package liquidsoap)
 (target theora-test.mp4)
 (action
  (run
   ffmpeg
   -f
   lavfi
   -i
   testsrc=duration=10:size=1280x720:rate=30
   -f
   lavfi
   -i
   "sine=frequency=1000:duration=10"
   %{target})))
