Skip to main content


These are the flags/commands under buck2 test and their --help output:

buck test

Build and test the specified targets

Usage: buck2-release test [OPTIONS] [TARGET_PATTERNS]... [-- <TEST_EXECUTOR_ARGS>...]

Patterns to test

Additional arguments passed to the test executor.

Test executor is expected to have `--env` flag to pass environment variables. Can be used
like this:

buck2 test //foo:bar -- --env PRIVATE_KEY=123

--exclude <EXCLUDE>...
Labels on targets to exclude from tests

--include <INCLUDE>...
Labels on targets to include from tests. Prefixing with `!` means to exclude. First match
wins unless overridden by `always-exclude` flag.
If include patterns are present, regardless of whether exclude patterns are present, then
all targets are by default excluded unless explicitly included.

Whether to always exclude if the label appears in `exclude`, regardless of which appears

Whether to build tests that are excluded via labels.

Will allow tests that are compatible with RE (setup to run from the repo root and use
relative paths) to run from RE

Will run tests to on RE even if they are missing required settings (running from the root
+ relative paths). Those required settings just get overridden

--overall-timeout <TIMEOUT>
How long to execute tests for. If the timeout is exceeded, Buck2 will exit as quickly as
possible and not run further tests. In-flight tests will be cancelled. The test
orchestrator will be allowed to shut down gracefully.

The exit code is controlled by the test orchestrator (which normally should report zero
for this).

The format is a concatenation of time spans (separated by spaces). Each time span is an
integer number and a suffix.

Relevant supported suffixes: seconds, second, sec, s, minutes, minute, min, m, hours,
hour, hr, h

For example: `5m 10s`, `500s`.

--test-executor-stdout <TEST_EXECUTOR_STDOUT>
Writes the test executor stdout to the provided path

--test-executor-stdout=- will write to stdout

--test-executor-stdout=FILEPATH will write to the provided filepath, overwriting the
current file if it exists

By default the test executor's stdout stream is captured

Normally testing will follow the `tests` attribute of all targets, to find their
associated tests. When passed, this flag will disable that, and only run the directly
supplied targets

--test-executor-stderr <TEST_EXECUTOR_STDERR>
Writes the test executor stderr to the provided path

--test-executor-stderr=- will write to stderr

--test-executor-stderr=FILEPATH will write to the provided filepath, overwriting the
current file if it exists

By default test executor's stderr stream is captured

--build-report <PATH>
Print a build report

`--build-report=-` will print the build report to stdout `--build-report=<filepath>` will
write the build report to the file

--build-report-options <BUILD_REPORT_OPTIONS>
Comma separated list of build report options.

The following options are supported:

`fill-out-failures`: fill out failures the same way Buck1 would.

`package-project-relative-paths`: emit the project-relative path of packages for the
targets that were built.

