Commit 3e49d5cb authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[run_web_tests] Remove some deperecated options

--add-platform-exceptions
--new-baseline
--new-flag-specific-baseline
--new-test-results
  deprecated on 6/5/2017 or 10/16/2017. They have been issuing errors
  since deprecated so most developers should have already know their
  deprecation.

--run-singly
  deprecated on 8/22/2013.

--pixel-test-directories
  has been useless since we switched to run pixel-tests by default
  many years ago.

Change-Id: Ia0ca8b33daba664c18373c3710d1d658badb33cf
Reviewed-on: https://chromium-review.googlesource.com/1058387
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarQuinten Yearsley <qyearsley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558578}
parent d0effcfb
......@@ -94,7 +94,7 @@ class LayoutTestRunner(object):
test_inputs,
int(self._options.child_processes),
self._options.fully_parallel,
self._options.run_singly or (self._options.batch_size == 1))
self._options.batch_size == 1)
# We don't have a good way to coordinate the workers so that they don't
# try to run the shards that need a lock. The easiest solution is to
......@@ -271,7 +271,8 @@ class Worker(object):
if test_input.reference_files:
test_input.should_run_pixel_test = True
else:
test_input.should_run_pixel_test = self._port.should_run_as_pixel_test(test_input)
test_input.should_run_pixel_test = self._port.should_run_as_pixel_test(
test_input.test_name)
test_input.should_run_pixel_test_first = (
self._port.should_run_pixel_test_first(test_input.test_name))
......
......@@ -1737,7 +1737,7 @@ class Port(object):
return suite.reference_args
return []
def should_run_as_pixel_test(self, test_input):
def should_run_as_pixel_test(self, test_name):
"""Whether a test should run as pixel test (when there is no reference).
This provides the *default* value for whether a test should run as
......@@ -1746,13 +1746,9 @@ class Port(object):
"""
if not self._options.pixel_tests:
return False
if self._options.pixel_test_directories:
return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories)
if self.should_run_in_wpt_mode(test_input.test_name):
# WPT should not run as pixel test by default, except reftests
# (for which reference files would exist).
return False
return True
# WPT should not run as pixel test by default, except reftests
# (for which reference files would exist).
return not self.should_run_in_wpt_mode(test_name)
def should_run_pixel_test_first(self, test_name):
"""Returns true if the directory of the test (or the base test if the
......
......@@ -577,23 +577,15 @@ class PortTest(unittest.TestCase):
# With the --no-pixel-tests flag, no tests should run as pixel tests.
options = optparse.Values({'pixel_tests': False})
port = self.make_port(options=options)
self.assertFalse(port.should_run_as_pixel_test(TestInput('fast/css/001.html')))
def test_should_run_as_pixel_test_with_pixel_test_directories(self):
# When --pixel-test-directory is supplied, only tests in those
# directories are allowed to run as pixel tests.
options = optparse.Values({'pixel_tests': True, 'pixel_test_directories': ['foo']})
port = self.make_port(options=options)
self.assertTrue(port.should_run_as_pixel_test(TestInput('foo/bar.html')))
self.assertFalse(port.should_run_as_pixel_test(TestInput('bar/baz.html')))
self.assertFalse(port.should_run_as_pixel_test('fast/css/001.html'))
def test_should_run_as_pixel_test_default(self):
options = optparse.Values({'pixel_tests': True, 'pixel_test_directories': None})
options = optparse.Values({'pixel_tests': True})
port = self.make_port(options=options)
self.assertFalse(port.should_run_as_pixel_test(TestInput('external/wpt/dom/interfaces.html')))
self.assertFalse(port.should_run_as_pixel_test(TestInput('virtual/a-name/external/wpt/dom/interfaces.html')))
self.assertFalse(port.should_run_as_pixel_test(TestInput('harness-tests/wpt/console_logging.html')))
self.assertTrue(port.should_run_as_pixel_test(TestInput('fast/css/001.html')))
self.assertFalse(port.should_run_as_pixel_test('external/wpt/dom/interfaces.html'))
self.assertFalse(port.should_run_as_pixel_test('virtual/a-name/external/wpt/dom/interfaces.html'))
self.assertFalse(port.should_run_as_pixel_test('harness-tests/wpt/console_logging.html'))
self.assertTrue(port.should_run_as_pixel_test('fast/css/001.html'))
def test_is_slow_wpt_test(self):
port = self.make_port(with_tests=True)
......
......@@ -79,6 +79,15 @@ def main(argv, stdout, stderr):
def deprecate(option, opt_str, _, parser):
"""
Prints a error message for a deprecated option.
Usage:
optparse.make_option(
'--some-option',
action='callback',
callback=deprecate,
help='....')
"""
parser.error('%s: %s' % (opt_str, option.help))
......@@ -131,11 +140,6 @@ def parse_args(args):
option_group_definitions.append(
('Results Options', [
optparse.make_option(
'--add-platform-exceptions',
action='callback',
callback=deprecate,
help=('Deprecated. Use "blink_tool.py rebaseline*" instead.')),
optparse.make_option(
'--additional-driver-flag',
'--additional-drt-flag',
......@@ -193,21 +197,6 @@ def parse_args(args):
optparse.make_option(
'--json-failing-test-results',
help='Path to write the JSON test results for only *failing* tests.'),
optparse.make_option(
'--new-baseline',
action='callback',
callback=deprecate,
help=('Deprecated. Use "blink_tool.py rebaseline*" instead.')),
optparse.make_option(
'--new-flag-specific-baseline',
action='callback',
callback=deprecate,
help='Deprecated. Use --copy-baselines --reset-results instead.'),
optparse.make_option(
'--new-test-results',
action='callback',
callback=deprecate,
help='Deprecated. Use --reset-results instead.'),
optparse.make_option(
'--no-show-results',
dest='show_results',
......@@ -229,19 +218,6 @@ def parse_args(args):
action='store_false',
default=True,
help='Disable pixel-to-pixel PNG comparisons'),
# FIXME: we should support a comma separated list with
# --pixel-test-directory as well.
optparse.make_option(
'--pixel-test-directory',
dest='pixel_test_directories',
action='append',
default=[],
help=('A directory where it is allowed to execute tests as pixel tests. Specify '
'multiple times to add multiple directories. This option implies '
'--pixel-tests. If specified, only those tests will be executed as pixel '
'tests that are located in one of the' ' directories enumerated with the '
'option. Some ports may ignore this option while others can have a default '
'value that can be overridden here.')),
optparse.make_option(
'--reset-results',
action='store_true',
......@@ -410,11 +386,6 @@ def parse_args(args):
type=int,
help=('Shard index [0..total_shards) of this test run. '
'Must be used with --total-shards.')),
optparse.make_option(
'--run-singly',
action='store_true',
default=False,
help='DEPRECATED, same as --batch-size=1 --verbose'),
optparse.make_option(
'--seed',
type='int',
......@@ -567,26 +538,6 @@ def _set_up_derived_options(port, options, args):
additional_platform_directories.append(port.host.filesystem.abspath(path))
options.additional_platform_directory = additional_platform_directories
if options.pixel_test_directories:
options.pixel_tests = True
verified_dirs = set()
pixel_test_directories = options.pixel_test_directories
for directory in pixel_test_directories:
# FIXME: we should support specifying the directories all the ways we support it for additional
# arguments specifying which tests and directories to run. We should also move the logic for that
# to Port.
filesystem = port.host.filesystem
if not filesystem.isdir(filesystem.join(port.layout_tests_dir(), directory)):
_log.warning("'%s' was passed to --pixel-test-directories, which doesn't seem to be a directory", str(directory))
else:
verified_dirs.add(directory)
options.pixel_test_directories = list(verified_dirs)
if options.run_singly:
options.batch_size = 1
options.verbose = True
if not args and not options.test_list and options.smoke is None:
options.smoke = port.default_smoke_test_only()
if options.smoke:
......
......@@ -460,11 +460,6 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
tests_included=True, host=host)
self.assert_contains(err, "All 16 tests ran as expected (8 passed, 8 didn't).\n")
def test_run_singly(self):
batch_tests_run = get_test_batches(['--run-singly'])
for batch in batch_tests_run:
self.assertEqual(len(batch), 1, '%s had too many tests' % ', '.join(batch))
def test_skip_failing_tests(self):
# This tests that we skip both known failing and known flaky tests. Because there are
# no known flaky tests in the default test_expectations, we add additional expectations.
......@@ -652,20 +647,6 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
self.assertEqual(details.summarized_failing_results['tests']['failures']['expected']['crash_then_text.html']['actual'],
'CRASH TEXT')
def test_pixel_test_directories(self):
host = MockHost()
# Both tests have failing checksum. We include only the first in pixel tests so only that should fail.
args = ['--pixel-test-directory', 'failures/unexpected/pixeldir',
'failures/unexpected/pixeldir/image_in_pixeldir.html',
'failures/unexpected/image_not_in_pixeldir.html']
details, _, _ = logging_run(extra_args=args, host=host, tests_included=True)
self.assertEqual(details.exit_code, 1)
expected_token = '"pixeldir":{"image_in_pixeldir.html":{"expected":"PASS","actual":"IMAGE","is_unexpected":true'
json_string = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json')
self.assertTrue(json_string.find(expected_token) != -1)
def test_watch(self):
host = MockHost()
host.user.set_canned_responses(['r', 'r', 'q'])
......
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