From: Fred Morcos Date: Tue, 6 Feb 2024 15:33:19 +0000 (+0100) Subject: Meson: Build remotebackend tests X-Git-Tag: rec-5.1.0-alpha1~80^2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68bf2d105a62b157bb881bff67bc267e1b26ea70;p=thirdparty%2Fpdns.git Meson: Build remotebackend tests --- diff --git a/meson.build b/meson.build index fbc9d94519..f3f1414141 100644 --- a/meson.build +++ b/meson.build @@ -753,3 +753,45 @@ foreach tool, info: tools ) ) endforeach + +if get_option('unit-tests') + test('PDNS Auth Testrunner', pdns_auth_testrunner, verbose: true) +endif + +if get_option('unit-tests-backends') + libpdns_module_remotebackend_test_common = static_library( + 'pdns-test-remotebackend', + module_remotebackend_test_sources_common, + link_with: [libpdns_common, libpdns_dnslabeltext], + dependencies: [ + deps, + libpdns_signers_pkcs11, + ], + extra_files: module_remotebackend_test_sources_extra, + ) + + env = { + 'BOOST_TEST_LOG_LEVEL': 'message', + 'REMOTEBACKEND_ZEROMQ': get_option('module-remote-zeromq') ? '1' : '0', + } + + foreach test_binary, test_source: module_remotebackend_test_sources_binaries + var_name = test_binary.underscorify() + + set_variable( + var_name, + executable( + test_binary, + test_source, + dependencies: [ + deps, + dep_boost_test, + dep_zeromq, + libpdns_module_remotebackend_test_common, + ], + ) + ) + + test('PDNS Auth ' + test_binary, get_variable(var_name), verbose: true, env: env) + endforeach +endif diff --git a/modules/remotebackend/meson.build b/modules/remotebackend/meson.build index 88d1177742..8704a241c3 100644 --- a/modules/remotebackend/meson.build +++ b/modules/remotebackend/meson.build @@ -44,86 +44,35 @@ else endif if get_option('unit-tests-backends') - libpdns_test_remotebackend = declare_dependency( - link_with: static_library( - 'pdns-test-remotebackend', - sources: [ - 'httpconnector.cc', - 'pipeconnector.cc', - 'remotebackend.cc', - 'unixconnector.cc', - 'zmqconnector.cc', - 'test-remotebackend.cc', - ], - extra_files: ['remotebackend.hh'], - dependencies: [ - deps, - libpdns_dnslabeltext, - libpdns_signers_pkcs11, - - source_deps_cache['arguments.cc'], - source_deps_cache['auth-packetcache.cc'], - source_deps_cache['auth-querycache.cc'], - source_deps_cache['auth-zonecache.cc'], - source_deps_cache['base32.cc'], - source_deps_cache['base64.cc'], - source_deps_cache['dns.cc'], - source_deps_cache['dnsbackend.cc'], - source_deps_cache['dnsname.cc'], - source_deps_cache['dnspacket.cc'], - source_deps_cache['dnsparser.cc'], - source_deps_cache['dnsrecords.cc'], - source_deps_cache['dnssecinfra.cc'], - source_deps_cache['dnswriter.cc'], - source_deps_cache['ednscookies.cc'], - source_deps_cache['ednsoptions.cc'], - source_deps_cache['ednssubnet.cc'], - source_deps_cache['gss_context.cc'], - source_deps_cache['iputils.cc'], - source_deps_cache['json.cc'], - source_deps_cache['logger.cc'], - source_deps_cache['misc.cc'], - source_deps_cache['nameserver.cc'], - source_deps_cache['nsecrecords.cc'], - source_deps_cache['qtype.cc'], - source_deps_cache['rcpgenerator.cc'], - source_deps_cache['shuffle.cc'], - source_deps_cache['sillyrecords.cc'], - source_deps_cache['statbag.cc'], - source_deps_cache['svc-records.cc'], - source_deps_cache['ueberbackend.cc'], - source_deps_cache['unix_utility.cc'], - ], - ) + 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', ) - test_binaries = [ - 'test-remotebackend-http', - 'test-remotebackend-json', - 'test-remotebackend-pipe', - 'test-remotebackend-post', - 'test-remotebackend-unix', - 'test-remotebackend-zeromq', - ] - - env = { - 'BOOST_TEST_LOG_LEVEL': 'message', - 'REMOTEBACKEND_ZEROMQ': get_option('module-remote-zeromq') ? '1' : '0', + module_remotebackend_test_sources_binaries = { + 'remotebackend_http.test': files('test-remotebackend-http.cc'), + 'remotebackend_json.test': files('test-remotebackend-json.cc'), + 'remotebackend_pipe.test': files('test-remotebackend-pipe.cc'), + 'remotebackend_post.test': files('test-remotebackend-post.cc'), + 'remotebackend_unix.test': files('test-remotebackend-unix.cc'), + 'remotebackend_zeromq.test': files('test-remotebackend-zeromq.cc'), } - foreach test_binary: test_binaries - name = 'pdns_' + test_binary.underscorify() - - set_variable( - name, - executable( - 'pdns-' + test_binary, - sources: [test_binary + '.cc'], - extra_files: ['test-remotebackend-keys.hh'], - dependencies: [module_deps, libpdns_test_remotebackend, dep_boost_test], - ) - ) - - test('PDNS Auth ' + test_binary, get_variable(name), verbose: true, env: env) - endforeach + module_remotebackend_test_sources_extra = files( + 'testrunner.sh', + 'unittest_http.rb', + 'unittest_json.rb', + 'unittest_pipe.rb', + 'unittest_zeromq.rb', + 'unittest_post.rb', + 'unittest.rb', + 'Gemfile', + 'Gemfile.lock', + ) endif