]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Build remotebackend tests
authorFred Morcos <fred.morcos@open-xchange.com>
Tue, 6 Feb 2024 15:33:19 +0000 (16:33 +0100)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 16:12:01 +0000 (17:12 +0100)
meson.build
modules/remotebackend/meson.build

index fbc9d9451933277da275be7cd97348517f453668..f3f1414141c378b5a38981d0da367e5d47f06849 100644 (file)
@@ -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
index 88d11777420b8adbe70510acd39de55484813cc2..8704a241c3651a050a1196650e8772ba5e1e6fe6 100644 (file)
@@ -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