[tracker-miners/sam/tracker-debug-tests: 2/2] tests: Remove TRACKER_TESTS_VERBOSE, add TRACKER_DEBUG=tests
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/tracker-debug-tests: 2/2] tests: Remove TRACKER_TESTS_VERBOSE, add TRACKER_DEBUG=tests
- Date: Sun, 21 Jun 2020 12:26:38 +0000 (UTC)
commit 082e1f9ae2336cb5aa225e5eee955a0105dddd6a
Author: Sam Thursfield <sam afuera me uk>
Date: Sun Jun 21 14:03:35 2020 +0200
tests: Remove TRACKER_TESTS_VERBOSE, add TRACKER_DEBUG=tests
This seems cleaner now that we use TRACKER_DEBUG everywhere else.
.gitlab-ci.yml | 2 --
tests/functional-tests/configuration.py | 33 +++++++++++++--------------------
2 files changed, 13 insertions(+), 22 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bbc615404..33ac0627d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,7 +6,6 @@ variables:
# See HACKING.md for more information.
G_MESSAGES_DEBUG: "Tracker"
TRACKER_DEBUG: ""
- TRACKER_TESTS_VERBOSE: "no"
# This can be used when debugging test failures that only occur within GitLab CI.
MESON_TEST_EXTRA_ARGS: ""
@@ -45,7 +44,6 @@ stages:
echo
echo "G_MESSAGES_DEBUG: ${G_MESSAGES_DEBUG}"
echo "TRACKER_DEBUG: ${TRACKER_DEBUG}"
- echo "TRACKER_TESTS_VERBOSE: ${TRACKER_TESTS_VERBOSE}"
echo "MESON_TEST_EXTRA_ARGS: ${MESON_TEST_EXTRA_ARGS}"
echo
echo "These values can be set at https://gitlab.gnome.org/GNOME/tracker/pipelines/new"
diff --git a/tests/functional-tests/configuration.py b/tests/functional-tests/configuration.py
index 72e035b8c..22ba09db2 100644
--- a/tests/functional-tests/configuration.py
+++ b/tests/functional-tests/configuration.py
@@ -97,19 +97,6 @@ def remove_monitored_test_dir(path):
pass
-def get_environment_boolean(variable):
- '''Parse a yes/no boolean passed through the environment.'''
-
- value = os.environ.get(variable, 'no').lower()
- if value in ['no', '0', 'false']:
- return False
- elif value in ['yes', '1', 'true']:
- return True
- else:
- raise RuntimeError('Unexpected value for %s: %s' %
- (variable, value))
-
-
def get_environment_int(variable, default=0):
try:
return int(os.environ.get(variable))
@@ -117,34 +104,40 @@ def get_environment_int(variable, default=0):
return default
-def tests_verbose():
- return get_environment_boolean('TRACKER_TESTS_VERBOSE')
-
-
# Timeout when awaiting resources. For developers, we want a short default
# so they don't spend a long time waiting for tests to fail. For CI we want
# to set a longer timeout so we don't see failures on slow CI runners.
AWAIT_TIMEOUT = get_environment_int('TRACKER_TESTS_AWAIT_TIMEOUT', default=10)
-DEBUG_TESTS_NO_CLEANUP = 1
+DEBUG_TESTS = 1
+DEBUG_TESTS_NO_CLEANUP = 2
_debug_flags = None
def get_debug_flags():
"""Parse the TRACKER_DEBUG environment variable and return flags."""
global _debug_flags
if _debug_flags is None:
+ flag_tests = GLib.DebugKey()
+ flag_tests.key = 'tests'
+ flag_tests.value = DEBUG_TESTS
+
flag_tests_no_cleanup = GLib.DebugKey()
flag_tests_no_cleanup.key = 'tests-no-cleanup'
flag_tests_no_cleanup.value = DEBUG_TESTS_NO_CLEANUP
- flags = [flag_tests_no_cleanup]
+ flags = [flag_tests, flag_tests_no_cleanup]
flags_str = os.environ.get('TRACKER_DEBUG', '')
_debug_flags = GLib.parse_debug_string(flags_str, flags)
return _debug_flags
+def tests_verbose():
+ """True if TRACKER_DEBUG=tests"""
+ return (get_debug_flags() & DEBUG_TESTS)
+
+
def tests_no_cleanup():
"""True if TRACKER_DEBUG=tests-no-cleanup"""
- return(get_debug_flags() & DEBUG_TESTS_NO_CLEANUP)
+ return (get_debug_flags() & DEBUG_TESTS_NO_CLEANUP)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]