From f8dce0072e9be59c412a8b166bfcca5bbcc0f88a Mon Sep 17 00:00:00 2001 From: Fred Morcos Date: Mon, 4 Mar 2024 14:51:56 +0100 Subject: [PATCH] Meson: Fix remotebackend tests and add unit-tests-verbose option --- meson.build | 21 ++++++++++++---- meson_options.txt | 1 + modules/remotebackend/meson.build | 40 +++++++++---------------------- 3 files changed, 28 insertions(+), 34 deletions(-) diff --git a/meson.build b/meson.build index e490344da7..5389d151b6 100644 --- a/meson.build +++ b/meson.build @@ -775,11 +775,12 @@ endif if get_option('unit-tests-backends') libpdns_module_remotebackend_test_common = declare_dependency( - link_with: static_library( + link_whole: static_library( 'pdns-test-remotebackend', module_remotebackend_test_sources_common, dependencies: [ deps, + module_remotebackend_lib, libpdns_signers_pkcs11, libpdns_common, libpdns_dnslabeltext, @@ -790,14 +791,16 @@ if get_option('unit-tests-backends') env = { 'BOOST_TEST_LOG_LEVEL': 'message', - 'REMOTEBACKEND_ZEROMQ': get_option('module-remote-zeromq') ? '1' : '0', + 'REMOTEBACKEND_ZEROMQ': get_option('module-remote-zeromq') ? 'yes' : 'no', } + verbose = get_option('unit-tests-verbose') + foreach test_binary, test_source: module_remotebackend_test_sources_binaries - var_name = test_binary.underscorify() + exec_var_name = test_binary.underscorify() set_variable( - var_name, + exec_var_name, executable( test_binary, test_source, @@ -810,6 +813,14 @@ if get_option('unit-tests-backends') ) ) - test('PDNS Auth ' + test_binary, get_variable(var_name), verbose: true, env: env) + test( + 'pdns-auth-' + test_binary, + module_remotebackend_testrunner, + args: get_variable(exec_var_name).full_path(), + verbose: verbose, + env: env, + workdir: product_source_dir / fs.parent(module_remotebackend_testrunner), + is_parallel: false, + ) endforeach endif diff --git a/meson_options.txt b/meson_options.txt index 64d5dc8d2c..61966b6946 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,6 +14,7 @@ option('dns-over-tls', type: 'boolean', value: false, description: 'DNS over TLS option('ipcipher', type: 'feature', value: 'auto', description: 'IPcipher (requires libcrypto)') option('unit-tests', type: 'boolean', value: false, description: 'Build and run unit tests') option('unit-tests-backends', type: 'boolean', value: false, description: 'Build and run backend unit tests') +option('unit-tests-verbose', type: 'boolean', value: false, description: 'Print more unit test information') option('reproducible', type: 'boolean', value: false, description: 'Reproducible builds (for distro maintainers, makes debugging difficult)') option('fuzz-targets', type: 'boolean', value: false, description: 'Enable fuzzing targets') option('verbose-logging', type: 'boolean', value: false, description: 'Enable verbose logging') diff --git a/modules/remotebackend/meson.build b/modules/remotebackend/meson.build index 8704a241c3..2b124f81cb 100644 --- a/modules/remotebackend/meson.build +++ b/modules/remotebackend/meson.build @@ -1,29 +1,14 @@ -sources = [ +sources = files( 'httpconnector.cc', 'pipeconnector.cc', 'remotebackend.cc', 'unixconnector.cc', 'zmqconnector.cc', -] +) -extras = [ - 'testrunner.sh', - 'unittest_http.rb', - 'unittest_json.rb', - 'unittest_pipe.rb', - 'unittest_zeromq.rb', - 'unittest_post.rb', - 'unittest.rb', - 'Gemfile', - 'Gemfile.lock', - # 'remotebackend_pipe.test', - # 'remotebackend_unix.test', - # 'remotebackend_http.test', - # 'remotebackend_post.test', - # 'remotebackend_json.test', - # 'remotebackend_zeromq.test', +extras = files( 'remotebackend.hh', -] +) module_deps = [deps, dep_zeromq] @@ -44,14 +29,11 @@ else endif if get_option('unit-tests-backends') + module_remotebackend_lib = declare_dependency(link_whole: lib) + module_remotebackend_testrunner = files('testrunner.sh')[0] + module_remotebackend_test_sources_common = files( - 'httpconnector.cc', - 'pipeconnector.cc', - 'remotebackend.cc', - 'unixconnector.cc', - 'zmqconnector.cc', 'test-remotebackend.cc', - 'remotebackend.hh', 'test-remotebackend-keys.hh', ) @@ -65,14 +47,14 @@ if get_option('unit-tests-backends') } module_remotebackend_test_sources_extra = files( - 'testrunner.sh', + 'example.rb', + 'Gemfile', + 'Gemfile.lock', 'unittest_http.rb', 'unittest_json.rb', 'unittest_pipe.rb', - 'unittest_zeromq.rb', 'unittest_post.rb', 'unittest.rb', - 'Gemfile', - 'Gemfile.lock', + 'unittest_zeromq.rb', ) endif -- 2.47.2