Changeset 77606 in webkit


Ignore:
Timestamp:
Feb 3, 2011 10:26:26 PM (13 years ago)
Author:
hayato@chromium.org
Message:

2011-02-03 Hayato Ito <hayato@chromium.org>

Reviewed by Eric Seidel.

[NRWT] Remove TestArgs class, which is wrongly used.

https://bugs.webkit.org/show_bug.cgi?id=53063

  • Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
  • Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
  • Scripts/webkitpy/layout_tests/test_types/image_diff.py:
  • Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
  • Scripts/webkitpy/layout_tests/test_types/test_type_base_unittest.py:
  • Scripts/webkitpy/layout_tests/test_types/text_diff.py:
Location:
trunk/Tools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r77605 r77606  
     12011-02-03  Hayato Ito  <hayato@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        [NRWT] Remove TestArgs class, which is wrongly used.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=53063
     8
     9        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
     10        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
     11        * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
     12        * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
     13        * Scripts/webkitpy/layout_tests/test_types/test_type_base_unittest.py:
     14        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
     15
    1162011-02-03  Andrew Wason  <rectalogic@rectalogic.com>
    217
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py

    r77603 r77606  
    8383
    8484    def __init__(self, port, options, worker_number, worker_name,
    85                  test_input, test_types, test_args):
     85                 test_input, test_types):
    8686        """
    8787        Args:
     
    9393          test_types: A list of TestType objects to run the test output
    9494              against.
    95           test_args: A TestArguments object to pass to each TestType.
    9695        """
    9796
     
    101100        self._test_input = test_input
    102101        self._test_types = test_types
    103         self._test_args = test_args
    104102        self._driver = None
    105103        self._worker_number = worker_number
     
    116114        self._test_result = single_test_runner.run_single_test(
    117115            self._port, self._options, self._test_input, self._driver,
    118             self._name, self._test_types, self._test_args)
     116            self._name, self._test_type)
    119117        self._driver.stop()
    120118
     
    195193            self._test_types.append(cls(self._port,
    196194                                        self._options.results_directory))
    197         self._test_args = self._get_test_args(worker_number)
    198195
    199196        # Current group of tests we're running.
     
    203200        # Time at which we started running tests from self._current_group.
    204201        self._current_group_start_time = None
    205 
    206     def _get_test_args(self, worker_number):
    207         """Returns the tuple of arguments for tests and for DumpRenderTree."""
    208         test_args = test_type_base.TestArguments()
    209         test_args.new_baseline = self._options.new_baseline
    210         test_args.reset_results = self._options.reset_results
    211 
    212         return test_args
    213202
    214203    def _get_test_type_classes(self):
     
    390379                                  self._name,
    391380                                  test_input,
    392                                   self._test_types,
    393                                   self._test_args)
     381                                  self._test_types)
    394382
    395383        worker.start()
     
    436424        test_result = single_test_runner.run_single_test(
    437425            self._port, self._options, test_input, self._driver, self._name,
    438             self._test_types, self._test_args)
     426            self._test_types)
    439427        self._test_results.append(test_result)
    440428        return test_result
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py

    r77603 r77606  
    4040
    4141
    42 def run_single_test(port, options, test_input, driver, worker_name, test_types, test_args):
     42def run_single_test(port, options, test_input, driver, worker_name, test_types):
    4343    # FIXME: Pull this into TestShellThread._run().
    44     runner = SingleTestRunner(options, port, driver, test_input, worker_name, test_types, test_args)
     44    runner = SingleTestRunner(options, port, driver, test_input, worker_name, test_types)
    4545    return runner.run()
    4646
     
    5656class SingleTestRunner:
    5757
    58     def __init__(self, options, port, driver, test_input, worker_name, test_types, test_args):
     58    def __init__(self, options, port, driver, test_input, worker_name, test_types):
    5959        self._options = options
    6060        self._port = port
     
    6464        self._worker_name = worker_name
    6565        self._test_types = test_types
    66         self._test_args = test_args
    6766        self._testname = port.relative_test_filename(test_input.filename)
    6867
     
    124123        for test_type in self._test_types:
    125124            start_diff_time = time.time()
    126             new_failures = test_type.compare_output(self._port, self._filename,
    127                                                     self._test_args, driver_output,
    128                                                     expected_driver_output)
     125            new_failures = test_type.compare_output(
     126                self._port, self._filename, self._options, driver_output,
     127                expected_driver_output)
    129128            # Don't add any more failures if we already have a crash, so we don't
    130129            # double-report those tests. We do double-report for timeouts since
  • trunk/Tools/Scripts/webkitpy/layout_tests/test_types/image_diff.py

    r77603 r77606  
    8686        return port.diff_image(actual_image, expected_image, diff_filename)
    8787
    88     def compare_output(self, port, filename, test_args, actual_driver_output,
     88    def compare_output(self, port, filename, options, actual_driver_output,
    8989                       expected_driver_output):
    9090        """Implementation of CompareOutput that checks the output image and
     
    9898
    9999        # If we're generating a new baseline, we pass.
    100         if test_args.new_baseline or test_args.reset_results:
     100        if options.new_baseline or options.reset_results:
    101101            self._save_baseline_files(filename, actual_driver_output.image,
    102102                                      actual_driver_output.image_hash,
    103                                       test_args.new_baseline)
     103                                      options.new_baseline)
    104104            return failures
    105105
  • trunk/Tools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py

    r77603 r77606  
    2929
    3030"""Defines the interface TestTypeBase which other test types inherit from.
    31 
    32 Also defines the TestArguments "struct" to pass them additional arguments.
    3331"""
    3432
     
    3937_log = logging.getLogger("webkitpy.layout_tests.test_types.test_type_base")
    4038
    41 
    42 class TestArguments(object):
    43     """Struct-like wrapper for additional arguments needed by
    44     specific tests."""
    45     # Whether to save new baseline results.
    46     new_baseline = False
    47 
    48     # Path to the actual PNG file generated by pixel tests
    49     png_path = None
    50 
    51     # Value of checksum generated by pixel tests.
    52     hash = None
    53 
    54     # Whether to use wdiff to generate by-word diffs.
    55     wdiff = False
    5639
    5740# Python bug workaround.  See the wdiff code in WriteOutputFiles for an
     
    140123        return fs.splitext(output_filename)[0] + modifier
    141124
    142     def compare_output(self, port, filename, test_args, actual_driver_output,
     125    def compare_output(self, port, filename, options, actual_driver_output,
    143126                        expected_driver_output):
    144127        """Method that compares the output from the test with the
     
    150133          port: object implementing port-specific information and methods
    151134          filename: absolute filename to test file
    152           test_args: a TestArguments object holding optional additional
    153               arguments
     135          options: command line argument object from optparse
    154136          actual_driver_output: a DriverOutput object which represents actual test
    155137              output
  • trunk/Tools/Scripts/webkitpy/layout_tests/test_types/test_type_base_unittest.py

    r73256 r77606  
    4141        self.assertRaises(NotImplementedError, test_type.compare_output,
    4242                          None, "foo.txt", '',
    43                           test_type_base.TestArguments(), 'Debug')
     43                          {}, 'Debug')
    4444
    4545
  • trunk/Tools/Scripts/webkitpy/layout_tests/test_types/text_diff.py

    r77603 r77606  
    5454        return output.replace("\r\r\n", "\r\n").replace("\r\n", "\n")
    5555
    56     def compare_output(self, port, filename, test_args, actual_driver_output,
     56    def compare_output(self, port, filename, options, actual_driver_output,
    5757                        expected_driver_output):
    5858        """Implementation of CompareOutput that checks the output text against
     
    6161
    6262        # If we're generating a new baseline, we pass.
    63         if test_args.new_baseline or test_args.reset_results:
     63        if options.new_baseline or options.reset_results:
    6464            # Although all DumpRenderTree output should be utf-8, we do not
    6565            # ever decode it inside run-webkit-tests.  For some tests
     
    6767            self._save_baseline_data(filename, actual_driver_output.text,
    6868                                     ".txt", encoding=None,
    69                                      generate_new_baseline=test_args.new_baseline)
     69                                     generate_new_baseline=options.new_baseline)
    7070            return failures
    7171
Note: See TracChangeset for help on using the changeset viewer.