From e4cebc8d4cfdcb474727c0109d4a00ef1d0cc7fe Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 9 Dec 2019 23:23:40 +0100 Subject: [PATCH] Do not build tests in release mode Assertions would not be executed. And as a side effect, it causes "unused variable" warnings. --- app/meson.build | 75 +++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/app/meson.build b/app/meson.build index b3d30458..3bcb9bc1 100644 --- a/app/meson.build +++ b/app/meson.build @@ -141,40 +141,43 @@ install_man('scrcpy.1') ### TESTS -tests = [ - ['test_buffer_util', [ - 'tests/test_buffer_util.c' - ]], - ['test_cbuf', [ - 'tests/test_cbuf.c', - ]], - ['test_cli', [ - 'tests/test_cli.c', - 'src/cli.c', - 'src/util/str_util.c', - ]], - ['test_control_event_serialize', [ - 'tests/test_control_msg_serialize.c', - 'src/control_msg.c', - 'src/util/str_util.c', - ]], - ['test_device_event_deserialize', [ - 'tests/test_device_msg_deserialize.c', - 'src/device_msg.c', - ]], - ['test_queue', [ - 'tests/test_queue.c', - ]], - ['test_strutil', [ - 'tests/test_strutil.c', - 'src/util/str_util.c', - ]], -] +# do not build tests in release (assertions would not be executed at all) +if get_option('buildtype') == 'debug' + tests = [ + ['test_buffer_util', [ + 'tests/test_buffer_util.c' + ]], + ['test_cbuf', [ + 'tests/test_cbuf.c', + ]], + ['test_cli', [ + 'tests/test_cli.c', + 'src/cli.c', + 'src/util/str_util.c', + ]], + ['test_control_event_serialize', [ + 'tests/test_control_msg_serialize.c', + 'src/control_msg.c', + 'src/util/str_util.c', + ]], + ['test_device_event_deserialize', [ + 'tests/test_device_msg_deserialize.c', + 'src/device_msg.c', + ]], + ['test_queue', [ + 'tests/test_queue.c', + ]], + ['test_strutil', [ + 'tests/test_strutil.c', + 'src/util/str_util.c', + ]], + ] -foreach t : tests - exe = executable(t[0], t[1], - include_directories: src_dir, - dependencies: dependencies, - c_args: ['-DSDL_MAIN_HANDLED']) - test(t[0], exe) -endforeach + foreach t : tests + exe = executable(t[0], t[1], + include_directories: src_dir, + dependencies: dependencies, + c_args: ['-DSDL_MAIN_HANDLED']) + test(t[0], exe) + endforeach +endif