add_test_setup()

Add a custom test setup. This setup can be used to run the tests with a custom setup, for example under Valgrind.

To use the test setup, run meson test --setup=*name* inside the build dir.

Note that all these options are also available while running the meson test script for running tests instead of ninja test or msbuild RUN_TESTS.vcxproj, etc depending on the backend.

Signature

# Add a custom test setup
void add_test_setup(
  str name,     # The name of the test setup

  # Keyword arguments:
  env                : env | array[str] | dict[str]   # environment variables to set
  exclude_suites     : array[str]                     # An array of test suites that should be excluded when using this setup
  exe_wrapper        : array[str | external_program]  # The command or script followed by the arguments to it
  gdb                : bool                           # If `true`, the tests are also run under `gdb`
  is_default         : bool                           # Set whether this is the default test setup
  timeout_multiplier : int                            # A number to multiply the test timeout with
)

Arguments

The function add_test_setup() accepts the following positional arguments:

Name Type Description Tags
name str

The name of the test setup

Finally, add_test_setup() accepts the following keyword arguments:

Name Type Description Tags
env env | array[str] | dict[str]

environment variables to set , such as ['NAME1=value1', 'NAME2=value2'], or an env object which allows more sophisticated environment juggling. (Since 0.52.0) A dictionary is also accepted.

exclude_suites array[str]

An array of test suites that should be excluded when using this setup. Suites specified in the --suite option to meson test will always run, overriding add_test_setup if necessary.

(since 0.57.0)

exe_wrapper array[str | external_program]

The command or script followed by the arguments to it

gdb bool

If true, the tests are also run under gdb

default = false

is_default bool

Set whether this is the default test setup. If true, the setup will be used whenever meson test is run without the --setup option.

(since 0.49.0)

default = false

timeout_multiplier int

A number to multiply the test timeout with. Since 0.57 if timeout_multiplier is <= 0 the test has infinite duration, in previous versions of Meson the test would fail with a timeout immediately.

default = 1

The results of the search are