summaryrefslogtreecommitdiff
path: root/chromium/v8/tools/testrunner/testproc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/tools/testrunner/testproc
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/tools/testrunner/testproc')
-rw-r--r--chromium/v8/tools/testrunner/testproc/progress.py53
-rw-r--r--chromium/v8/tools/testrunner/testproc/timeout.py1
-rw-r--r--chromium/v8/tools/testrunner/testproc/util_unittest.py11
3 files changed, 47 insertions, 18 deletions
diff --git a/chromium/v8/tools/testrunner/testproc/progress.py b/chromium/v8/tools/testrunner/testproc/progress.py
index 671eebb9222..7a47c1b692a 100644
--- a/chromium/v8/tools/testrunner/testproc/progress.py
+++ b/chromium/v8/tools/testrunner/testproc/progress.py
@@ -4,6 +4,7 @@
# for py2/py3 compatibility
from __future__ import print_function
+from __future__ import absolute_import
import datetime
import json
@@ -12,7 +13,7 @@ import platform
import subprocess
import sys
import time
-import util
+from . import util
from . import base
@@ -243,15 +244,22 @@ class CompactProgressIndicator(ProgressIndicator):
self._clear_line(self._last_status_length)
print_failure_header(test)
if len(stdout):
- print(self._templates['stdout'] % stdout)
+ self.printFormatted('stdout', stdout)
if len(stderr):
- print(self._templates['stderr'] % stderr)
- print("Command: %s" % result.cmd.to_string(relative=True))
+ self.printFormatted('stderr', stderr)
+ self.printFormatted(
+ 'command', "Command: %s" % result.cmd.to_string(relative=True))
if output.HasCrashed():
- print("exit code: %s" % output.exit_code_string)
- print("--- CRASHED ---")
- if output.HasTimedOut():
- print("--- TIMEOUT ---")
+ self.printFormatted(
+ 'failure', "exit code: %s" % output.exit_code_string)
+ self.printFormatted('failure', "--- CRASHED ---")
+ elif output.HasTimedOut():
+ self.printFormatted('failure', "--- TIMEOUT ---")
+ else:
+ if test.is_fail:
+ self.printFormatted('failure', "--- UNEXPECTED PASS ---")
+ else:
+ self.printFormatted('failure', "--- FAILED ---")
def finished(self):
self._print_progress('Done')
@@ -272,12 +280,12 @@ class CompactProgressIndicator(ProgressIndicator):
'mins': int(elapsed) // 60,
'secs': int(elapsed) % 60
}
- status = self._truncate(status, 78)
+ status = self._truncateStatusLine(status, 78)
self._last_status_length = len(status)
print(status, end='')
sys.stdout.flush()
- def _truncate(self, string, length):
+ def _truncateStatusLine(self, string, length):
if length and len(string) > (length - 3):
return string[:(length - 3)] + "..."
else:
@@ -296,22 +304,33 @@ class ColorProgressIndicator(CompactProgressIndicator):
"\033[31m-%(failed) 4d\033[0m]: %(test)s"),
'stdout': "\033[1m%s\033[0m",
'stderr': "\033[31m%s\033[0m",
+ 'failure': "\033[1;31m%s\033[0m",
+ 'command': "\033[33m%s\033[0m",
}
super(ColorProgressIndicator, self).__init__(templates)
+ def printFormatted(self, format, string):
+ print(self._templates[format] % string)
+
+ def _truncateStatusLine(self, string, length):
+ # Add some slack for the color control chars
+ return super(ColorProgressIndicator, self)._truncateStatusLine(
+ string, length + 3*9)
+
def _clear_line(self, last_length):
print("\033[1K\r", end='')
class MonochromeProgressIndicator(CompactProgressIndicator):
def __init__(self):
- templates = {
- 'status_line': ("[%(mins)02i:%(secs)02i|%%%(progress) 4d|"
- "+%(passed) 4d|-%(failed) 4d]: %(test)s"),
- 'stdout': '%s',
- 'stderr': '%s',
- }
- super(MonochromeProgressIndicator, self).__init__(templates)
+ templates = {
+ 'status_line': ("[%(mins)02i:%(secs)02i|%%%(progress) 4d|"
+ "+%(passed) 4d|-%(failed) 4d]: %(test)s"),
+ }
+ super(MonochromeProgressIndicator, self).__init__(templates)
+
+ def printFormatted(self, format, string):
+ print(string)
def _clear_line(self, last_length):
print(("\r" + (" " * last_length) + "\r"), end='')
diff --git a/chromium/v8/tools/testrunner/testproc/timeout.py b/chromium/v8/tools/testrunner/testproc/timeout.py
index 9a4e88c8f05..026ba02cd97 100644
--- a/chromium/v8/tools/testrunner/testproc/timeout.py
+++ b/chromium/v8/tools/testrunner/testproc/timeout.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/v8/tools/testrunner/testproc/util_unittest.py b/chromium/v8/tools/testrunner/testproc/util_unittest.py
index 243bf9789a7..5bf6a6e79ad 100644
--- a/chromium/v8/tools/testrunner/testproc/util_unittest.py
+++ b/chromium/v8/tools/testrunner/testproc/util_unittest.py
@@ -3,9 +3,18 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from util import FixedSizeTopList
+from __future__ import absolute_import
+
+import os
+import sys
import unittest
+TOOLS_PATH = os.path.dirname(os.path.dirname(os.path.dirname(
+ os.path.abspath(__file__))))
+sys.path.append(TOOLS_PATH)
+
+from testrunner.testproc.util import FixedSizeTopList
+
class TestOrderedFixedSizeList(unittest.TestCase):
def test_empty(self):
ofsl = FixedSizeTopList(3)