(env
 (_
  (env-vars
   (DUNE_CONFIG__BACKGROUND_SANDBOXES disabled)
   (DUNE_CONFIG__BACKGROUND_DIGESTS disabled)
   ; We set ocaml to always be colored since it changes the output of
   ; ocamlc error messages. See https://github.com/ocaml/ocaml/issues/14144
   (OCAML_COLOR always))
  (binaries
   ../utils/dune_cmd.exe
   ../utils/dunepp.exe
   ../utils/melc_stdlib_prefix.exe
   ../utils/refmt.exe
   ../utils/curl
   ../utils/sherlodoc.exe
   ../utils/ocaml_index.exe)))

(cram
 (applies_to pp-cwd)
 (deps %{bin:dunepp}))

(cram
 (applies_to :whole_subtree)
 (deps
  (env_var OCAML_COLOR)
  %{bin:dune_cmd}
  (package dune))
 ; Tests shouldn't take longer than 60s
 (timeout 60))

(cram
 (applies_to meta-template-version-bug version-corruption)
 (deps ./git-helpers.sh))

(cram
 (applies_to windows-diff github6644)
 (alias runtest-windows))

;; DISABLED TESTS

(subdir
 env
 (cram
  (applies_to envs-and-contexts)
  (enabled_if false)))

(cram
 (applies_to fdo)
 (enabled_if false))

;; This test copies a large file, which is too slow to be enabled all the time.
;; The source file is actually sparse, but sendfile seems to do a full copy
;; nevertheless.

(cram
 (applies_to sendfile-large-file)
 (enabled_if false))

;; This test is flaky

(cram
 (applies_to tests-locks)
 (enabled_if false))

;; The following test is flaky due to platform sensitivity
;; see https://github.com/ocaml/dune/issues/3744

(subdir
 cram
 (cram
  (applies_to error)
  (enabled_if false)))

;; CONDITIONALLY DISABLED TESTS

(cram
 (applies_to signal-exit-code)
 (enabled_if
  (and
   (<> %{env:CI=false} true) ;; in github action, CI=true
   (= %{system} macosx))))

(cram
 (applies_to github764)
 (enabled_if
  (<> %{ocaml-config:system} win)))

(cram
 (applies_to output-obj)
 (enabled_if
  (and
   (<> %{ocaml-config:system} macosx)
   (<> %{ocaml-config:system} win))))

(subdir
 cram
 ;; mac has a different sh error message
 (cram
  (applies_to error)
  (enabled_if
   (<> "macosx" %{ocaml-config:system}))))

(subdir
 cram
 (cram
  (applies_to hg-access)
  (enabled_if %{bin-available:hg})))

(cram
 (applies_to link-time-transitive-deps dune-build-info-subdir)
 (deps
  (package dune-build-info)))

(cram
 (applies_to version-corruption)
 (deps %{bin:git} %{bin:chmod})
 (enabled_if
  ;; code signing moves placeholders in the binary
  (or
   (<> %{system} macosx)
   (<> %{architecture} arm64))))

(cram
 (applies_to corrupt-persistent)
 (deps %{bin:truncate}))

(cram
 (applies_to github8041)
 (enabled_if
  (= %{system} linux))
 (deps %{bin:strace} %{bin:head}))

(cram
 (applies_to reason)
 (deps %{bin:refmt}))

(cram
 (applies_to github4194)
 (enabled_if
  (not %{arch_sixtyfour}))
 (deps %{bin:ocaml}))

(cram
 (applies_to hidden-deps-supported)
 (enabled_if
  (>= %{ocaml_version} 5.2.0)))

(cram
 (applies_to hidden-deps-unsupported)
 (enabled_if
  (< %{ocaml_version} 5.2.0)))
