1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 14:11:15 +02:00

meson: add option to disable tests

During development it can be useful to disable unit testing. By default
tests are built if cmocka is found. To force enable tests run `meson
build -Dtests=enable`. To disable tests run `meson build
-Dtests=disabled`.

Change-Id: I384c904c577b265dfe36bf46bf07c641bc29de9b
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/63832
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
Thomas Heijligen
2022-04-25 19:22:44 +02:00
committed by Thomas Heijligen
parent b0aec45d8c
commit 400a6a8b2c
2 changed files with 29 additions and 23 deletions

View File

@ -506,12 +506,16 @@ executable(
subdir('util')
# Use `.auto() or .enabled()` instead of `.allowed()` to keep the minimum meson version as low as possible.
# `.allowed()` gets introduced in 0.59.0
if get_option('tests').auto() or get_option('tests').enabled()
# unit-test framework
cmocka_dep = dependency(
'cmocka',
fallback: ['cmocka', 'cmocka_dep'],
required: false
required : get_option('tests')
)
flashrom_test_dep = declare_dependency(
include_directories : include_dir,
sources : [
@ -533,3 +537,4 @@ flashrom_test_dep = declare_dependency(
if cmocka_dep.found()
subdir('tests')
endif
endif

View File

@ -42,3 +42,4 @@ option('config_stlinkv3_spi', type : 'boolean', value : true, description : 'STM
option('config_lspcon_i2c_spi', type : 'boolean', value : false, description : 'Parade lspcon USB-C to HDMI protocol translator')
option('config_mediatek_i2c_spi', type : 'boolean', value : false, description : 'MediaTek LCD controller')
option('config_realtek_mst_i2c_spi', type : 'boolean', value : true, description : 'Realtek MultiStream Transport MST')
option('tests', type : 'feature', value : 'auto', description : 'Build unit tests')