Bug 1057666 - Ensure that only one log message is printed per line, r=chmanchester
authorJames Graham <james@hoppipolla.co.uk>
Sat, 23 Aug 2014 19:15:00 +0100
changeset 222930 fb0fdf7c9a105397189016c79455c66dc91b98d7
parent 222929 b09d1cd08b1caf95aee204c48e36f34acd7f553e
child 222931 870d25b5d7b32526cd916fc12d4c9e4f50279379
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1057666
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1057666 - Ensure that only one log message is printed per line, r=chmanchester
testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py
--- a/testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py
+++ b/testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py
@@ -65,50 +65,58 @@ class TbplFormatter(BaseFormatter):
         self.test_start_times[self.test_id(data["test"])] = data["time"]
 
         return "TEST-START | %s\n" % self.id_str(data["test"])
 
     def test_status(self, data):
         message = "- " + data["message"] if "message" in data else ""
         if "stack" in data:
             message += "\n%s" % data["stack"]
+        if message and message[-1] == "\n":
+            message = message[:-1]
+
         if "expected" in data:
-            failure_line = "TEST-UNEXPECTED-%s | %s | %s %s" % (
+            failure_line = "TEST-UNEXPECTED-%s | %s | %s %s\n" % (
                 data["status"], self.id_str(data["test"]), data["subtest"],
                 message)
             if data["expected"] != "PASS":
                 info_line = "TEST-INFO | expected %s\n" % data["expected"]
-                return "\n".join([failure_line, info_line])
+                return failure_line + info_line
             return failure_line
 
         return "TEST-%s | %s | %s %s\n" % (
             data["status"], self.id_str(data["test"]), data["subtest"],
             message)
 
     def test_end(self, data):
         test_id = self.test_id(data["test"])
         time_msg = ""
-        message = data.get("message", "")
-        if "stack" in data:
-            message += "\n%s" % data["stack"]
+
         if test_id in self.test_start_times:
             start_time = self.test_start_times.pop(test_id)
             time = data["time"] - start_time
             time_msg = "took %ims" % time
 
         if "expected" in data:
-            failure_line = "TEST-UNEXPECTED-%s | %s | %s" % (
+            message = data.get("message", "")
+            if "stack" in data:
+                message += "\n%s" % data["stack"]
+            if message and message[-1] == "\n":
+                message = message[:-1]
+
+            failure_line = "TEST-UNEXPECTED-%s | %s | %s\n" % (
                 data["status"], test_id, message)
 
             if data["expected"] not in ("PASS", "OK"):
                 expected_msg = "expected %s | " % data["expected"]
             else:
                 expected_msg = ""
             info_line = "TEST-INFO %s%s\n" % (expected_msg, time_msg)
-            return "\n".join([failure_line, info_line])
+
+            return failure_line + info_line
 
         return "TEST-%s | %s | %s\n" % (
             data["status"], test_id, time_msg)
 
     def suite_end(self, data):
         start_time = self.suite_start_time
         time = int((data["time"] - start_time) / 1000)