From e03d15ff691b647fc177bc554454ec2cc6ee1b98 Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tomas.krizek@nic.cz>
Date: Fri, 15 Feb 2019 10:55:06 +0100
Subject: [PATCH] meson: change extra_tests to postinstall_tests (incl config
 tests)

---
 doc/build.rst     |  2 +-
 meson.build       | 46 +++++++++++++++-------------------------------
 meson_options.txt | 12 ++++++------
 tests/meson.build | 11 +++++++----
 4 files changed, 29 insertions(+), 42 deletions(-)

diff --git a/doc/build.rst b/doc/build.rst
index f1ef4ed15..c50474133 100644
--- a/doc/build.rst
+++ b/doc/build.rst
@@ -166,7 +166,7 @@ To run in-tree tests:
    $ meson test --no-suite postinstall -C build_dev
 
 More comprehensive tests require you to install kresd before running the test
-suite.  To run all available tests (also see ``extra_tests`` build option),
+suite.  To run all available tests (see ``postinstall_tests`` build option),
 use:
 
 .. code-block:: bash
diff --git a/meson.build b/meson.build
index e715e419d..a694d956a 100644
--- a/meson.build
+++ b/meson.build
@@ -71,11 +71,9 @@ else
   install_root_hints = false
 endif
 
-## Verbose log
+## Additional options
 opt_verbose_log = get_option('verbose_log')
 verbose_log = opt_verbose_log.enabled() or opt_verbose_log.auto()
-
-## User/Group
 user = get_option('user')
 group = get_option('group')
 
@@ -116,20 +114,6 @@ integr_tests = [
 ]
 
 
-# Tarball
-## NOTE "dist" target is explicitly not supported for two reasons
-##   1) we use meson test to run integration / postinstall tests
-##   2) we want custom version number, not the hard-coded string in project()
-## Use "archive" target instead
-run_target(
-  'archive',
-  command: [
-    'scripts/make-archive.sh',
-    meson.project_version(),
-  ],
-)
-
-
 # kresconfig.h
 conf_data = configuration_data()
 conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
@@ -186,13 +170,13 @@ endif
 # Summary message
 # NOTE: ternary operator in format() not supported
 # https://github.com/mesonbuild/meson/issues/2404
-summary_managed_ta = managed_ta ? 'enabled' : 'disabled'
-summary_systemd_socket = libsystemd.found() ? 'enabled' : 'disabled'
-summary_build_client = build_client ? 'enabled' : 'disabled'
-summary_build_doc = build_doc ? 'enabled' : 'disabled'
-summary_build_extra_tests = build_extra_tests ? 'enabled' : 'disabled'
-summary_build_unit_tests = build_unit_tests ? 'enabled' : 'disabled'
-summary_install_kresd_conf = install_kresd_conf ? 'enabled' : 'disabled'
+s_managed_ta = managed_ta ? 'enabled' : 'disabled'
+s_systemd_socket = libsystemd.found() ? 'enabled' : 'disabled'
+s_build_client = build_client ? 'enabled' : 'disabled'
+s_build_doc = build_doc ? 'enabled' : 'disabled'
+s_build_postinstall_tests = build_postinstall_tests ? 'enabled' : 'disabled'
+s_build_unit_tests = build_unit_tests ? 'enabled' : 'disabled'
+s_install_kresd_conf = install_kresd_conf ? 'enabled' : 'disabled'
 message('''
 
 ======================= SUMMARY =======================
@@ -206,23 +190,23 @@ message('''
 
   trust_anchors
     keyfile_default:    @0@'''.format(keyfile_default) + '''
-    managed_ta:         @0@'''.format(summary_managed_ta) + '''
+    managed_ta:         @0@'''.format(s_managed_ta) + '''
 
   systemd:
-    socket activation:  @0@'''.format(summary_systemd_socket) + '''
+    socket activation:  @0@'''.format(s_systemd_socket) + '''
     unit_files:         @0@'''.format(systemd_unit_files) + '''
     work_dir:           @0@'''.format(systemd_work_dir) + '''
 
   optional components
-    client:             @0@'''.format(summary_build_client) + '''
-    doc:                @0@'''.format(summary_build_doc) + '''
-    extra_tests:        @0@'''.format(summary_build_extra_tests) + '''
-    unit_tests:         @0@'''.format(summary_build_unit_tests) + '''
+    client:             @0@'''.format(s_build_client) + '''
+    doc:                @0@'''.format(s_build_doc) + '''
+    unit_tests:         @0@'''.format(s_build_unit_tests) + '''
+    postinstall_tests:  @0@'''.format(s_build_postinstall_tests) + '''
 
   additional
     user:               @0@'''.format(user) + '''
     group:              @0@'''.format(group) + '''
-    install_kresd_conf: @0@'''.format(summary_install_kresd_conf) + '''
+    install_kresd_conf: @0@'''.format(s_install_kresd_conf) + '''
 
 =======================================================
 
diff --git a/meson_options.txt b/meson_options.txt
index 3476f3b8f..f5fa093bf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -67,33 +67,33 @@ option(
   'bench',
   type: 'feature',
   value: 'disabled',
-  description: 'build benchmarks'
+  description: 'build benchmarks',
 )
 
 option(
   'client',
   type: 'feature',
   value: 'auto',
-  description: 'build kresc client binary'
+  description: 'build kresc client binary',
 )
 
 option(
   'doc',
   type: 'feature',
   value: 'disabled',
-  description: 'build html documentation'
+  description: 'build html documentation',
 )
 
 option(
-  'extra_tests',
+  'postinstall_tests',
   type: 'feature',
   value: 'disabled',
-  description: 'integration tests with extra dependencies'
+  description: 'postinstall tests with extra dependencies',
 )
 
 option(
   'unit_tests',
   type: 'feature',
   value: 'auto',
-  description: 'cmocka unit tests'
+  description: 'cmocka unit tests',
 )
diff --git a/tests/meson.build b/tests/meson.build
index e3ddb7bda..e57735b60 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,5 +1,6 @@
 # tests
 
+## unit tests
 build_unit_tests = false
 if not get_option('unit_tests').disabled()
   message('--- unit_tests dependencies ---')
@@ -11,11 +12,13 @@ if not get_option('unit_tests').disabled()
   message('-------------------------------')
 endif
 
-subdir('config')
 
-build_extra_tests = get_option('extra_tests').enabled()  # NOTE 'auto' not supported
-if build_extra_tests
-  message('--- extra_tests dependencies ---')
+## postinstall tests
+build_postinstall_tests = get_option('postinstall_tests').enabled()
+if build_postinstall_tests
+  subdir('config')
+
+  message('--- postinstall_tests dependencies ---')
   python3 = find_program('python3')
   py3_deps = []
 
-- 
GitLab