mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
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
This commit is contained in:
parent
4e0388c631
commit
9c3606a867
3 changed files with 18 additions and 45 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue