summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2021-03-22 12:55:50 +0000
committerSam Thursfield <sam@afuera.me.uk>2021-03-22 12:55:50 +0000
commitca0c150fe7b6e80416d1122fa5c445362b6da718 (patch)
treefa84290cd6a208e3ba5ffd5ac5fab8e08a28b322
parentf26f8eb10ca8a64c322f2a0ed1e2f7c8208ceb73 (diff)
parent597319758068dd2a4626868d2b37ef38123e7f51 (diff)
downloadtracker-ca0c150fe7b6e80416d1122fa5c445362b6da718.tar.gz
Merge branch 'wip/carlosg/optional-tap' into 'master'
Make TAP protocol in tests optional See merge request GNOME/tracker!385
-rw-r--r--.gitlab-ci.yml7
-rw-r--r--meson_options.txt2
-rw-r--r--tests/functional-tests/configuration.json.in1
-rw-r--r--tests/functional-tests/configuration.py4
-rw-r--r--tests/functional-tests/fixtures.py14
-rw-r--r--tests/functional-tests/meson.build9
-rw-r--r--tests/meson.build8
7 files changed, 31 insertions, 14 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8888beea1..05259f6d6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,7 +20,7 @@ stages:
script:
- mkdir build
- cd build
- - meson .. -Db_lto=true -Db_coverage=true -Dsystemd_user_services=false
+ - meson .. -Db_lto=true -Db_coverage=true -Dsystemd_user_services=false -Dtests_tap_protocol=true
- ninja
- |
# Remove the many "CI_" variables from the environment. Meson dumps the
@@ -65,11 +65,6 @@ test-ubuntu-rolling:
test-fedora-rawhide:
image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:rawhide
- before_script:
- - git clone https://github.com/mesonbuild/meson
- - cd meson
- - pip3 install --user .
- - cd ..
<<: *test
coverage-analysis:
diff --git a/meson_options.txt b/meson_options.txt
index fc0810664..99c569502 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -24,3 +24,5 @@ option('test_utils', type: 'boolean', value: true,
description: 'Whether to install the trackertestutils Python package')
option('test_utils_dir', type: 'string', value: '',
description: 'Directory to install trackertestutils Python package (or empty to use the default)')
+option('tests_tap_protocol', type: 'boolean', value: false,
+ description: 'Whether to enable TAP protocol on tests')
diff --git a/tests/functional-tests/configuration.json.in b/tests/functional-tests/configuration.json.in
index ecbea53ca..65f2c0bbe 100644
--- a/tests/functional-tests/configuration.json.in
+++ b/tests/functional-tests/configuration.json.in
@@ -3,5 +3,6 @@
"TEST_ONTOLOGIES_DIR": "@TEST_ONTOLOGIES_DIR@",
"TEST_DBUS_DAEMON_CONFIG_FILE": "@TEST_DBUS_DAEMON_CONFIG_FILE@",
"TEST_PORTAL_FLATPAK_INFO": "@TEST_PORTAL_FLATPAK_INFO@",
+ "TEST_TAP_ENABLED": "@TEST_TAP_ENABLED@",
"TRACKER_VERSION": "@TRACKER_VERSION@"
}
diff --git a/tests/functional-tests/configuration.py b/tests/functional-tests/configuration.py
index cb1bc9a2b..649959888 100644
--- a/tests/functional-tests/configuration.py
+++ b/tests/functional-tests/configuration.py
@@ -53,6 +53,10 @@ def tracker_version():
return config['TRACKER_VERSION']
+def tap_protocol_enabled():
+ return config['TEST_TAP_ENABLED']
+
+
TRACKER_DEBUG_TESTS = 1
def tests_verbose():
diff --git a/tests/functional-tests/fixtures.py b/tests/functional-tests/fixtures.py
index 2e338ed81..1f3fa6baf 100644
--- a/tests/functional-tests/fixtures.py
+++ b/tests/functional-tests/fixtures.py
@@ -65,12 +65,14 @@ def tracker_test_main():
runner = None
- try:
- from tap import TAPTestRunner
- runner = TAPTestRunner()
- runner.set_stream(True)
- except ImportError as e:
- log.info('No TAP test runner found: %s', e)
+ if cfg.tap_protocol_enabled():
+ try:
+ from tap import TAPTestRunner
+ runner = TAPTestRunner()
+ runner.set_stream(True)
+ except ImportError as e:
+ log.error('No TAP test runner found: %s', e)
+ raise
ut.main(testRunner=runner, verbosity=2)
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index 50d47e2ac..70130f65e 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -9,6 +9,7 @@ testconf.set('TEST_ONTOLOGIES_DIR', tracker_uninstalled_nepomuk_ontologies_dir)
testconf.set('TEST_DBUS_DAEMON_CONFIG_FILE', build_root / 'tests' / 'test-bus.conf')
testconf.set('TEST_PORTAL_FLATPAK_INFO', source_root / 'tests' / 'flatpak-info')
testconf.set('TRACKER_VERSION', meson.project_version())
+testconf.set('TEST_TAP_ENABLED', get_option('tests_tap_protocol'))
config_json = configure_file(
input: 'configuration.json.in',
@@ -39,12 +40,18 @@ test_env.prepend('LD_LIBRARY_PATH', tracker_sparql_uninstalled_dir)
test_env.prepend('PYTHONPATH', tracker_uninstalled_testutils_dir)
test_env.set('TRACKER_FUNCTIONAL_TEST_CONFIG', config_json_full_path)
+if get_option('tests_tap_protocol')
+ protocol = 'tap'
+else
+ protocol = 'exitcode'
+endif
+
foreach test_name: functional_tests
file = meson.current_source_dir() / '@0@.py'.format(test_name)
test(test_name, python,
args: [file],
env: test_env,
- protocol: 'tap',
+ protocol: protocol,
suite: ['functional'],
timeout: 60)
endforeach
diff --git a/tests/meson.build b/tests/meson.build
index 5f5855d70..3a543051b 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -15,6 +15,12 @@ subdir('libtracker-sparql')
subdir('functional-tests')
subdir('services')
+if get_option('tests_tap_protocol')
+ protocol = 'tap'
+else
+ protocol = 'exitcode'
+endif
+
foreach t: tests
test_name = t.get('name')
test_exe = t.get('exe')
@@ -32,7 +38,7 @@ foreach t: tests
test(test_name, test_exe,
env: test_env,
timeout: test_timeout,
- protocol: 'tap',
+ protocol: protocol,
suite: test_suite,
is_parallel: test_is_parallel)
endforeach