[tools] More test-runner Py3 clean-up

Bug: chromium:1292016
Change-Id: I9404ca1c38c6231cada6c5d9af5e5859e4c0e261
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3568467
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79744}
This commit is contained in:
Michael Achenbach 2022-04-04 14:49:14 +02:00 committed by V8 LUCI CQ
parent 2139853732
commit ad93d4ee26

View File

@ -69,19 +69,9 @@ TEST262_FRONTMATTER_PATTERN = re.compile(r"/\*---.*?---\*/", re.DOTALL)
TIMEOUT_LONG = "long"
try:
cmp # Python 2
except NameError:
def cmp(x, y): # Python 3
return (x > y) - (x < y)
def read_file(file):
try: # Python 3
with open(file, encoding='ISO-8859-1') as f:
return f.read()
except TypeError: # Python 2 ..
with open(file) as f:
return f.read()
with open(file, encoding='ISO-8859-1') as f:
return f.read()
class TestCase(object):
def __init__(self, suite, path, name, test_config):
@ -440,6 +430,8 @@ class TestCase(object):
def __cmp__(self, other):
# Make sure that test cases are sorted correctly if sorted without
# key function. But using a key function is preferred for speed.
def cmp(x, y):
return (x > y) - (x < y)
return cmp(
(self.suite.name, self.name, self.variant),
(other.suite.name, other.name, other.variant)