Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/63832 )
Change subject: meson: add option to enable or disable tests ......................................................................
meson: add option to enable or disable tests
During development it can be usefull to disable unit testing. Run `meson -Dtests=true` to enable tests. (default) Run `meson -Dtests=false` to disable tests.
Change-Id: I384c904c577b265dfe36bf46bf07c641bc29de9b Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M meson.build M meson_options.txt 2 files changed, 22 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/32/63832/1
diff --git a/meson.build b/meson.build index 7e129da..5b74f8c 100644 --- a/meson.build +++ b/meson.build @@ -495,30 +495,29 @@
subdir('util')
+if get_option('tests') # unit-test framework cmocka_dep = dependency( - 'cmocka', - fallback: ['cmocka', 'cmocka_dep'], - required: false -) -flashrom_test_dep = declare_dependency( - include_directories : include_directories('.'), - sources : [ - srcs, - 'cli_common.c', - 'cli_output.c', - 'flashrom.c', - ], - compile_args : [ - '-includestdlib.h', - '-includeunittest_env.h', - '-includehwaccess_x86_io_unittest.h' - ], - dependencies : [ - deps, - ], -) + 'cmocka', + fallback: ['cmocka', 'cmocka_dep'], + ) + flashrom_test_dep = declare_dependency( + include_directories : include_directories('.'), + sources : [ + srcs, + 'cli_common.c', + 'cli_output.c', + 'flashrom.c', + ], + compile_args : [ + '-includestdlib.h', + '-includeunittest_env.h', + '-includehwaccess_x86_io_unittest.h' + ], + dependencies : [ + deps, + ], + )
-if cmocka_dep.found() subdir('tests') endif diff --git a/meson_options.txt b/meson_options.txt index 8022c74..2347391 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -42,3 +42,4 @@ 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 : 'boolean', value : 'true', description : 'Build and run unit tests')