DUNE-TEST(1)
π dune-test β the manual, but make it make sense π
okay bestie, welcome to DUNE-TEST(1) from the Dune Manual. section 1, terminal-core, group-chat-certified. this is part 1 of 2 so don't you dare scroll expecting a goodbye at the bottom, we're just getting started π«Ά
β¨ NAME β¨
dune-test β it's literally just an alias for runtest. that's it. that's the whole name section. iconic of it honestly π
β¨ SYNOPSIS β¨
dune test [OPTION]β¦ [TEST]β¦
β¨ DESCRIPTION β¨
so, dune test is an alias for dune runtest. same energy, different word. they're the same thing, no cap π
want the real tea? run dune runtest --help and read all the details for yourself, because that's where the full story lives.
β¨ OPTIONS β¨
okay here's the part where people usually zone out, but not you, you're built different. stay with me π
--action-stderr-on-success=VALβ same as--action-stdout-on-successbut for standard error instead of standard output. and listen, for big mono-repos a truly great default 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 the standard output of actions when they succeed. the possible values are:printβ just print it to Dune's output.swallowβ completely ignore it.must-be-emptyβ enforce that the action printed nothing. with this one, if the action printed anything at all to its stdout, Dune considers the action failed. π
the default is print.
--build-infoβ show build information. that's the whole vibe.--display-separate-messagesβ puts a blank line between error messages so they don't all mush into one giant wall of doom.--error-reporting=VAL(absent=deterministic) β controls when build errors get reported:earlyβ reports errors the second they're discovered.deterministicβ reports errors at the end of the build in a deterministic order.twiceβ reports each error twice: once immediately when discovered, and then again at the end of the build, in a deterministic order. yes, twice. it's giving dΓ©jΓ vu π
-f,--forceβ force actions tied to aliases to be re-executed even if their dependencies haven't changed. no skipping, we're doing the thing again π₯--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β you notify Dune that files have changed, manually, yourself.
--passive-watch-modeβ like--watch, but it only starts a build when instructed externally by an RPC. it's the chill, wait-to-be-asked version π--sandbox=VAL(absentDUNE_SANDBOXenv) β set the sandboxing mode. heads up: some actions require a certain sandboxing mode, so they'll just ignore this setting. allowed values are:none,symlink,copy,hardlink.--stop-on-first-errorβ stop the build the moment an error shows up. no collecting them all, we're out β-w,--watchβ instead of terminating after the build completes, it just keeps waiting for file changes, forever, like a loyal little gremlin π--wait-for-filesystem-clockβ Dune digests file contents to be better at incremental building. those digests are themselves cached. in some cases Dune needs to drop some digest cache entries for things to be reliable, and this option makes Dune wait for the filesystem clock to advance so it doesn't need to drop anything. real talk: you should probably not care about this option, it's mostly useful for Dune developers to make Dune's tests of the digest cache more reproducible. iykyk π§
β¨ COMMON OPTIONS β¨
these are the options that show up across all the commands, so they're basically the shared friend group π
--always-show-command-lineβ always show the full command lines of programs executed by Dune. no mystery, we see everything.--auto-promoteβ automatically promote files. it's basically like runningdune promoteafter the build, but she does it herself β¨--build-dir=FILE(absentDUNE_BUILD_DIRenv) β specify the build directory. it's_buildif you don't specify one.--cache=VAL(absentDUNE_CACHEenv) β enable or disable the Dune cache. one ofdisabled,enabled-except-user-rulesorenabled. the default isenabled-except-user-rules.--cache-check-probability=VAL(absentDUNE_CACHE_CHECK_PROBABILITYenv) β check build reproducibility by re-executing randomly chosen rules and comparing their results against what's stored in the Dune cache. β οΈ note: bumping up the probability of these checks slows down the build. the default probability is zero, meaning no rules get checked.--cache-storage-mode=VAL(absentDUNE_CACHE_STORAGE_MODEenv) β Dune cache storage mode, one ofauto,hardlinkorcopy. the default ishardlink.--config-file=FILEβ load this configuration file instead of the default one.--debug-backtracesβ always print exception backtraces. when things go wrong we want the FULL story π--debug-dependency-pathβ if there's an error, print the dependency path from the targets on the command line all the way back to the rule that failed.--debug-package-logs(absentDUNE_DEBUG_PACKAGE_LOGSenv) β always print the standard logs when building packages.--default-target=TARGET(absent=@@default) β set the default target used when none is specified todune build.--diff-command=VAL(absentDUNE_DIFF_COMMANDenv) β the shell command used to diff files. use-to disable printing the diff entirely.--disable-promotion(absentDUNE_DISABLE_PROMOTIONenv) β disable all promotion rules.--display=MODEβ control the display mode of Dune. seedune-config(5)for more details. valid values for this option areprogress,verbose,short,quietortui.--dump-gc-stats=FILEβ dump the garbage collector stats into a file once the build is complete.--help[=FMT](default=auto) β show this help in formatFMT.FMTmust be one ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined.--ignore-promoted-rulesβ ignore rules with(mode promote), except ones with(only ...). the variable%{ignoring_promoted_rules}in dune files reflects whether this option was passed or not.--instrument-with=BACKENDS(absentDUNE_INSTRUMENT_WITHenv) β enable instrumentation byBACKENDS.BACKENDSis a comma-separated list of library names, and each one of them must declare an instrumentation backend.-j JOBS(absentDUNE_JOBSenv) β run no more thanJOBScommands simultaneously.JOBSmust 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 bestie, that can be a real problem 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--verboseas well, so you're sure commands get printed before they're executed.--no-configβ do not load the configuration file.--no-print-directoryβ suppress theEntering directorymessages.--only-packages=PACKAGESβ ignore stanzas that refer to a package that isn't inPACKAGES.PACKAGESis 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 in order to build only what's necessary when your project contains multiple packages, and also to get reproducible builds. periodt.--pkg=VALβ enable or disable package management. the default behaviour depends on whether a lock directory exists.--profile=VAL(absentDUNE_PROFILEenv) β select the build profile, for instancedevorrelease. the default isdev.--promote-install-files[=VAL](default=true) β promote any generated<package>.installfiles to the source tree.--releaseβ put dune into a reproducible release mode. 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, because -p implies this option.
--require-dune-project-file[=VAL](default=true) β fail if adune-projectfile is missing.--root=DIR(absentDUNE_ROOTenv) β use this directory as the workspace root instead of guessing it. note that this option doesn't change how targets given on the command line are interpreted. it's only intended for scripts.--store-orig-source-dir(absentDUNE_STORE_ORIG_SOURCE_DIRenv) β store the original source location indune-packagemetadata.--target-exec=TOOLCHAIN=CMD(absentDUNE_TARGET_EXECenv) β wrapper command for running target binaries when cross-compiling. format:TOOLCHAIN=CMD(e.g.,'windows=wine').--terminal-persistence=MODEβ change 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β output trace data in catapult format (compatible withchrome://tracing). shine bright β¨--verboseβ same as--display verbose.--versionβ show version information.--watch-exclusions=REGEXβ adds a POSIX regular expression that will exclude matching directories fromdune build --watch. the option--watch-exclusionscan be repeated to add multiple exclusions, and semicolons can also be used as a separator. if no exclusions are provided, 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(absentDUNE_WORKSPACEenv) β use this specific workspace file instead of looking it up.-x VAL(absentDUNE_CROSS_TARGETenv) β cross-compile using this toolchain.
β¨ MORE HELP β¨
use dune COMMAND --help for help on a single command. one command at a time, we keep it focused π
β¨ EXIT STATUS β¨
dune test exits with:
0β on success. slay π1β if an error happened. π130β if it was interrupted by a signal.
π ENVIRONMENT π
okay bestie, these are the lil environment variables that lowkey control how test behaves when it runs. set them, unset them, whatever β they're the backstage crew of your build π
DUNE_BUILD_DIRβ the build directory you want. if you don't say anything it's just_build, no biggie.DUNE_CACHEβ turns the Dune cache on or off. pick ONE of:disabled,enabled-except-user-rules, orenabled. the default isenabled-except-user-rules. β¨DUNE_CACHE_CHECK_PROBABILITYβ this one makes Dune double-check that your builds are actually reproducible, by re-running randomly chosen rules and comparing what comes out against what's sitting in the Dune cache. β οΈ heads up though: the higher you crank the probability, the slower your build gets. default probability is zero, meaning literally no rules get checked. so by default, none of that is happening.DUNE_CACHE_STORAGE_MODEβ how the Dune cache stores stuff. one ofauto,hardlink, orcopy. default ishardlink. πDUNE_CROSS_TARGETβ cross-compile using this toolchain.DUNE_DEBUG_PACKAGE_LOGSβ always print the standard logs when building packages. yes, always. π«ΆDUNE_DIFF_COMMANDβ the shell command used to diff files. pass-to disable printing the diff entirely.DUNE_DISABLE_PROMOTIONβ kills all promotion rules. gone. bye. πDUNE_INSTRUMENT_WITHβ enable instrumentation viaBACKENDS.BACKENDSis a comma-separated list of library names, and each one of them has to declare an instrumentation backend. no faking it, they gotta actually declare it.DUNE_JOBSβ don't run more thanJOBScommands at the same time.JOBShas to be a positive integer, orautoto auto-detect your number of cores (which is the default, bestie β she auto-detects).DUNE_PROFILEβ the build profile.devif you didn't specify anything, orreleaseif-pis set. π¦DUNE_ROOTβ use this directory as the workspace root instead of Dune going around guessing it. π note: this option does not change how targets given on the command line get interpreted. it's only meant for scripts, iykyk.DUNE_SANDBOXβ the sandboxing mode to use by default. (peep--sandboxfor the deets)DUNE_STORE_ORIG_SOURCE_DIRβ store the original source location indune-packagemetadata.DUNE_TARGET_EXECβ a wrapper command for running target binaries when you're cross-compiling. format:TOOLCHAIN=CMD(e.g.,'windows=wine'). πDUNE_WORKSPACEβ use this specific workspace file instead of Dune going and looking one up.
πΈ BUGS πΈ
found something cursed? π check the bug reports at https://github.com/ocaml/dune/issues β go tell the maintainers, they wanna know.
π SEE ALSO π
dune(1)β the main character herself π
and that's a wrap on the whole page, bestie!! π this was Dune 3.24.1's DUNE-TEST(1) manpage, and yes she ate, no crumbs. go forth and test with confidence. periodt. π
β¨
π¦ 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