Commit 04bda550 authored by machenbach's avatar machenbach Committed by Commit bot

[test] Make test duplication more robust

This makes test outcomes immutable. This has two benefits:
1) It's more robust. Using the |= operator by mistake
wouldn't lead to unwanted mutation.
2) It's faster as now the set reference can be copied again
when copying test cases. Test case copying happens an order
of magnitude more often than rules do apply.

BUG=v8:5238

Review-Url: https://codereview.chromium.org/2212333002
Cr-Commit-Position: refs/heads/master@{#38373}
parent 23ea0782
......@@ -179,7 +179,7 @@ class TestSuite(object):
used_rules.add((testname, variant))
# Even for skipped tests, as the TestCase object stays around and
# PrintReport() uses it.
t.outcomes |= rules[testname]
t.outcomes = t.outcomes | rules[testname]
if statusfile.DoSkip(t.outcomes):
continue # Don't add skipped tests to |filtered|.
for outcome in t.outcomes:
......@@ -192,7 +192,7 @@ class TestSuite(object):
assert rule[-1] == '*'
if testname.startswith(rule[:-1]):
used_rules.add((rule, variant))
t.outcomes |= wildcards[rule]
t.outcomes = t.outcomes | wildcards[rule]
if statusfile.DoSkip(t.outcomes):
skip = True
break # "for rule in wildcards"
......
......@@ -36,7 +36,7 @@ class TestCase(object):
self.flags = flags or [] # list of strings, flags specific to this test
self.variant = variant # name of the used testing variant
self.override_shell = override_shell
self.outcomes = set([])
self.outcomes = frozenset([])
self.output = None
self.id = None # int, used to map result back to TestCase instance
self.duration = None # assigned during execution
......@@ -45,7 +45,7 @@ class TestCase(object):
def CopyAddingFlags(self, variant, flags):
copy = TestCase(self.suite, self.path, variant, self.flags + flags,
self.override_shell)
copy.outcomes = set(self.outcomes)
copy.outcomes = self.outcomes
return copy
def PackTask(self):
......@@ -63,7 +63,7 @@ class TestCase(object):
"""Creates a new TestCase object based on packed task data."""
# For the order of the fields, refer to PackTask() above.
test = TestCase(str(task[0]), task[1], task[2], task[3], task[4])
test.outcomes = set(task[5])
test.outcomes = frozenset(task[5])
test.id = task[6]
test.run = 1
return test
......
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