Commit ad93d4ee authored by Michael Achenbach's avatar Michael Achenbach Committed by V8 LUCI CQ

[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: 's avatarLiviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79744}
parent 21398537
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment