Commit 96d06a63 authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

[test] Fix args parsing and name filter

Bug: v8:6917
Cq-Include-Trybots: luci.v8.try:v8_linux64_fyi_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I14c7e0a140bfe828ee8199606db36cab12be14ff
Reviewed-on: https://chromium-review.googlesource.com/868135
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50649}
parent b9a46900
...@@ -98,7 +98,7 @@ class LegacyVariantsGenerator(testsuite.LegacyVariantsGenerator): ...@@ -98,7 +98,7 @@ class LegacyVariantsGenerator(testsuite.LegacyVariantsGenerator):
class VariantsGenerator(testsuite.VariantsGenerator): class VariantsGenerator(testsuite.VariantsGenerator):
def _variants_gen(self, test): def gen(self, test):
flags_set = self._get_flags_set(test) flags_set = self._get_flags_set(test)
test_record = test.test_record test_record = test.test_record
for n, variant in enumerate(self._get_variants(test)): for n, variant in enumerate(self._get_variants(test)):
...@@ -111,9 +111,6 @@ class VariantsGenerator(testsuite.VariantsGenerator): ...@@ -111,9 +111,6 @@ class VariantsGenerator(testsuite.VariantsGenerator):
yield (variant, flags, str(n)) yield (variant, flags, str(n))
yield (variant, flags + ['--use-strict'], 'strict-%d' % n) yield (variant, flags + ['--use-strict'], 'strict-%d' % n)
def _get_flags_set(self, test):
return testsuite.ALL_VARIANT_FLAGS
class TestSuite(testsuite.TestSuite): class TestSuite(testsuite.TestSuite):
# Match the (...) in '/path/to/v8/test/test262/subdir/test/(...).js' # Match the (...) in '/path/to/v8/test/test262/subdir/test/(...).js'
......
...@@ -212,6 +212,7 @@ class BaseTestRunner(object): ...@@ -212,6 +212,7 @@ class BaseTestRunner(object):
parser.print_help() parser.print_help()
raise raise
args = self._parse_test_args(args)
suites = self._get_suites(args, options.verbose) suites = self._get_suites(args, options.verbose)
self._setup_env() self._setup_env()
...@@ -451,12 +452,7 @@ class BaseTestRunner(object): ...@@ -451,12 +452,7 @@ class BaseTestRunner(object):
return 'external_symbolizer_path=%s' % external_symbolizer_path return 'external_symbolizer_path=%s' % external_symbolizer_path
def _get_suites(self, args, verbose=False): def _parse_test_args(self, args):
names = self._args_to_suite_names(args)
return self._load_suites(names, verbose)
def _args_to_suite_names(self, args):
# Use default tests if no test configuration was provided at the cmd line.
if not args: if not args:
args = self._get_default_suite_names() args = self._get_default_suite_names()
...@@ -465,8 +461,14 @@ class BaseTestRunner(object): ...@@ -465,8 +461,14 @@ class BaseTestRunner(object):
def expand_test_group(name): def expand_test_group(name):
return TEST_MAP.get(name, [name]) return TEST_MAP.get(name, [name])
args = reduce(list.__add__, map(expand_test_group, args), []) return reduce(list.__add__, map(expand_test_group, args), [])
def _get_suites(self, args, verbose=False):
names = self._args_to_suite_names(args)
return self._load_suites(names, verbose)
def _args_to_suite_names(self, args):
# Use default tests if no test configuration was provided at the cmd line.
all_names = set(utils.GetSuitePaths(os.path.join(self.basedir, 'test'))) all_names = set(utils.GetSuitePaths(os.path.join(self.basedir, 'test')))
args_names = OrderedDict([(arg.split('/')[0], None) for arg in args]) # set args_names = OrderedDict([(arg.split('/')[0], None) for arg in args]) # set
return [name for name in args_names if name in all_names] return [name for name in args_names if name in all_names]
......
...@@ -62,7 +62,7 @@ class NameFilterProc(base.TestProcFilter): ...@@ -62,7 +62,7 @@ class NameFilterProc(base.TestProcFilter):
for a in args: for a in args:
argpath = a.split('/') argpath = a.split('/')
suitename = argpath[0] suitename = argpath[0]
path = '/'.join(argpath[1:]) path = '/'.join(argpath[1:]) or '*'
self._globs[suitename].append(path) self._globs[suitename].append(path)
for s, globs in self._globs.iteritems(): for s, globs in self._globs.iteritems():
......
...@@ -305,9 +305,8 @@ class SystemTest(unittest.TestCase): ...@@ -305,9 +305,8 @@ class SystemTest(unittest.TestCase):
# This is redundant to the command. Needs investigation. # This is redundant to the command. Needs investigation.
self.check_cleaned_json_output('expected_test_results1.json', json_path) self.check_cleaned_json_output('expected_test_results1.json', json_path)
# FIXME(majeski): This runs 0 tests. def testFlakeWithRerunAndJSONProc(self):
#def testFlakeWithRerunAndJSONProc(self): self.testFlakeWithRerunAndJSON(infra_staging=True)
# self.testFlakeWithRerunAndJSON(infra_staging=True)
def testFlakeWithRerunAndJSON(self, infra_staging=False): def testFlakeWithRerunAndJSON(self, infra_staging=False):
"""Test re-running a failing test and output to json.""" """Test re-running a failing test and output to json."""
...@@ -324,13 +323,13 @@ class SystemTest(unittest.TestCase): ...@@ -324,13 +323,13 @@ class SystemTest(unittest.TestCase):
'sweet', 'sweet',
infra_staging=infra_staging, infra_staging=infra_staging,
) )
self.assertIn('Running 1 tests', result.stdout, result)
if not infra_staging: if not infra_staging:
self.assertIn('Running 1 tests', result.stdout, result)
self.assertIn( self.assertIn(
'Done running sweet/bananaflakes: FAIL', result.stdout, result) 'Done running sweet/bananaflakes: FAIL', result.stdout, result)
self.assertIn('1 tests failed', result.stdout, result) self.assertIn('1 tests failed', result.stdout, result)
else: else:
# TODO(majeski): Evaluate if this output is reasonable for a FAIL, PASS. self.assertIn('Running 1 base tests', result.stdout, result)
self.assertIn( self.assertIn(
'Done running sweet/bananaflakes: pass', result.stdout, result) 'Done running sweet/bananaflakes: pass', result.stdout, result)
self.assertIn('All tests succeeded', result.stdout, result) self.assertIn('All tests succeeded', result.stdout, result)
......
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