Skip to content
Latchkey

meson test: Run the Test Suite in CI

meson test runs the tests declared with test() in meson.build, in parallel, with per-test timeouts.

Meson has a built-in test runner, so CI does not need ctest or a separate harness. The defaults are CI-friendly once you turn on error log printing.

What it does

meson test executes every test() target, running them in parallel by default and recording results to meson-logs/testlog.txt. Filters select suites or names, --print-errorlogs surfaces failing output inline, and -t scales timeouts for slow runners.

Common usage

Terminal
meson test -C build                        # run all tests
meson test -C build --print-errorlogs      # show output of failures
meson test -C build --suite unit           # run only the unit suite
meson test -C build -t 3 --num-processes 2 # 3x timeout, 2 workers

Options

FlagWhat it does
-C <dir>Build directory containing the tests
--print-errorlogsPrint logs for failed tests
--suite <name>Run only tests in the named suite
--num-processes <N>Parallel test workers
-t <multiplier>Multiply all test timeouts
--repeat <N>Run each test N times (flake hunting)

In CI

Always pass --print-errorlogs so a red build shows why; otherwise failures are silent in the console and only in testlog.txt. Bump -t on slow or shared runners to avoid timeout flakes, and upload meson-logs/testlog.txt as an artifact for post-mortems.

Common errors in CI

"No tests defined." means meson.build declares no test() targets. "Timeout" rows in the log on otherwise-passing tests mean the runner is slower than your timeout; raise it with -t. "ERROR: Test data not found" usually means a missing test dependency that needed to be built first; run meson compile before meson test.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →