mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
validate:launcher: Try to dump logs with bat if avalaible
We got to many issues with mdv, it seems not to be maintained bat is a very good replacement.
This commit is contained in:
parent
06822b519b
commit
e4ca67938e
2 changed files with 11 additions and 11 deletions
|
@ -52,10 +52,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import xml.etree.cElementTree as ET
|
import xml.etree.cElementTree as ET
|
||||||
|
|
||||||
try:
|
|
||||||
import mdv
|
|
||||||
except ImportError:
|
|
||||||
mdv = None
|
|
||||||
|
|
||||||
from .vfb_server import get_virual_frame_buffer_server
|
from .vfb_server import get_virual_frame_buffer_server
|
||||||
from .httpserver import HTTPServer
|
from .httpserver import HTTPServer
|
||||||
|
@ -638,13 +634,16 @@ class Test(Loggable):
|
||||||
self.start_ts = time.time()
|
self.start_ts = time.time()
|
||||||
|
|
||||||
def _dump_log_file(self, logfile):
|
def _dump_log_file(self, logfile):
|
||||||
|
if which('bat'):
|
||||||
|
try:
|
||||||
|
subprocess.check_call(['bat', '-H', '1', '--paging=never', logfile])
|
||||||
|
return
|
||||||
|
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||||
|
pass
|
||||||
|
|
||||||
with open(logfile, 'r') as fin:
|
with open(logfile, 'r') as fin:
|
||||||
printc(self.get_logfile_repr())
|
for line in fin.readlines():
|
||||||
if mdv and utils.supports_ansi_colors():
|
print('> ' + line, end='')
|
||||||
printc(mdv.main(fin.read()))
|
|
||||||
else:
|
|
||||||
for line in fin.readlines():
|
|
||||||
print('> ' + line, end='')
|
|
||||||
|
|
||||||
def _dump_log_files(self):
|
def _dump_log_files(self):
|
||||||
self._dump_log_file(self.logfile)
|
self._dump_log_file(self.logfile)
|
||||||
|
|
|
@ -463,7 +463,8 @@ class LauncherConfig(Loggable):
|
||||||
parser.add_argument("--dump-on-failure", dest="dump_on_failure",
|
parser.add_argument("--dump-on-failure", dest="dump_on_failure",
|
||||||
action="store_true", default=False,
|
action="store_true", default=False,
|
||||||
help="Dump logs to stdout when a test fails."
|
help="Dump logs to stdout when a test fails."
|
||||||
" Note that mdv is used to enhance output if avalaible, install with `pip install mdv`.")
|
" Note that bat is used to enhance output if available"
|
||||||
|
" (See https://github.com/sharkdp/bat)")
|
||||||
parser.add_argument("--max-dump-size", dest="max_dump_size", type=float,
|
parser.add_argument("--max-dump-size", dest="max_dump_size", type=float,
|
||||||
default=0.5, help="Maximum size of logs to dump on stdout in MB.")
|
default=0.5, help="Maximum size of logs to dump on stdout in MB.")
|
||||||
parser.add_argument("-c", "--config", dest="config",
|
parser.add_argument("-c", "--config", dest="config",
|
||||||
|
|
Loading…
Reference in a new issue