validate:launcher: Put gst logs in a specific file

+ Make default timeout 30seconds just in case.
This commit is contained in:
Thibault Saunier 2014-03-26 20:09:12 +01:00
parent 8fdf84b084
commit 3408869f49
2 changed files with 35 additions and 10 deletions

View file

@ -63,15 +63,20 @@ class Test(Loggable):
self._starting_time = None
self.result = Result.NOT_RUN
self.logfile = None
self.extra_logfiles = []
def __str__(self):
string = self.classname
if self.result != Result.NOT_RUN:
string += ": " + self.result
if self.result in [Result.FAILED, Result.TIMEOUT]:
string += " '%s'\n You can reproduce with: %s\n " \
"You can find logs in: %s" % (self.message, self.command,
self.logfile)
string += " '%s'\n" \
" You can reproduce with: %s\n" \
" You can find logs in:\n" \
" - %s" % (self.message, self.command,
self.logfile)
for log in self.extra_logfiles:
string += "\n - %s" % log
return string
@ -173,20 +178,30 @@ class Test(Loggable):
self.check_results()
def get_subproc_env(self):
return os.environ
def run(self):
self.command = "%s " % (self.application)
self._starting_time = time.time()
self.build_arguments()
printc("Launching: %s%s\n"
" logs are in %s\n"
" Command: '%s'"
% (Colors.ENDC, self.classname,
self.logfile, self.command), Colors.OKBLUE)
proc_env = self.get_subproc_env()
message = "Launching: %s%s\n" \
" Command: '%s'\n" \
" Logs:\n" \
" - %s" % (Colors.ENDC, self.classname,
self.command, self.logfile)
for log in self.extra_logfiles:
message += "\n - %s" % log
printc(message, Colors.OKBLUE)
try:
self.process = subprocess.Popen(self.command,
stderr=self.reporter.out,
stdout=self.reporter.out,
shell=True)
shell=True,
env=proc_env)
self.wait_process()
except KeyboardInterrupt:
self.process.kill()
@ -234,6 +249,16 @@ class GstValidateTest(Test):
else:
self.scenario = scenario
def get_subproc_env(self):
subproc_env = os.environ.copy()
if 'GST_DEBUG' in os.environ:
gstlogsfile = self.logfile + '.gstdebug'
self.extra_logfiles.append(gstlogsfile)
subproc_env["GST_DEBUG_FILE"] = gstlogsfile
return subproc_env
def clean(self):
Test.clean(self)
self._sent_eos_pos = None

View file

@ -29,7 +29,7 @@ from operator import itemgetter
GST_SECOND = long(1000000000)
DEFAULT_TIMEOUT = 10
DEFAULT_TIMEOUT = 30
DEFAULT_MAIN_DIR = os.path.expanduser("~/gst-validate/")
DEFAULT_GST_QA_ASSETS = os.path.join(DEFAULT_MAIN_DIR, "gst-qa-assets")
DISCOVERER_COMMAND = "gst-discoverer-1.0"