diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2021-03-22 01:30:32 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2021-03-22 13:34:13 +0100 |
commit | 15c0d7845740050346f050250d2b74d1f8b4a1bd (patch) | |
tree | 18291a8de32f0ac2aeca9e92bd7e25f4d25ed972 /tests/functional-tests | |
parent | 555634df0b96370c5cf53dd62d8a8ad39f8ed013 (diff) | |
download | tracker-15c0d7845740050346f050250d2b74d1f8b4a1bd.tar.gz |
build: Add meson option to enable TAP protocol in tests
Together with our C tests we have our python functional test framework,
which requires the use of TAPTestRunner from tap.py.
Add a config switch, so that we don't need the python library (or behave
strangely in functional tests without it) in developer setups, and can
enable specifically in CI.
Diffstat (limited to 'tests/functional-tests')
-rw-r--r-- | tests/functional-tests/configuration.json.in | 1 | ||||
-rw-r--r-- | tests/functional-tests/configuration.py | 4 | ||||
-rw-r--r-- | tests/functional-tests/fixtures.py | 14 | ||||
-rw-r--r-- | tests/functional-tests/meson.build | 9 |
4 files changed, 21 insertions, 7 deletions
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 |