]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Fix remotebackend tests and add unit-tests-verbose option
authorFred Morcos <fred.morcos@open-xchange.com>
Mon, 4 Mar 2024 13:51:56 +0000 (14:51 +0100)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 16:12:02 +0000 (17:12 +0100)
meson.build
meson_options.txt
modules/remotebackend/meson.build

index e490344da72cc07cee8f726c9d393207029b7fbf..5389d151b6fca463a92171085a6cf4a84c5ef435 100644 (file)
@@ -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
index 64d5dc8d2c8af806512abe0f234b0720ba9af734..61966b69467ece8a77d2b43566fef9110319dd57 100644 (file)
@@ -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')
index 8704a241c3651a050a1196650e8772ba5e1e6fe6..2b124f81cb395a56dd54a6de11932d6110b2d3ec 100644 (file)
@@ -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