Bug 1344346 - [mozlog] Use less verbose formatting on 'process_output' messages, r?jgraham
This simplifies the 'process_output' formatting in both the mach and tbpl formatters. It will also
add the string 'pid' somewhere in the format, but only if the process id is actually a positive int.
MozReview-Commit-ID: 6nc5q06cDfM
--- a/testing/mozbase/mozlog/mozlog/formatters/machformatter.py
+++ b/testing/mozbase/mozlog/mozlog/formatters/machformatter.py
@@ -317,21 +317,25 @@ class MachFormatter(base.BaseFormatter):
elif data["status"] == "SKIP":
self.summary_values["skipped"] += 1
else:
self.summary_values["expected"] += 1
def process_output(self, data):
rv = []
+ pid = data['process']
+ if pid.isdigit():
+ pid = 'pid:%s' % pid
+
if "command" in data and data["process"] not in self._known_pids:
self._known_pids.add(data["process"])
- rv.append('(pid:%s) Full command: %s' % (data["process"], data["command"]))
+ rv.append('(%s) Full command: %s' % (pid, data["command"]))
- rv.append('(pid:%s) "%s"' % (data["process"], data["data"]))
+ rv.append('(%s) "%s"' % (pid, data["data"]))
return "\n".join(rv)
def crash(self, data):
test = self._get_test_id(data)
if data.get("stackwalk_returncode", 0) != 0 and not data.get("stackwalk_stderr"):
success = True
else:
--- a/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py
+++ b/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py
@@ -67,17 +67,20 @@ class TbplFormatter(BaseFormatter):
if "stack" in data:
message += "\n%s" % data["stack"]
return "%s\n" % message
@output_subtests
def process_output(self, data):
- return "PROCESS | %(process)s | %(data)s\n" % data
+ pid = data['process']
+ if pid.isdigit():
+ pid = 'PID %s' % pid
+ return "%s | %s\n" % (pid, data['data'])
@output_subtests
def process_start(self, data):
msg = "TEST-INFO | started process %s" % data['process']
if 'command' in data:
msg = '%s (%s)' % (msg, data['command'])
return msg + '\n'