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-successexcept for standard error instead of standard output. and ngl, for big old mono-repos the slay combo is--action-stdout-on-success=swallowplus--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:printto just print it right to Dune's output,swallowto completely ignore it, andmust-be-emptyto enforce that the action printed nothing at all. withmust-be-empty, if the action printed something to standard output, Dune counts that action as failed. the default isprint.--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.automaticmakes dune run an external program to detect changes.manualmeans 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 runningdune promoteafter the build.--build-dir=FILE(absent DUNE_BUILD_DIR env) β the specified build directory._buildif unspecified.--cache=VAL(absent DUNE_CACHE env) β enable or disable the Dune cache. it's one ofdisabled,enabled-except-user-rulesorenabled. default isenabled-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 ofauto,hardlinkorcopy. default ishardlink.--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 todune 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. seedune-config(5)for more details. the valid values for this option areprogress,verbose,short,quietortui.--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 ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor 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, orautoto 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 1to avoid interleaving, and you should also use--verboseso 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>.installtarget.-p PACKAGES,--for-release-of-packages=PACKAGES(required) β shorthand for--release --pkg=disabled --only-packages PACKAGE. you must use this option in your<package>.opamfiles, 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 instancedevorrelease. the default isdev.--promote-install-files[=VAL](default=true) β promotes any generated<package>.installfiles 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 adune-projectfile 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 indune-packagemetadata.--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--watchmode. supported modes:preserve,clear-on-rebuild,clear-on-rebuild-and-flush-history.--trace-file=FILEβ outputs trace data in catapult format (compatible withchrome://tracing). π--verboseβ same as--display verbose.--versionβ shows version information.--watch-exclusions=REGEXβ adds a POSIX regular expression that excludes matching directories fromdune build --watch. the option--watch-exclusionscan 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-exclusionsare 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:
0β on success. π1β if an error happened. π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 than0, ANSI colors are supported and should be used whenever the program isn't being piped. If it equals0, pls no ANSI color escape codes πCLICOLOR_FORCEβ if it's different than0, ANSI colors should be enabled no matter what. no vibe check, just color πDUNE_BUILD_DIRβ the build directory you want. defaults to_buildif you don't say anything β¨DUNE_CACHEβ turn Dune cache on or off. pick one ofdisabled,enabled-except-user-rulesorenabled. default isenabled-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 ofauto,hardlinkorcopy. default ishardlinkπΎ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 orautoto auto-detect the number of cores (that's the default, bestie) β‘DUNE_PROFILEβ build profile.devif unspecified, orreleaseif-pis 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 indune-packagemetadata π¦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 β¨
- run all tests in a given directory:
dune runtest path/to/dir/
- run a specific cram test:
dune runtest path/to/mytest.t
- run all tests in the current source tree (including those that passed on the last run):
dune runtest --force
- run tests sequentially without output buffering:
dune runtest --no-buffer -j 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
- ubuntu stonking: ocaml-dune 3.24.1-4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms