[tracker] functional-tests: Add option -m to start the tracker processes manually
- From: Ivan Frade <ifrade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] functional-tests: Add option -m to start the tracker processes manually
- Date: Mon, 31 Jan 2011 16:18:38 +0000 (UTC)
commit 62d3ed7d9df9d6b96d5459d248cebf358a6697a2
Author: Ivan Frade <ivan frade nokia com>
Date: Mon Jan 31 18:16:18 2011 +0200
functional-tests: Add option -m to start the tracker processes manually
tests/functional-tests/common/utils/Makefile.am | 1 +
tests/functional-tests/common/utils/options.py | 25 ++++++++++++++++
tests/functional-tests/common/utils/system.py | 35 +++++++++++++++++++---
3 files changed, 56 insertions(+), 5 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/Makefile.am b/tests/functional-tests/common/utils/Makefile.am
index b471cfb..de557b1 100644
--- a/tests/functional-tests/common/utils/Makefile.am
+++ b/tests/functional-tests/common/utils/Makefile.am
@@ -11,6 +11,7 @@ utils_SCRIPTS = \
minertest.py \
applicationstest.py \
writebacktest.py \
+ options.py \
system.py
EXTRA_DIST = \
diff --git a/tests/functional-tests/common/utils/options.py b/tests/functional-tests/common/utils/options.py
new file mode 100644
index 0000000..b4345d4
--- /dev/null
+++ b/tests/functional-tests/common/utils/options.py
@@ -0,0 +1,25 @@
+from optparse import OptionParser
+import sys
+
+usage = "usage: %prog [options]"
+
+parser = OptionParser(usage=usage)
+parser.add_option("-m", "--start-manually", dest="startmanually",
+ action="store_true",
+ default=False,
+ help="Wait for an external instance of the processes to appear in the system")
+
+(options, args) = parser.parse_args()
+
+# Deleting options from the args. Otherwise unittest will complain
+for option in ["--startmanually", "-m"]:
+ try:
+ sys.argv.remove (option)
+ except ValueError:
+ pass
+
+def is_manual_start ():
+ """
+ False to start the processes automatically
+ """
+ return options.startmanually
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 3c623cd..2718ae2 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -9,8 +9,14 @@ import dbus
from dbus.mainloop.glib import DBusGMainLoop
import time
+import options
+#from common.utils.options import get_start_timeout
+
# Don't use /tmp (not enough space there)
+# Add this after fixing the backup/restore and ontology changes tests
+#"G_DEBUG" : "fatal_criticals",
+
TEST_ENV_VARS = { "XDG_DATA_HOME" : os.path.join (cfg.TEST_TMP_DIR, "xdg-data-home"),
"XDG_CACHE_HOME": os.path.join (cfg.TEST_TMP_DIR, "xdg-cache-home")}
EXTRA_DIRS = [os.path.join (cfg.TEST_TMP_DIR, "xdg-data-home", "tracker"),
@@ -102,13 +108,22 @@ class TrackerStoreLifeCycle ():
tracker = [tracker_binary]
# The env variables can be passed as parameters!
FNULL = open('/dev/null', 'w')
- return subprocess.Popen (tracker, stdout=FNULL, stderr=FNULL)
+ if options.is_manual_start ():
+ print "Start tracker-store manually"
+ else:
+ return subprocess.Popen (tracker, stdout=FNULL, stderr=FNULL)
def __stop_tracker_store (self):
#control_binary = os.path.join (cfg.BINDIR, "tracker-control")
#FNULL = open('/dev/null', 'w')
#subprocess.call ([control_binary, "-t"], stdout=FNULL)
- self.store_proc.terminate ()
+ if options.is_manual_start ():
+ if self.available:
+ print "Kill tracker-store manually"
+ # Quit when disappearing from the bus
+ self.loop.run ()
+ else:
+ self.store_proc.terminate ()
class TrackerMinerFsLifeCycle():
@@ -198,12 +213,19 @@ class TrackerMinerFsLifeCycle():
def __start_tracker_miner_fs (self):
miner_fs_binary = os.path.join (cfg.EXEC_PREFIX, "tracker-miner-fs")
FNULL = open ('/dev/null', 'w')
- return subprocess.Popen ([miner_fs_binary], stdout=FNULL, stderr=FNULL)
+ if options.is_manual_start ():
+ print "Start tracker-miner-fs manually"
+ else:
+ return subprocess.Popen ([miner_fs_binary], stdout=FNULL, stderr=FNULL)
def __stop_tracker_miner_fs (self):
control_binary = os.path.join (cfg.BINDIR, "tracker-control")
FNULL = open('/dev/null', 'w')
- subprocess.call ([control_binary, "-t"], stdout=FNULL)
+ if options.is_manual_start ():
+ print "Kill miner manually"
+ self.loop.run ()
+ else:
+ subprocess.call ([control_binary, "-t"], stdout=FNULL)
class TrackerWritebackLifeCycle():
@@ -265,7 +287,10 @@ class TrackerWritebackLifeCycle():
writeback = [writeback_binary]
# The env variables can be passed as parameters!
FNULL = open('/dev/null', 'w')
- self.process = subprocess.Popen (writeback, stdout=FNULL, stderr=FNULL)
+ if options.is_manual_start ():
+ print "Start tracker-writeback manually"
+ else:
+ self.process = subprocess.Popen (writeback, stdout=FNULL, stderr=FNULL)
class TrackerSystemAbstraction:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]