summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@collabora.co.uk>2015-01-15 14:32:12 (GMT)
committerThibault Saunier <tsaunier@gnome.org>2015-01-16 15:24:13 (GMT)
commit9c3606a86787ebe9c69a284d87c4d38d055008fc (patch)
treea92547ec3169e5cde514a50d8f363d16ad741b8d
parent4e0388c6313d412f48e01f6c917e54e080c306c1 (diff)
downloadgst-devtools-9c3606a86787ebe9c69a284d87c4d38d055008fc.tar.gz
gst-devtools-9c3606a86787ebe9c69a284d87c4d38d055008fc.tar.xz
validate: launcher: Always create log files
Create log files even when stdout redirection is enabled. This commit partially reverts 20c28de. https://bugzilla.gnome.org/show_bug.cgi?id=742973
-rw-r--r--validate/launcher/baseclasses.py42
-rw-r--r--validate/launcher/httpserver.py10
-rw-r--r--validate/launcher/reporters.py11
3 files changed, 18 insertions, 45 deletions
diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py
index 608b867..69d2cdf 100644
--- a/validate/launcher/baseclasses.py
+++ b/validate/launcher/baseclasses.py
@@ -31,7 +31,6 @@ import subprocess
import reporters
import ConfigParser
import loggable
-import tempfile
from loggable import Loggable
import xml.etree.ElementTree as ET
@@ -62,12 +61,9 @@ class Test(Loggable):
self.process = None
self.duration = duration
- self.clean(True)
-
- def clean(self, full=True):
- if not full:
- return
+ self.clean()
+ def clean(self):
self.message = ""
self.error_str = ""
self.time_taken = 0.0
@@ -320,15 +316,11 @@ class GstValidateTest(Test):
self.scenario = scenario
def get_subproc_env(self):
+ self.validatelogs = self.logfile + '.validate.logs'
+ logfiles = self.validatelogs
if self.options.redirect_logs:
- self.validatelogs = os.path.join(
- tempfile.gettempdir(), 'tmp.validate.logs')
- logfiles = self.validatelogs
logfiles += os.pathsep + \
- self.reporter.out.name.replace("<", '').replace(">", '')
- else:
- self.validatelogs = self.logfile + '.validate.logs'
- logfiles = self.validatelogs
+ self.options.redirect_logs.replace("<", '').replace(">", '')
subproc_env = os.environ.copy()
@@ -336,8 +328,7 @@ class GstValidateTest(Test):
subproc_env["GST_VALIDATE_FILE"] = logfiles
self.extra_logfiles.append(self.validatelogs)
- if 'GST_DEBUG' in os.environ and \
- not self.options.redirect_logs:
+ if 'GST_DEBUG' in os.environ:
gstlogsfile = self.logfile + '.gstdebug'
self.extra_logfiles.append(gstlogsfile)
subproc_env["GST_DEBUG_FILE"] = gstlogsfile
@@ -346,16 +337,9 @@ class GstValidateTest(Test):
return subproc_env
- def clean(self, full=True):
- Test.clean(self, full=full)
- if hasattr(self, 'validatelogs') and not self.options.redirect_logs:
- try:
- os.remove(self.validatelogs)
- except OSError:
- pass
-
- if full:
- self._sent_eos_pos = None
+ def clean(self):
+ Test.clean(self)
+ self._sent_eos_pos = None
def build_arguments(self):
if "GST_VALIDATE" in os.environ:
@@ -762,7 +746,6 @@ class TestsManager(Loggable):
self.reporter.after_test()
if res != Result.PASSED and (self.options.forever or
self.options.fatal_error):
- test.clean(full=False)
return test.result
return Result.PASSED
@@ -1138,11 +1121,8 @@ class ScenarioManager(Loggable):
"""
scenarios = []
scenario_defs = os.path.join(self.config.main_dir, "scenarios.def")
- if self.config.redirect_logs:
- logs = open(os.devnull)
- else:
- logs = open(
- os.path.join(self.config.logsdir, "scenarios_discovery.log"), 'w')
+ logs = open(os.path.join(self.config.logsdir,
+ "scenarios_discovery.log"), 'w')
try:
command = [self.GST_VALIDATE_COMMAND,
diff --git a/validate/launcher/httpserver.py b/validate/launcher/httpserver.py
index f687154..1248c01 100644
--- a/validate/launcher/httpserver.py
+++ b/validate/launcher/httpserver.py
@@ -22,7 +22,6 @@ import time
import loggable
import subprocess
import sys
-import tempfile
logcat = "httpserver"
@@ -57,13 +56,8 @@ class HTTPServer(loggable.Loggable):
def start(self):
""" Start the server in a subprocess """
- if self.options.redirect_logs:
- self.info("Using devnull as HTTP server log file")
- self._logsfile = tempfile.TemporaryFile()
- else:
- self._logsfile = open(os.path.join(self.options.logsdir,
- "httpserver.logs"),
- 'w+')
+ self._logsfile = open(os.path.join(self.options.logsdir,
+ "httpserver.logs"), 'w+')
if self.options.http_server_dir is not None:
if self._check_is_up(timeout=2):
return True
diff --git a/validate/launcher/reporters.py b/validate/launcher/reporters.py
index 43d864e..7b40e0a 100644
--- a/validate/launcher/reporters.py
+++ b/validate/launcher/reporters.py
@@ -68,18 +68,17 @@ class Reporter(Loggable):
def before_test(self, test):
"""Initialize a timer before starting a test."""
+ path = os.path.join(self.options.logsdir,
+ test.classname.replace(".", os.sep))
+ mkdir(os.path.dirname(path))
+ test.logfile = path
+
if self.options.redirect_logs == 'stdout':
self.out = sys.stdout
- test.logfile = 'stdout'
elif self.options.redirect_logs == 'stderr':
self.out = sys.stderr
- test.logfile = 'stderr'
else:
- path = os.path.join(self.options.logsdir,
- test.classname.replace(".", os.sep))
- mkdir(os.path.dirname(path))
self.out = open(path, 'w+')
- test.logfile = path
self._current_test = test
if self._start_time == 0: