DUNE-RUNTEST(1)

πŸ’… DUNE-RUNTEST β€” run them tests, bestie

ok so this is the manual page for dune-runtest, aka the Dune command that runs your tests. It's giving ✨ build-system-girlie ✨ energy and honestly? iconic.


🌸 NAME

dune-runtest β€” run tests. that's it. that's the whole vibe. 🧚


✨ SYNOPSIS

dune runtest [OPTION]… [TEST]…

πŸ¦‹ DESCRIPTION

So you wanna run some tests? Say less. πŸ’–

You pass it a [TEST] argument, and that argument can be one of two things:

  • A directory πŸ“ β€” if you hand it a directory, dune will recursively run all the tests chilling inside that directory. every last one. it goes and finds them.
  • A file name πŸ“„ β€” if you give it a specific file name, dune runs the tests with that name. just that one.

And if you don't pass a [TEST] at all? No worries, bestie β€” dune just runs all the tests in the current directory and all its subdirectories. go big or go home. πŸ’…

peek the EXAMPLES section further down for more inspo on how to use this πŸ‘€

πŸŽ€ OPTIONS

  • --action-stderr-on-success=VAL β€” literally the same as --action-stdout-on-success except for standard error instead of standard output. and ngl, for big old mono-repos the slay combo is --action-stdout-on-success=swallow plus --action-stderr-on-success=must-be-empty. that way a successful build has a "clean", empty output. chef's kiss. πŸ§‘β€πŸ³πŸ’‹
  • --action-stdout-on-success=VAL β€” tells dune how to handle an action's standard output when the action succeeds. the possible values are: print to just print it right to Dune's output, swallow to completely ignore it, and must-be-empty to enforce that the action printed nothing at all. with must-be-empty, if the action printed something to standard output, Dune counts that action as failed. the default is print.
  • --build-info β€” show build information. simple. πŸ“‹
  • --display-separate-messages β€” separates error messages with a blank line, so they don't all pile up on each other. visual breathing room. 🫢
  • --error-reporting=VAL (absent=deterministic) β€” controls when build errors get reported. early = errors get reported the second they're discovered. deterministic = errors get reported at the end of the build, in a deterministic order. twice = each error gets reported twice: once when it's discovered, and then again at the end of the build in deterministic order. drama queen behavior, we love it. πŸ’…
  • -f, --force β€” forces the actions tied to aliases to be re-executed even if their dependencies haven't changed. like "no babe, run it again anyway." πŸ”₯
  • --file-watcher=VAL (absent=automatic) β€” the mechanism used to detect changes in the source. automatic makes dune run an external program to detect changes. manual means you notify dune that files have changed, by hand. πŸ‘€
  • --passive-watch-mode β€” like --watch, but it only starts a build when it's instructed externally by an RPC. it's waiting for permission, honestly same. πŸ™ˆ
  • --sandbox=VAL (absent DUNE_SANDBOX env) β€” sets the sandboxing mode. heads up: some actions require a certain sandboxing mode, so they'll straight up ignore this setting. the allowed values are: none, symlink, copy, hardlink.
  • --stop-on-first-error β€” stops the build the moment an error is encountered. no more, we're done here. βœ‹
  • -w, --watch β€” instead of terminating the build after completion, it just... keeps waiting, continuously, for file changes. forever girlie. πŸ”
  • --wait-for-filesystem-clock β€” Dune digests file contents for better incrementality, and those digests are themselves cached. sometimes Dune needs to drop some digest cache entries for things to stay reliable. this option makes Dune wait for the file system clock to advance so it doesn't have to drop anything. you probably don't need to care about this one β€” it's mostly for Dune devs to make Dune's tests of the digest cache more reproducible. iykyk. πŸ§ͺ

🌈 COMMON OPTIONS

