[tracker/sam/tracker-debug-tests] tests: Remove TRACKER_TESTS_VERBOSE, add TRACKER_DEBUG=tests



commit 7ebf678ec0ca3676d6a2482a23bda5d9582127c2
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Jun 21 13:59:07 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 --
 HACKING.md                              | 13 ++++++-------
 tests/functional-tests/configuration.py | 29 +++++++++--------------------
 3 files changed, 15 insertions(+), 29 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e9043c364..960cf1743 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: ""
@@ -40,7 +39,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/HACKING.md b/HACKING.md
index 6708301cf..36efbd1f5 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -52,13 +52,12 @@ Tracker test suite. Note that Meson will not print log output from tests by
 default, use `meson test --verbose` or `meson test --print-errorlogs` to
 enable.
 
-The functional tests understand an additional variable, `TRACKER_TESTS_VERBOSE`
-with can be set to `1` or `yes` to see detailed logging from the test harness
-itself, and full log output from the internal D-Bus daemon. By default, these
-tests filter output from the D-Bus daemon to only show log messages from
-Tracker processes. Anything written directly to stdout, for example by
-`g_print()` or by the dbus-daemon itself, will not be displayed unless
-`TRACKER_TESTS_VERBOSE` is set.
+You can use `TRACKER_DEBUG=tests` to see logging from the test harness,
+including full log output from the internal D-Bus daemon for functional-tests.
+Note that by default, functional tests filter output from the D-Bus daemon to
+only show log messages from Tracker processes. Anything written directly to
+stdout, for example by `g_print()` or by the dbus-daemon itself, will not be
+displayed unless `TRACKER_DEBUG=tests` is set.
 
 When working with GitLab CI, you can use the
 [Run Pipeline dialog](https://gitlab.gnome.org/GNOME/tracker/pipelines/new)
diff --git a/tests/functional-tests/configuration.py b/tests/functional-tests/configuration.py
index d49d228f7..a9bc7ccc9 100644
--- a/tests/functional-tests/configuration.py
+++ b/tests/functional-tests/configuration.py
@@ -18,6 +18,8 @@
 # 02110-1301, USA.
 #
 
+from gi.repository import GLib
+
 import json
 import logging
 import os
@@ -49,25 +51,12 @@ def tracker_version():
     return config['TRACKER_VERSION']
 
 
-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))
-    except (TypeError, ValueError):
-        return default
-
+TRACKER_DEBUG_TESTS = 1
 
 def tests_verbose():
-    return get_environment_boolean('TRACKER_TESTS_VERBOSE')
+    tracker_debug_tests = GLib.DebugKey()
+    tracker_debug_tests.key = "tests"
+    tracker_debug_tests.value = TRACKER_DEBUG_TESTS
+
+    flags = GLib.parse_debug_string (os.environ.get('TRACKER_DEBUG', ''), [tracker_debug_tests])
+    return (flags & TRACKER_DEBUG_TESTS)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]