See [Configurable Defaults](../ug/configdefs_doc.md) for more information.
ocaml_test Last updated Mar 27, 2025
load("@rules_ocaml//build/_rules:ocaml_test.bzl", "ocaml_test")
ocaml_test(name, data, cc_deps, cc_libs, cc_linkall, cc_linkopts, data_prefix_map, diff_cmd, env, epilogue, exe_name, force_archived_libdeps, main, opts, prologue, runtime, vm_linkage)
OCaml test rule.
CONFIGURABLE DEFAULTS for rule ocaml_test
In addition to the [OCaml configurable defaults](#configdefs) that apply to all
ocaml_*
rules, the following apply to this rule:
| Label | Default | opts
attrib |
| ----- | ------- | ------- |
| @rules_ocaml//cfg/executable:linkall | True | -linkall
, -no-linkall
|
| @rules_ocaml//cfg/executable:threads | False | true: -I +thread
|
| @rules_ocaml//cfg/executable:warnings | @1..3@5..28@30..39@43@46..47@49..57@61..62-40
| -w
plus option value |
NOTE These do not support :enable
, :disable
syntax.
Attributes
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
A unique name for this target. |
required |
|||
Runtime dependencies: list of labels of data files needed by this executable at runtime. |
optional |
[] |
||
Dictionary specifying C/C++ library dependencies. Key: a target label; value: a linkmode string, which determines which file to link. Valid linkmodes: 'default', 'static', 'dynamic', 'shared' (synonym for 'dynamic'). For more information see [CC Dependencies: Linkmode](../ug/cc_deps.md#linkmode). |
optional |
{} |
||
- |
optional |
[] |
||
True: use |
optional |
[] |
||
List of C/C link options. E.g. ["-lstd"]. |
List of strings |
optional |
[] |
|
Map for replacing path prefixes of data files |
optional |
{} |
||
- |
optional |
None |
||
Env variables |
optional |
{} |
||
List of OCaml dependencies to be linked after |
optional |
[] |
||
By default, executable name is derived from 'name' attribute; use this to override. |
String |
optional |
"" |
|
Force archiving of library dependencies |
Boolean |
optional |
False |
|
Label of module containing entry point of executable. In the list of dependencies, this will be placed after 'prologue' deps and before 'epilogue' deps. |
required |
|||
List of compile options; overrides configurable default options. Supports |
List of strings |
optional |
[] |
|
List of OCaml dependencies to be linked before |
optional |
[] |
||
Runtime to use. One of @rules_ocaml//rt:std,
@rules_ocaml//rt:dbg, @rules_ocaml//rt:instrumented; or,
label of an @rules_ocaml//rt:dbg will set |
optional |
"@rules_ocaml//rt:std" |
||
custom, dynamic or static. Custom means link with -custom flag; static with -output-complete-exe |
String |
optional |
"custom" |