From 87087ded64366aa821c87d91d35ea7023272808f Mon Sep 17 00:00:00 2001 From: Sam James Date: Sat, 18 Jul 2026 06:32:31 +0100 Subject: [PATCH] meson: improve test handling Tests will now be built at `meson test`-time, so there's no cost if the user isn't going to run them. This is better than guarding on build type, as distros may want to test production builds before shipping. Signed-off-by: Sam James --- meson.build | 5 +---- tests/meson.build | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 4ef81eb..c77265a 100644 --- a/meson.build +++ b/meson.build @@ -317,7 +317,4 @@ if get_option('build_apps') and host_machine.system() != 'windows' subdir('apps') endif -# Optional tests -if get_option('buildtype') == 'debug' - subdir('tests') -endif +subdir('tests') diff --git a/tests/meson.build b/tests/meson.build index be8b084..f66d28a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -4,6 +4,7 @@ test_lib = static_library( objects: libjson.extract_all_objects( recursive: false, ), + build_by_default: false, install: false, ) @@ -65,7 +66,8 @@ foreach t : test_cases name = t[0] expected = t[1] exe = executable(name, name + '.c', - dependencies: test_deps + dependencies: test_deps, + build_by_default: false ) test(name, exe,