Commit 2fe1af47 authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Remove dead code from suites and tests

Bug: v8:6917
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I6bfea537347fb236d41b31f0c6c64c108928bf28
Reviewed-on: https://chromium-review.googlesource.com/897784Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michał Majewski <majeski@google.com>
Cr-Commit-Position: refs/heads/master@{#51033}
parent 894b4e49
......@@ -37,9 +37,6 @@ class TestSuite(testsuite.TestSuite):
def _variants_gen_class(self):
return VariantsGenerator
def _LegacyVariantsGeneratorFactory(self):
return testsuite.StandardLegacyVariantsGenerator
class TestCase(testcase.TestCase):
def _get_files_params(self):
......
......@@ -77,9 +77,6 @@ class TestSuite(testsuite.TestSuite):
def _test_class(self):
return TestCase
def _LegacyVariantsGeneratorFactory(self):
return testsuite.StandardLegacyVariantsGenerator
def _variants_gen_class(self):
return VariantsGenerator
......
......@@ -70,32 +70,6 @@ TEST_262_RELPATH_REGEXP = re.compile(
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),
*TEST_262_TOOLS_PATH))
ALL_VARIANT_FLAGS_STRICT = dict(
(v, [flags + ["--use-strict"] for flags in flag_sets])
for v, flag_sets in testsuite.ALL_VARIANT_FLAGS.iteritems()
)
ALL_VARIANT_FLAGS_BOTH = dict(
(v, [flags for flags in testsuite.ALL_VARIANT_FLAGS[v] +
ALL_VARIANT_FLAGS_STRICT[v]])
for v in testsuite.ALL_VARIANT_FLAGS
)
ALL_VARIANTS = {
'nostrict': testsuite.ALL_VARIANT_FLAGS,
'strict': ALL_VARIANT_FLAGS_STRICT,
'both': ALL_VARIANT_FLAGS_BOTH,
}
class LegacyVariantsGenerator(testsuite.LegacyVariantsGenerator):
def GetFlagSets(self, test, variant):
test_record = test.test_record
if "noStrict" in test_record:
return ALL_VARIANTS["nostrict"][variant]
if "onlyStrict" in test_record:
return ALL_VARIANTS["strict"][variant]
return ALL_VARIANTS["both"][variant]
class VariantsGenerator(testsuite.VariantsGenerator):
def gen(self, test):
......@@ -184,9 +158,6 @@ class TestSuite(testsuite.TestSuite):
def _test_class(self):
return TestCase
def _LegacyVariantsGeneratorFactory(self):
return LegacyVariantsGenerator
def _variants_gen_class(self):
return VariantsGenerator
......
......@@ -58,9 +58,6 @@ class TestSuite(testsuite.TestSuite):
def _variants_gen_class(self):
return VariantsGenerator
def _LegacyVariantsGeneratorFactory(self):
return testsuite.StandardLegacyVariantsGenerator
class TestCase(testcase.TestCase):
def _get_suite_flags(self):
......
......@@ -34,32 +34,12 @@ from . import command
from . import statusfile
from . import utils
from ..objects.testcase import TestCase
from variants import ALL_VARIANTS, ALL_VARIANT_FLAGS
from .variants import ALL_VARIANTS, ALL_VARIANT_FLAGS
STANDARD_VARIANT = set(["default"])
class LegacyVariantsGenerator(object):
def __init__(self, suite, variants):
self.suite = suite
self.all_variants = variants
self.standard_variant = STANDARD_VARIANT & variants
def FilterVariantsByTest(self, test):
if test.only_standard_variant:
return self.standard_variant
return self.all_variants
def GetFlagSets(self, test, variant):
return ALL_VARIANT_FLAGS[variant]
class StandardLegacyVariantsGenerator(LegacyVariantsGenerator):
def FilterVariantsByTest(self, testcase):
return self.standard_variant
class VariantsGenerator(object):
def __init__(self, variants):
self._all_variants = [v for v in variants if v in ALL_VARIANTS]
......@@ -133,20 +113,6 @@ class TestSuite(object):
def ListTests(self):
raise NotImplementedError
def _LegacyVariantsGeneratorFactory(self):
"""The variant generator class to be used."""
return LegacyVariantsGenerator
def CreateLegacyVariantsGenerator(self, variants):
"""Return a generator for the testing variants of this suite.
Args:
variants: List of variant names to be run as specified by the test
runner.
Returns: An object of type LegacyVariantsGenerator.
"""
return self._LegacyVariantsGeneratorFactory()(self, set(variants))
def get_variants_gen(self, variants):
return self._variants_gen_class()(variants)
......
......@@ -49,10 +49,6 @@ class TestCase(object):
self.variant = None # name of the used testing variant
self.variant_flags = [] # list of strings, flags specific to this test
self.id = None # int, used to map result back to TestCase instance
self.run = 1 # The nth time this test is executed.
self.cmd = None
# Fields used by the test processors.
self.origin = None # Test that this test is subtest of.
self.processor = None # Processor that created this subtest.
......@@ -61,12 +57,13 @@ class TestCase(object):
# Test config contains information needed to build the command.
self._test_config = test_config
# Overrides default random seed from test_config if specified.
self._random_seed = None
self._random_seed = None # Overrides test config value if not None
# Outcomes
self._statusfile_outcomes = None
self.expected_outcomes = None
self._statusfile_flags = None
self._prepare_outcomes()
def create_subtest(self, processor, subtest_id, variant=None, flags=None,
......@@ -86,37 +83,6 @@ class TestCase(object):
subtest._prepare_outcomes()
return subtest
def create_variant(self, variant, flags, procid_suffix=None,
random_seed=None):
"""Makes a shallow copy of the object and updates variant, variant flags and
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.
random_seed - random seed to use in this variant. None means use base
test's random seed.
"""
other = copy.copy(self)
if not self.variant_flags:
other.variant_flags = flags
else:
other.variant_flags = self.variant_flags + flags
other.variant = variant
if procid_suffix:
other.procid += '[%s-%s]' % (variant, procid_suffix)
else:
other.procid += '[%s]' % variant
if random_seed:
other._random_seed = random_seed
other._prepare_outcomes(variant != self.variant)
return other
def _prepare_outcomes(self, force_update=True):
if force_update or self._statusfile_outcomes is None:
def is_flag(outcome):
......@@ -303,18 +269,9 @@ class TestCase(object):
# Make sure that test cases are sorted correctly if sorted without
# key function. But using a key function is preferred for speed.
return cmp(
(self.suite.name, self.name, self.variant_flags),
(other.suite.name, other.name, other.variant_flags)
(self.suite.name, self.name, self.variant),
(other.suite.name, other.name, other.variant)
)
def __hash__(self):
return hash((self.suite.name, self.name, ''.join(self.variant_flags)))
def __str__(self):
return self.suite.name + '/' + self.name
# TODO(majeski): Rename `id` field or `get_id` function since they're
# unrelated.
def get_id(self):
return '%s/%s %s' % (
self.suite.name, self.name, ' '.join(self.variant_flags))
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