[tracker-miners/sam/functional-tests-shared: 2/2] functional-tests: Remove obsolete options
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/functional-tests-shared: 2/2] functional-tests: Remove obsolete options
- Date: Wed, 7 Aug 2019 18:57:02 +0000 (UTC)
commit 66aea3fed683edfe296dbfc1fdfc19723e45aa19
Author: Sam Thursfield <sam afuera me uk>
Date: Wed Aug 7 20:56:46 2019 +0200
functional-tests: Remove obsolete options
The old 'verbose' option isn't needed. The tests should be silent by
default, and noisy when TRACKER_VERBOSITY > 1 or TRACKER_TESTS_VERBOSE
is set.
The old 'manual start' option is also removed. If you need to attach a
debugger to one of the Tracker daemons during a test, my advice is to
modify the code to add a `g_sleep(10000)` call early in startup, start
the test in question, and then manually attach `gdb`.
.../functional-tests/common/utils/configuration.py | 21 +++++++++-----
tests/functional-tests/common/utils/helpers.py | 32 ++++++----------------
tests/functional-tests/common/utils/options.py | 28 -------------------
3 files changed, 22 insertions(+), 59 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/configuration.py
b/tests/functional-tests/common/utils/configuration.py
index 28a006e10..2ee408ead 100644
--- a/tests/functional-tests/common/utils/configuration.py
+++ b/tests/functional-tests/common/utils/configuration.py
@@ -27,8 +27,6 @@ import os
import tempfile
import sys
-from . import options
-
if 'TRACKER_FUNCTIONAL_TEST_CONFIG' not in os.environ:
raise RuntimeError("The TRACKER_FUNCTIONAL_TEST_CONFIG environment "
@@ -94,10 +92,6 @@ TRACKER_WRITEBACK_PATH = os.path.normpath(expandvars(config['TRACKER_WRITEBACK_P
DATADIR = os.path.normpath(expandvars(config['RAW_DATAROOT_DIR']))
-def generated_ttl_dir():
- return os.path.join(TOP_BUILD_DIR, 'tests', 'functional-tests', 'ttl')
-
-
# This path is used for test data for tests which expect filesystem monitoring
# to work. For this reason we must avoid it being on a tmpfs filesystem. Note
# that this MUST NOT be a hidden directory, as Tracker is hardcoded to ignore
@@ -140,5 +134,18 @@ def remove_monitored_test_dir(path):
pass
-if options.get_environment_boolean('TRACKER_TESTS_VERBOSE'):
+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))
+
+
+if get_environment_boolean('TRACKER_TESTS_VERBOSE'):
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 21c0a0394..18d6a9fc8 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -30,7 +30,6 @@ import re
from common.utils import configuration as cfg
from common.utils import mainloop
-from common.utils import options
log = logging.getLogger(__name__)
@@ -92,10 +91,6 @@ class Helper:
kws = {}
- if not options.is_verbose():
- FNULL = open('/dev/null', 'w')
- kws = {'stdout': FNULL, 'stderr': subprocess.PIPE}
-
command = [path] + flags
log.debug("Starting %s", ' '.join(command))
try:
@@ -127,11 +122,7 @@ class Helper:
return True # continue
else:
self.process_watch_timeout = 0
- if options.is_verbose():
- error = ""
- else:
- error = self.process.stderr.read()
- raise RuntimeError("%s exited with status: %i\n%s" % (self.PROCESS_NAME, status, error))
+ raise RuntimeError("%s exited with status: %i" % (self.PROCESS_NAME, status))
def _timeout_on_idle_cb(self):
log.debug("[%s] Timeout waiting... asumming idle.", self.PROCESS_NAME)
@@ -152,17 +143,14 @@ class Helper:
self._bus_name_appeared, self._bus_name_vanished)
self.loop.run_checked()
- if options.is_manual_start():
- print ("Start %s manually" % self.PROCESS_NAME)
- else:
- if self.available:
- # It's running, but we didn't start it...
- raise Exception("Unable to start test instance of %s: "
- "already running " % self.PROCESS_NAME)
+ if self.available:
+ # It's running, but we didn't start it...
+ raise Exception("Unable to start test instance of %s: "
+ "already running " % self.PROCESS_NAME)
- self.process = self._start_process()
- log.debug('[%s] Started process %i', self.PROCESS_NAME, self.process.pid)
- self.process_watch_timeout = GLib.timeout_add(200, self._process_watch_cb)
+ self.process = self._start_process()
+ log.debug('[%s] Started process %i', self.PROCESS_NAME, self.process.pid)
+ self.process_watch_timeout = GLib.timeout_add(200, self._process_watch_cb)
self.abort_if_process_exits_with_status_0 = True
@@ -205,10 +193,6 @@ class Helper:
def kill(self):
global _process_list
- if options.is_manual_start():
- log.debug("kill(): ignoring, because process was started manually.")
- return
-
self.process.kill()
# Name owner changed callback should take us out from this loop
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]