these ones are common to all commands, so they're basically the whole squad. 🫢

  • --always-show-command-line β€” always show the full command lines of the programs dune executes. no secrets here. πŸ‘‘
  • --auto-promote β€” automatically promotes files. this is similar to running dune promote after the build.
  • --build-dir=FILE (absent DUNE_BUILD_DIR env) β€” the specified build directory. _build if unspecified.
  • --cache=VAL (absent DUNE_CACHE env) β€” enable or disable the Dune cache. it's one of disabled, enabled-except-user-rules or enabled. default is enabled-except-user-rules.
  • --cache-check-probability=VAL (absent DUNE_CACHE_CHECK_PROBABILITY env) β€” checks build reproducibility by re-executing randomly chosen rules and comparing their results with the ones stored in Dune cache. ⚠️ note: by increasing the probability of these checks you slow down the build. the default probability is zero, i.e. no rules are checked.
  • --cache-storage-mode=VAL (absent DUNE_CACHE_STORAGE_MODE env) β€” Dune cache storage mode, one of auto, hardlink or copy. default is hardlink.
  • --config-file=FILE β€” loads this configuration file instead of the default one. ✨
  • --debug-backtraces β€” always print exception backtraces. for when you need the receipts. 🧾
  • --debug-dependency-path β€” in case of error, prints the dependency path from the targets on the command line all the way to the rule that failed. breadcrumb trail of sadness. 😭
  • --debug-package-logs (absent DUNE_DEBUG_PACKAGE_LOGS env) β€” always print the standard logs when building packages.
  • --default-target=TARGET (absent=@@default) β€” sets the default target used when none is specified to dune build.
  • --diff-command=VAL (absent DUNE_DIFF_COMMAND env) β€” the shell command used to diff files. use - to disable printing the diff.
  • --disable-promotion (absent DUNE_DISABLE_PROMOTION env) β€” disables all promotion rules. 🚫
  • --display=MODE β€” controls the display mode of Dune. see dune-config(5) for more details. the valid values for this option are progress, verbose, short, quiet or tui.
  • --dump-gc-stats=FILE β€” dumps the garbage collector stats to a file after the build is complete. πŸ—‘οΈπŸ“Š
  • --help[=FMT] (default=auto) β€” shows this help in format FMT. FMT has to be one of auto, pager, groff or plain. with auto, the format is pager or plain whenever the TERM env var is dumb or undefined.
  • --ignore-promoted-rules β€” ignores rules with (mode promote), except the ones with (only ...). the variable %{ignoring_promoted_rules} in dune files reflects whether this option was passed or not.
  • --instrument-with=BACKENDS (absent DUNE_INSTRUMENT_WITH env) β€” enables instrumentation by BACKENDS. BACKENDS is a comma-separated list of library names, and every one of them must declare an instrumentation backend.
  • -j JOBS (absent DUNE_JOBS env) β€” runs no more than JOBS commands simultaneously. JOBS must be a positive integer, or auto to auto-detect the number of cores (that's the default).
  • --no-buffer β€” do not buffer the output of commands executed by dune. by default dune buffers subcommand output to prevent interleaving when multiple commands run in parallel β€” but that can be a whole issue when you're debugging long running tests. with --no-buffer, commands get direct access to the terminal. ⚠️ note that as a result their output won't be captured in the log file. you should use this option together with -j 1 to avoid interleaving, and you should also use --verbose so that commands are printed before they're actually executed.
  • --no-config β€” do not load the configuration file.
  • --no-print-directory β€” suppresses "Entering directory" messages. we know what dir we're in bestie.
  • --only-packages=PACKAGES β€” ignores stanzas referring to a package that is not in PACKAGES. PACKAGES is a comma-separated list of package names. note that this has the same effect as deleting the relevant stanzas from dune files. it's mostly meant for releases. during development, what you probably want instead is to build a particular <package>.install target.
  • -p PACKAGES, --for-release-of-packages=PACKAGES (required) β€” shorthand for --release --pkg=disabled --only-packages PACKAGE. you must use this option in your <package>.opam files, so that you build only what's necessary when your project contains multiple packages, and so that you get reproducible builds.
  • --pkg=VAL β€” enable or disable package management. the default behaviour depends on whether a lock directory exists.
  • --profile=VAL (absent DUNE_PROFILE env) β€” selects the build profile, for instance dev or release. the default is dev.
  • --promote-install-files[=VAL] (default=true) β€” promotes any generated <package>.install files to the source tree.
  • --release β€” puts dune into a reproducible release mode. it's shorthand for:
--root . --ignore-promoted-rules --no-config --profile release --always-show-command-line --promote-install-files --require-dune-project-file --default-target @install

you should use this option for release builds. for instance, you must use it in your <package>.opam files. except if you already use -p, since -p implies this option.

  • --require-dune-project-file[=VAL] (default=true) β€” fails if a dune-project file is missing.
  • --root=DIR (absent DUNE_ROOT env) β€” uses this directory as the workspace root instead of guessing it. note that this option doesn't change the interpretation of targets given on the command line. it's only intended for scripts. πŸ€–
  • --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env) β€” stores the original source location in dune-package metadata.
  • --target-exec=TOOLCHAIN=CMD (absent DUNE_TARGET_EXEC env) β€” a wrapper command for running target binaries when cross-compiling. format: TOOLCHAIN=CMD (e.g., 'windows=wine').
  • --terminal-persistence=MODE β€” changes how the log of build results is displayed to the console between rebuilds while in --watch mode. supported modes: preserve, clear-on-rebuild, clear-on-rebuild-and-flush-history.
  • --trace-file=FILE β€” outputs trace data in catapult format (compatible with chrome://tracing). πŸ“ˆ
  • --verbose β€” same as --display verbose.
  • --version β€” shows version information.
  • --watch-exclusions=REGEX β€” adds a POSIX regular expression that excludes matching directories from dune build --watch. the option --watch-exclusions can be repeated to add multiple exclusions. semicolons can also be used as a separator. if no exclusions are provided, then a standard set of exclusions is used; however, if one or more --watch-exclusions are used, none of the standard exclusions are used. the standard exclusions are:
^_opam /_opam ^_esy /_esy ^\.#.* /\.#.* ~$ ^#[^#]*#$ /#[^#]*#$ ^4913$ /4913$ /.git /.hg :/windows
  • --workspace=FILE (absent DUNE_WORKSPACE env) β€” uses this specific workspace file instead of looking it up.
  • -x VAL (absent DUNE_CROSS_TARGET env) β€” cross-compiles using this toolchain. πŸ› οΈ

πŸ“– MORE HELP

want help on just one command? run:

dune COMMAND --help

🚦 EXIT STATUS

dune runtest exits with:

  1. 0 β€” on success. πŸŽ‰
  2. 1 β€” if an error happened. 😭
  3. 130 β€” if it was interrupted by a signal. πŸ’€

🌸 ENVIRONMENT 🌸

okay bestie, these env vars are the real main characters behind the scenes β€” they change how runtest behaves before you even lift a finger πŸ’…

  • CLICOLOR β€” if it's anything other than 0, ANSI colors are supported and should be used whenever the program isn't being piped. If it equals 0, pls no ANSI color escape codes πŸŽ€
  • CLICOLOR_FORCE β€” if it's different than 0, ANSI colors should be enabled no matter what. no vibe check, just color 🌈
  • DUNE_BUILD_DIR β€” the build directory you want. defaults to _build if you don't say anything ✨
  • DUNE_CACHE β€” turn Dune cache on or off. pick one of disabled, enabled-except-user-rules or enabled. default is enabled-except-user-rules πŸ¦‹
  • DUNE_CACHE_CHECK_PROBABILITY β€” check build reproducibility by re-executing randomly chosen rules and comparing their results with those stored in Dune cache. ⚠️ note: by increasing the probability of such checks you slow down the build. the default probability is zero, i.e. no rules are checked 😭
  • DUNE_CACHE_ROOT β€” if set, this determines the location of all the different caches used by dune πŸ“
  • DUNE_CACHE_STORAGE_MODE β€” Dune cache storage mode, one of auto, hardlink or copy. default is hardlink πŸ’Ύ
  • DUNE_CROSS_TARGET β€” cross-compile using this toolchain πŸ› οΈ
  • DUNE_DEBUG_PACKAGE_LOGS β€” always print the standard logs when building packages πŸ“œ
  • DUNE_DIFF_COMMAND β€” shell command to use to diff files. use - to disable printing the diff πŸ™ˆ
  • DUNE_DISABLE_PROMOTION β€” disable all promotion rules 🚫
  • DUNE_INSTRUMENT_WITH β€” enable instrumentation by BACKENDS. BACKENDS is a comma-separated list of library names, and every single one of them must declare an instrumentation backend πŸ”¬
  • DUNE_JOBS β€” run no more than JOBS commands simultaneously. JOBS must be a positive integer or auto to auto-detect the number of cores (that's the default, bestie) ⚑
  • DUNE_PROFILE β€” build profile. dev if unspecified, or release if -p is set 🎚️
  • DUNE_ROOT β€” use this directory as workspace root instead of guessing it. note that this option doesn't change the interpretation of targets given on the command line. it's only intended for scripts πŸ‘‘ (it said the quiet part out loud)
  • DUNE_SANDBOX β€” sandboxing mode to use by default. (see --sandbox) πŸ–οΈ
  • DUNE_STORE_ORIG_SOURCE_DIR β€” store original source location in dune-package metadata πŸ“¦
  • DUNE_TARGET_EXEC β€” wrapper command for running target binaries when cross-compiling. Format: TOOLCHAIN=CMD (e.g., 'windows=wine') 🍷
  • DUNE_WORKSPACE β€” use this specific workspace file instead of looking it up πŸ”

πŸ› BUGS πŸ›

found a bug? not the cute kind of bug. check bug reports at https://github.com/ocaml/dune/issues πŸ’€


πŸ‘€ SEE ALSO πŸ‘€


✨ EXAMPLES ✨

  1. run all tests in a given directory:
dune runtest path/to/dir/
  1. run a specific cram test:
dune runtest path/to/mytest.t
  1. run all tests in the current source tree (including those that passed on the last run):
dune runtest --force
  1. run tests sequentially without output buffering:
dune runtest --no-buffer -j 1
  1. run tests in a specific build context:
dune runtest _build/my_context/

and that's the whole page, bestie 🫢 this was Dune 3.24.1 hitting you with DUNE-RUNTEST(1), and you absolutely ate it πŸ’– go forth and runtest, you iconic legend πŸ’…βœ¨

πŸ“¦ where this page comes from