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

View file

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