Commit ed619fa6 authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Make variant names unique

Temporary workaround to avoid the same variant name for multiple
variants of the same test.

Bug: v8:6917
Change-Id: I9a25dcaf81d35da0dc2617c089cb4811c2a958cb
Cq-Include-Trybots: luci.v8.try:v8_linux64_fyi_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/852833
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: 's avatarSergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50428}
parent 566b3bf4
...@@ -308,7 +308,8 @@ class DeoptFuzzer(base_runner.BaseTestRunner): ...@@ -308,7 +308,8 @@ class DeoptFuzzer(base_runner.BaseTestRunner):
test_backup[s] = s.tests test_backup[s] = s.tests
analysis_flags = ["--deopt-every-n-times", "%d" % MAX_DEOPT, analysis_flags = ["--deopt-every-n-times", "%d" % MAX_DEOPT,
"--print-deopt-stress"] "--print-deopt-stress"]
s.tests = [t.create_variant(t.variant, analysis_flags) for t in s.tests] s.tests = [t.create_variant(t.variant, analysis_flags, 'analysis')
for t in s.tests]
num_tests += len(s.tests) num_tests += len(s.tests)
for t in s.tests: for t in s.tests:
t.id = test_id t.id = test_id
...@@ -355,9 +356,9 @@ class DeoptFuzzer(base_runner.BaseTestRunner): ...@@ -355,9 +356,9 @@ class DeoptFuzzer(base_runner.BaseTestRunner):
distribution = dist.Distribute(n_deopt, max_deopt) distribution = dist.Distribute(n_deopt, max_deopt)
if options.verbose: if options.verbose:
print "%s %s" % (t.path, distribution) print "%s %s" % (t.path, distribution)
for i in distribution: for n, d in enumerate(distribution):
fuzzing_flags = ["--deopt-every-n-times", "%d" % i] fuzzing_flags = ["--deopt-every-n-times", "%d" % d]
s.tests.append(t.create_variant(t.variant, fuzzing_flags)) s.tests.append(t.create_variant(t.variant, fuzzing_flags, n))
num_tests += len(s.tests) num_tests += len(s.tests)
for t in s.tests: for t in s.tests:
t.id = test_id t.id = test_id
......
...@@ -198,7 +198,8 @@ class GCFuzzer(base_runner.BaseTestRunner): ...@@ -198,7 +198,8 @@ class GCFuzzer(base_runner.BaseTestRunner):
'--stress_marking', '1000', '--stress_marking', '1000',
'--trace_incremental_marking', '--trace_incremental_marking',
] ]
s.tests = map(lambda t: t.create_variant(t.variant, analysis_flags), s.tests = map(lambda t: t.create_variant(t.variant, analysis_flags,
'analysis'),
s.tests) s.tests)
for t in s.tests: for t in s.tests:
t.cmd = t.get_command(ctx) t.cmd = t.get_command(ctx)
...@@ -240,7 +241,7 @@ class GCFuzzer(base_runner.BaseTestRunner): ...@@ -240,7 +241,7 @@ class GCFuzzer(base_runner.BaseTestRunner):
if options.verbose: if options.verbose:
print ('%s [x%d] (max marking limit=%.02f)' % print ('%s [x%d] (max marking limit=%.02f)' %
(t.path, subtests_count, max_percent)) (t.path, subtests_count, max_percent))
for _ in xrange(0, subtests_count): for i in xrange(0, subtests_count):
fuzzer_seed = self._next_fuzzer_seed() fuzzer_seed = self._next_fuzzer_seed()
fuzzing_flags = [ fuzzing_flags = [
'--stress_marking', str(max_percent), '--stress_marking', str(max_percent),
...@@ -248,7 +249,7 @@ class GCFuzzer(base_runner.BaseTestRunner): ...@@ -248,7 +249,7 @@ class GCFuzzer(base_runner.BaseTestRunner):
] ]
if options.stress_compaction: if options.stress_compaction:
fuzzing_flags.append('--stress_compaction_random') fuzzing_flags.append('--stress_compaction_random')
s.tests.append(t.create_variant(t.variant, fuzzing_flags)) s.tests.append(t.create_variant(t.variant, fuzzing_flags, i))
for t in s.tests: for t in s.tests:
t.cmd = t.get_command(ctx) t.cmd = t.get_command(ctx)
num_tests += len(s.tests) num_tests += len(s.tests)
......
...@@ -70,9 +70,15 @@ class TestCase(object): ...@@ -70,9 +70,15 @@ class TestCase(object):
subtest.procid += '.%s' % subtest_id subtest.procid += '.%s' % subtest_id
return subtest return subtest
def create_variant(self, variant, flags): def create_variant(self, variant, flags, procid_suffix=None):
"""Makes a shallow copy of the object and updates variant, variant_flags and """Makes a shallow copy of the object and updates variant, variant flags and
all fields that depend on it, e.g. expected outcomes. all fields that depend on it, e.g. expected outcomes.
Args
variant - variant name
flags - flags that should be added to origin test's variant flags
procid_suffix - for multiple variants with the same name set suffix to
keep procid unique.
""" """
other = copy.copy(self) other = copy.copy(self)
if not self.variant_flags: if not self.variant_flags:
...@@ -80,7 +86,10 @@ class TestCase(object): ...@@ -80,7 +86,10 @@ class TestCase(object):
else: else:
other.variant_flags = self.variant_flags + flags other.variant_flags = self.variant_flags + flags
other.variant = variant other.variant = variant
other.procid += '[%s]' % variant if procid_suffix:
other.procid += '[%s-%s]' % (variant, procid_suffix)
else:
other.procid += '[%s]' % variant
other._prepare_outcomes(variant != self.variant) other._prepare_outcomes(variant != self.variant)
......
...@@ -437,10 +437,12 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -437,10 +437,12 @@ class StandardTestRunner(base_runner.BaseTestRunner):
verbose.PrintTestSource(s.tests) verbose.PrintTestSource(s.tests)
continue continue
variant_gen = s.CreateVariantGenerator(VARIANTS) variant_gen = s.CreateVariantGenerator(VARIANTS)
variant_tests = [ t.create_variant(v, flags) variant_tests = [
for t in s.tests t.create_variant(v, flags, n)
for v in variant_gen.FilterVariantsByTest(t) for t in s.tests
for flags in variant_gen.GetFlagSets(t, v) ] for v in variant_gen.FilterVariantsByTest(t)
for n, flags in enumerate(variant_gen.GetFlagSets(t, v))
]
if options.random_seed_stress_count > 1: if options.random_seed_stress_count > 1:
# Duplicate test for random seed stress mode. # Duplicate test for random seed stress mode.
...@@ -453,9 +455,9 @@ class StandardTestRunner(base_runner.BaseTestRunner): ...@@ -453,9 +455,9 @@ class StandardTestRunner(base_runner.BaseTestRunner):
else: else:
yield ["--random-seed=%d" % self._random_seed()] yield ["--random-seed=%d" % self._random_seed()]
s.tests = [ s.tests = [
t.create_variant(t.variant, flags) t.create_variant(t.variant, flags, 'seed-stress-%d' % n)
for t in variant_tests for t in variant_tests
for flags in iter_seed_flags() for n, flags in enumerate(iter_seed_flags())
] ]
else: else:
s.tests = variant_tests s.tests = variant_tests
......
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