]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
meson: tests/pytests - add extra_tests build option
authorTomas Krizek <tomas.krizek@nic.cz>
Mon, 4 Feb 2019 18:24:19 +0000 (19:24 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 12 Mar 2019 09:43:22 +0000 (10:43 +0100)
meson_options.txt
tests/integration/meson.build
tests/meson.build
tests/pytests/meson.build

index 5f20ae8ad90643fc44f01b7fe2bcf72257412cdd..5f688c1d437f3c54929761e96e49b7423371ee56 100644 (file)
@@ -1,5 +1,6 @@
 option('client', type : 'boolean', value : true, description: 'kresc client binary')
 option('daemon', type: 'boolean', value: true, description: 'kresd daemon binary')
 option('doc', type: 'boolean', value: false, description: 'html documentation')
+option('extra_tests', type: 'boolean', value: false, description: 'integration tests with extra dependencies')
 option('modules_dir', type: 'string', description: 'path to kres modules directory')
 option('keyfile_default', type: 'string', description: 'path to trust anchors file')
index 3472a3549cb632ff0f9f94ea60665343d34a3ecd..4797fd047abf21f83eaea8ff86673064bbb0d888 100644 (file)
@@ -1,30 +1,35 @@
-prepare_deckard = find_program('../../scripts/test-integration-prepare.sh')
+if get_option('extra_tests')
+  prepare_deckard = find_program('../../scripts/test-integration-prepare.sh')
 
-deckard_contrib = custom_target(
-  'deckard_contrib',
-  command: [
-    prepare_deckard,
-    '@0@'.format(join_paths(meson.current_source_dir())),
-  ],
-  output: 'deckard_contrib',
-  build_always_stale: true,
-)
+  # deckard dependencies
+  cmake = find_program('cmake')  # for libswrapper
 
-deckard_env = environment()
-deckard_env.prepend('PATH', kresd_install_path)
+  deckard_contrib = custom_target(
+    'deckard_contrib',
+    command: [
+      prepare_deckard,
+      '@0@'.format(join_paths(meson.current_source_dir())),
+    ],
+    output: 'deckard_contrib',
+    build_always_stale: true,
+  )
 
-deckard_kresd_run = find_program('deckard/kresd_run.sh')
-test(
-  'integration.deckard',
-  deckard_kresd_run,
-  env: deckard_env,
-  suite: [
-    'postinstall',
-    'integration',
-  ],
-  is_parallel: false,
-  timeout: 180,  # TODO
-  #workdir: join_paths(meson.current_source_dir(), 'deckard'),
-  depends: deckard_contrib,
-  build_by_default: false,
-)
+  deckard_env = environment()
+  deckard_env.prepend('PATH', kresd_install_path)
+
+  deckard_kresd_run = find_program('deckard/kresd_run.sh')
+  test(
+    'integration.deckard',
+    deckard_kresd_run,
+    env: deckard_env,
+    suite: [
+      'postinstall',
+      'integration',
+    ],
+    is_parallel: false,
+    timeout: 180,  # TODO
+    #workdir: join_paths(meson.current_source_dir(), 'deckard'),
+    depends: deckard_contrib,
+    build_by_default: false,
+  )
+endif
index 8b27a2aa31245780fd2117cac4cbd29e9e4ed362..85d204f899e9ba64adf706e8758a9224a202d877 100644 (file)
@@ -1,4 +1,9 @@
 subdir('config')
 subdir('unit')
-subdir('pytests')
-#subdir('integration')
+
+if get_option('extra_tests')
+  python3 = find_program('python3')
+
+  subdir('pytests')
+  #subdir('integration')
+endif
index b3582c9da997ebbff2fe7caaa17e82e941ccdab6..4785af7ea67b388e7b8d094e8e0b0f38dcdf352f 100644 (file)
@@ -3,6 +3,8 @@ tlsproxy_src = [
   'proxy/tls-proxy.c',
 ]
 
+# compile tlsproxy
+# TODO fix or silence compilation warnings
 tlsproxy = executable(
   'tlsproxy',
   tlsproxy_src,
@@ -11,11 +13,24 @@ tlsproxy = executable(
     libuv,
     gnutls,
   ],
-  build_by_default: false,
 )
 
+# pytests dependencies
+pytest = find_program('pytest')
 
-pytest = find_program('pytest', required: false)
+# python 3 dependencies
+pytest_py3_deps = [
+  ['jinja2', 'jinja2'],
+  ['dnspython', 'dns'],
+  ['pytest-html', 'pytest_html'],
+  ['pytest-xdist', 'xdist'],
+]
+foreach py3_dep : pytest_py3_deps
+  py3_import = run_command(python3, '-c', 'import @0@'.format(py3_dep[1]))
+  if py3_import.returncode() != 0
+    error('missing pytests dependency: python3 @0@'.format(py3_dep[0]))
+  endif
+endforeach
 
 pytests_env = environment()
 pytests_env.prepend('PATH', kresd_install_path)