Changeset 246303 in webkit


Ignore:
Timestamp:
Jun 10, 2019 10:05:19 PM (5 years ago)
Author:
Dewei Zhu
Message:

Extend run-benchmark to allow diagnosing before closing browser on test failure.
https://bugs.webkit.org/show_bug.cgi?id=198729

Reviewed by Ryosuke Niwa.

Add '--diagnose-directory' option to store diagnose information when test failed.

  • Scripts/webkitpy/benchmark_runner/benchmark_runner.py:

(BenchmarkRunner.init):

  • Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:

(BrowserDriver.diagnose_test_failure): Add default no-op function to base class.

  • Scripts/webkitpy/benchmark_runner/run_benchmark.py: Added '--diagnose-directory' option.

(parse_args):
(run_benchmark_plan):

  • Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:

(WebDriverBenchmarkRunner._run_one_test): Added 'diagnose_test_failure' invocation on test failure.

  • Scripts/webkitpy/benchmark_runner/webserver_benchmark_runner.py:

(WebServerBenchmarkRunner.init):
(WebServerBenchmarkRunner._run_one_test): Added 'diagnose_test_failure' invocation on test failure.

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r246285 r246303  
     12019-06-10  Dewei Zhu  <dewei_zhu@apple.com>
     2
     3        Extend run-benchmark to allow diagnosing before closing browser on test failure.
     4        https://bugs.webkit.org/show_bug.cgi?id=198729
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Add '--diagnose-directory' option to store diagnose information when test failed.
     9
     10        * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
     11        (BenchmarkRunner.__init__):
     12        * Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
     13        (BrowserDriver.diagnose_test_failure): Add default no-op function to base class.
     14        * Scripts/webkitpy/benchmark_runner/run_benchmark.py: Added '--diagnose-directory' option.
     15        (parse_args):
     16        (run_benchmark_plan):
     17        * Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:
     18        (WebDriverBenchmarkRunner._run_one_test): Added 'diagnose_test_failure' invocation on test failure.
     19        * Scripts/webkitpy/benchmark_runner/webserver_benchmark_runner.py:
     20        (WebServerBenchmarkRunner.__init__):
     21        (WebServerBenchmarkRunner._run_one_test): Added 'diagnose_test_failure' invocation on test failure.
     22
    1232019-06-10  Sam Weinig  <weinig@apple.com>
    224
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py

    r244730 r246303  
    2424    name = 'benchmark_runner'
    2525
    26     def __init__(self, plan_file, local_copy, count_override, build_dir, output_file, platform, browser, browser_path, scale_unit=True, show_iteration_values=False, device_id=None):
     26    def __init__(self, plan_file, local_copy, count_override, build_dir, output_file, platform, browser, browser_path, scale_unit=True, show_iteration_values=False, device_id=None, diagnose_dir=None):
    2727        try:
    2828            plan_file = self._find_plan_file(plan_file)
     
    3939                self._browser_path = browser_path
    4040                self._build_dir = os.path.abspath(build_dir) if build_dir else None
     41                self._diagnose_dir = os.path.abspath(diagnose_dir) if diagnose_dir else None
    4142                self._output_file = output_file
    4243                self._scale_unit = scale_unit
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py

    r244730 r246303  
    4343        pass
    4444
     45    def diagnose_test_failure(self, debug_directory, error):
     46        pass
     47
    4548    @property
    4649    def webdriver_binary_path(self):
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/run_benchmark.py

    r239522 r246303  
    4848    parser.add_argument('--device-id', default=None, help='Undocumented option for mobile device testing.')
    4949    parser.add_argument('--debug', action='store_true', help='Enable debug logging.')
     50    parser.add_argument('--diagnose-directory', dest='diagnose_dir', default=None, help='Directory for storing diagnose information on test failure. It\'s up to browser driver implementation when this option is not specified.')
    5051    parser.add_argument('--no-adjust-unit', dest='scale_unit', action='store_false', help="Don't convert to scientific notation.")
    5152    parser.add_argument('--show-iteration-values', dest='show_iteration_values', action='store_true', help="Show the measured value for each iteration in addition to averages.")
     
    6970def run_benchmark_plan(args, plan):
    7071    benchmark_runner_class = benchmark_runner_subclasses[args.driver]
    71     runner = benchmark_runner_class(plan, args.local_copy, args.count, args.build_dir, args.output_file, args.platform, args.browser, args.browser_path, args.scale_unit, args.show_iteration_values, args.device_id)
     72    runner = benchmark_runner_class(plan, args.local_copy, args.count, args.build_dir, args.output_file, args.platform, args.browser, args.browser_path, args.scale_unit, args.show_iteration_values, args.device_id, args.diagnose_dir)
    7273    runner.execute()
    7374
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py

    r239522 r246303  
    2727            result = WebDriverWait(driver, self._plan['timeout'], poll_frequency=1.0).until(self._get_result)
    2828            driver.quit()
     29        except Exception as error:
     30            self._browser_driver.diagnose_test_failure(self._diagnose_dir, error)
     31            raise error
    2932        finally:
    3033            self._browser_driver.close_browsers()
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/webserver_benchmark_runner.py

    r239522 r246303  
    1616    name = 'webserver'
    1717
    18     def __init__(self, plan_file, local_copy, count_override, build_dir, output_file, platform, browser, browser_path, scale_unit=True, show_iteration_values=False, device_id=None):
     18    def __init__(self, plan_file, local_copy, count_override, build_dir, output_file, platform, browser, browser_path, scale_unit=True, show_iteration_values=False, device_id=None, diagnose_dir=None):
    1919        self._http_server_driver = HTTPServerDriverFactory.create(platform)
    2020        self._http_server_driver.set_device_id(device_id)
    21         super(WebServerBenchmarkRunner, self).__init__(plan_file, local_copy, count_override, build_dir, output_file, platform, browser, browser_path, scale_unit, show_iteration_values, device_id)
     21        super(WebServerBenchmarkRunner, self).__init__(plan_file, local_copy, count_override, build_dir, output_file, platform, browser, browser_path, scale_unit, show_iteration_values, device_id, diagnose_dir)
    2222
    2323    def _get_result(self, test_url):
     
    3434            with Timeout(self._plan['timeout']):
    3535                result = self._get_result(url)
     36        except Exception as error:
     37            self._browser_driver.diagnose_test_failure(self._diagnose_dir, error)
     38            raise error
    3639        finally:
    3740            self._browser_driver.close_browsers()
Note: See TracChangeset for help on using the changeset viewer.