-j, --num-threads <THREADS>
Number of threads to use during execution (default is # cores)

Enable only local execution. Will reject actions that cannot execute locally


Enable only remote execution. Will reject actions that cannot execute remotely

Enable hybrid execution. Will prefer executing actions that can execute locally on the
local host

Enable hybrid execution. Will prefer executing actions that can execute remotely on RE and
will avoid racing local and remote execution

Experimental: Disable all execution

Do not perform remote cache queries or cache writes. If remote execution is enabled, the
RE service might still deduplicate actions, so for e.g. benchmarking, using a random
isolation dir is preferred


Could be used to enable the action cache writes on the RE worker when no_remote_cache is

Process dep files when they are generated (i.e. after running a command that produces dep
files), rather than when they are used (i.e. before re-running a command that previously
produced dep files). Use this when debugging commands that produce dep files. Note that
commands that previously produced dep files will not re-run: only dep files produced
during this command will be eagerly loaded

Uploads every action to the RE service, regardless of whether the action needs to execute
on RE.

This is useful when debugging builds and trying to inspect actions which executed
remotely. It's possible that the action result is cached but the action itself has
expired. In this case, downloading the action itself would fail. Enabling this option
would unconditionally upload all actions, thus you will not hit any expiration issues.

If Buck hits an error, do as little work as possible before exiting.

To illustrate the effect of this flag, consider an invocation of `build :foo :bar`. The
default behavior of buck is to do enough work to get a result for the builds of each of
`:foo` and `:bar`, and no more. This means that buck will continue to complete the build
of `:bar` after the build of `:foo` has failed; however, once one dependency of `:foo` has
failed, other dependencies will be cancelled unless they are needed by `:bar`.

This flag changes the behavior of buck to not wait on `:bar` to complete once `:foo` has
failed. Generally, this flag only has an effect on builds that specify multiple targets.

`--keep-going` changes the behavior of buck to not only wait on `:bar` once one dependency
of `:foo` has failed, but to additionally attempt to build other dependencies of `:foo` if

If Buck hits an error, continue doing as much work as possible before exiting.

See `--fail-fast` for more details.

If target is missing, then skip building instead of throwing error

If target is incompatible with the specified configuration, skip building instead of
throwing error. This does not apply to targets specified with glob patterns `/...` or `:`
which are skipped unconditionally

Materializes inputs for failed actions which ran on RE

-h, --help
Print help (see a summary with '-h')

Target Configuration Options:
--target-platforms <PLATFORM>
Configuration target (one) to use to configure targets

--modifier <VALUE>
A configuration modifier to configure all targets on the command line. This may be a
constraint value target.

Buckconfig Options:
List of config options

--config-file <PATH>
List of config file paths

--fake-host <HOST>
[possible values: default, linux, macos, windows]

--fake-arch <ARCH>
[possible values: default, aarch64, x8664]

--fake-xcode-version <VERSION-BUILD>
Value must be formatted as: version-build (e.g., 14.3.0-14C18 or 14.1-14B47b)

Re-uses any `--config` values (inline or via modefiles) if there's a previous command,
otherwise the flag is ignored.

If there is a previous command and `--reuse-current-config` is set, then the old config is
used, ignoring any overrides.

If there is no previous command but the flag was set, then the flag is ignored, the
command behaves as if the flag was not set at all.

Used for exiting a concurrent command when a different state is detected

--preemptible <PREEMPTIBLE>
Used to configure when this command could be preempted by another command

[possible values: never, always, ondifferentstate]

Starlark Options:
Disable runtime type checking in Starlark interpreter.

This option is not stable, and can be used only locally to diagnose evaluation performance

Record or show target call stacks.

Starlark call stacks will be included in duplicate targets error.

If a command outputs targets (like `targets` command), starlark call stacks will be
printed after the targets.

Console Options:
--console <super|simple|...>
Which console to use for this command

[default: auto]
[possible values: simple, simplenotty, simpletty, super, auto, none]

--ui <UI>...
Configure additional superconsole ui components.

Accepts a comma-separated list of superconsole components to add. Possible values are:

dice - shows information about evaluated dice nodes debugevents - shows information about
the flow of events from buckd

These components can be turned on/off interactively. Press 'h' for help when superconsole
is active.

Possible values:
- dice
- debugevents
- io: I/O panel
- re: RE panel

Disable console interactions


Event Log Options:
--event-log <PATH>
Write events to this log file

--write-build-id <PATH>
Write command invocation id into this file

--unstable-write-invocation-record <PATH>
Write the invocation record (as JSON) to this path. No guarantees whatsoever are made
regarding the stability of the format

Universal Options:
-v, --verbose <VERBOSITY>
How verbose buck should be while logging.

Values: 0 = Quiet, errors only; 1 = Show status. Default; 2 = more info about errors; 3 =
more info about everything; 4 = more info about everything + stderr;

It can be combined with specific log items (stderr, full_failed_command, commands,
actions, status, stats, success) to fine-tune the verbosity of the log. Example usage

[default: 1]

--oncall <ONCALL>
The oncall executing this command

--client-metadata <CLIENT_METADATA>
Metadata key-value pairs to inject into Buck2's logging. Client metadata must be of the
form `key=value`, where `key` is a snake_case identifier, and will be sent to backend