(cram
 (alias pkg)
 (applies_to :whole_subtree))

(env
 (_
  (env-vars
   (DUNE_DEBUG_PACKAGE_LOGS 1))))

(rule
 (alias runtest)
 (deps helpers.sh)
 (action
  (run %{bin:bash} -n %{deps})))

;; this file has too many problems. enable this rule once they're fixed

(rule
 (alias runtest)
 (enabled_if %{bin-available:shellcheck})
 (deps helpers.sh)
 (action
  (run %{bin:shellcheck} -s bash %{deps})))

(cram
 (deps %{bin:git})
 (setup_scripts helpers.sh)
 (applies_to :whole_subtree))

(cram
 (applies_to autolock-with-watch-server))

(cram
 (deps %{bin:patch})
 (applies_to patch opam-package-with-patch extra-sources))

(cram
 (applies_to rev-store-lock-linux)
 (enabled_if
  (= %{system} linux))
 (deps %{bin:strace}))

(cram
 (deps %{bin:awk} %{bin:cmp})
 (applies_to git-repo))

(cram
 (deps ../../utils/fakegit.sh)
 (applies_to opam-source-conversion))

(cram
 (deps %{bin:make})
 (applies_to make))

(cram
 (deps %{bin:which})
 (applies_to pkg-deps))

(cram
 (deps %{bin:curl})
 (applies_to
  unavailable-source-package
  compute-checksums-when-missing
  e2e
  ocamlformat-dev-tool
  source-caching
  tarball
  pin-depends
  extra-sources
  broken-symlink-in-dependency))

(cram
 (deps %{bin:md5sum})
 (applies_to
  source-caching
  extra-sources
  ocamlformat-dev-tool
  dev-tool-conflict-test
  broken-symlink-in-dependency))

(cram
 (deps %{bin:tar})
 (applies_to
  source-caching
  tarball
  pin-depends
  extra-sources
  pkg-extract-fail
  broken-symlink-in-dependency))

(cram
 (deps %{bin:ocaml_index})
 (applies_to gh10985))

(cram
 (deps %{bin:unzip})
 (applies_to pkg-extract-fail))

(cram
 (applies_to build-action-path build-with-executable-script)
 (alias runtest-windows))

(cram
 (applies_to build-with-executable-script-on-windows)
 (enabled_if
  (= %{os_type} Win32))
 (alias runtest-windows))

;; disabled for flakiness

(cram
 (enabled_if false)
 (applies_to gh10959))
