Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2013-05-21 20:30:33 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2013-06-10 13:42:19 (GMT)
commit21619315304d9ee7140478e3f2aa968088480739 (patch)
tree8114e11420941a63d4cad4659718f256eb04938f
parente2a118c548fca192a6736ca279e3befc4e2a3f22 (diff)
Redirect test output to a log file
Otherwise it gets mixed with the rest of the shell.log.
-rw-r--r--src/jarabe/testrunner.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/jarabe/testrunner.py b/src/jarabe/testrunner.py
index ef2dbc0..e054b6a 100644
--- a/src/jarabe/testrunner.py
+++ b/src/jarabe/testrunner.py
@@ -20,14 +20,24 @@ import subprocess
from gi.repository import GLib
+from sugar3.logger import get_logs_dir
-def _test_child_watch_cb(pid, condition, user_data):
+
+def _test_child_watch_cb(pid, condition, log_file):
if os.WIFEXITED(condition):
+ log_file.close()
sys.exit(os.WEXITSTATUS(condition))
def check_environment():
run_test = os.environ.get("SUGAR_RUN_TEST", None)
if run_test:
- test_process = subprocess.Popen(run_test, shell=True)
- GLib.child_watch_add(test_process.pid, _test_child_watch_cb, None)
+ log_path = os.path.join(get_logs_dir(), "test.log")
+ log_file = open(log_path, "w")
+
+ test_process = subprocess.Popen(run_test,
+ stdout=log_file,
+ stderr=subprocess.STDOUT,
+ shell=True)
+
+ GLib.child_watch_add(test_process.pid, _test_child_watch_cb, log_file)