mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 04:00:37 +00:00
launcher: Add --dump-on-failure switch
When the test fails, it can be useful to have the log files dumped to stdout. https://bugzilla.gnome.org/show_bug.cgi?id=741092
This commit is contained in:
parent
40d803271c
commit
ec1d8d7d8c
2 changed files with 20 additions and 0 deletions
|
@ -410,6 +410,19 @@ class Test(Loggable):
|
|||
self.last_change_ts = time.time()
|
||||
self.start_ts = time.time()
|
||||
|
||||
def _dump_log_file(self, logfile):
|
||||
message = "Dumping contents of %s\n" % logfile
|
||||
printc(message, Colors.FAIL)
|
||||
|
||||
with open(logfile, 'r') as fin:
|
||||
print fin.read()
|
||||
|
||||
def _dump_log_files(self):
|
||||
printc("Dumping log files on failure\n", Colors.FAIL)
|
||||
self._dump_log_file(self.logfile)
|
||||
for logfile in self.extra_logfiles:
|
||||
self._dump_log_file(logfile)
|
||||
|
||||
def test_end(self):
|
||||
self.kill_subprocess()
|
||||
self.thread.join()
|
||||
|
@ -421,6 +434,10 @@ class Test(Loggable):
|
|||
|
||||
self.close_logfile()
|
||||
|
||||
if self.options.dump_on_failure:
|
||||
if self.result is not Result.PASSED:
|
||||
self._dump_log_files()
|
||||
|
||||
return self.result
|
||||
|
||||
|
||||
|
|
|
@ -422,6 +422,9 @@ Note that all testsuite should be inside python modules, so the directory should
|
|||
action='store',
|
||||
help="Defines the limit for which a test is considered as long (in seconds)."
|
||||
" Note that 0 will enable all tests", type=int),
|
||||
parser.add_argument("--dump-on-failure", dest="dump_on_failure",
|
||||
action="store_true", default=False,
|
||||
help="Dump logs to stdout when a test fails")
|
||||
parser.add_argument("-c", "--config", dest="config",
|
||||
help="This is DEPRECATED, prefer using the testsuite format"
|
||||
" to configure testsuites")
|
||||
|
|
Loading…
Reference in a new issue