Changeset 214377 in webkit


Ignore:
Timestamp:
Mar 24, 2017 2:23:59 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

webkitpy should be able to run API tests
https://bugs.webkit.org/show_bug.cgi?id=170028

Patch by Srinivasan Vijayaraghavan <svijayaraghavan@apple.com> on 2017-03-24
Reviewed by Alexey Proskuryakov.

  • Scripts/webkitpy/common/config/ports.py:

(DeprecatedPort.run_api_tests_command): Added.

  • Scripts/webkitpy/port/base.py:

(Port.api_results_directory): Added.

  • Scripts/webkitpy/tool/steps/runtests.py:

(RunTests.run): Check if we should be running API tests.
(RunTests._run_api_tests): Generate script to run API tests with json output.

  • Scripts/webkitpy/tool/steps/steps_unittest.py: Unit tests.
Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r214372 r214377  
     12017-03-24  Srinivasan Vijayaraghavan  <svijayaraghavan@apple.com>
     2
     3        webkitpy should be able to run API tests
     4        https://bugs.webkit.org/show_bug.cgi?id=170028
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * Scripts/webkitpy/common/config/ports.py:
     9        (DeprecatedPort.run_api_tests_command): Added.
     10        * Scripts/webkitpy/port/base.py:
     11        (Port.api_results_directory): Added.
     12        * Scripts/webkitpy/tool/steps/runtests.py:
     13        (RunTests.run): Check if we should be running API tests.
     14        (RunTests._run_api_tests): Generate script to run API tests with json output.
     15        * Scripts/webkitpy/tool/steps/steps_unittest.py: Unit tests.
     16
    1172017-03-24  Srinivasan Vijayaraghavan  <svijayaraghavan@apple.com>
    218
  • trunk/Tools/Scripts/webkitpy/common/config/ports.py

    r213654 r214377  
    131131        return self.script_shell_command("run-bindings-tests")
    132132
     133    def run_api_tests_command(self, build_style=None):
     134        command = self.script_shell_command("run-api-tests")
     135        return self._append_build_style_flag(command, build_style)
     136
    133137
    134138class IOSPort(DeprecatedPort):
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r213185 r214377  
    815815        return self._build_path()
    816816
     817    def api_results_directory(self):
     818        return self._build_path()
     819
    817820    def results_directory(self):
    818821        """Absolute path to the place to store the test results (uses --results-directory)."""
  • trunk/Tools/Scripts/webkitpy/tool/steps/runtests.py

    r213185 r214377  
    6161        if self._options.group == "jsc":
    6262            self._run_javascriptcore_tests()
     63            return
     64
     65        if self._options.group == "api":
     66            self._run_api_tests()
    6367            return
    6468
     
    170174        args.append("--json-output=%s" % results_file_path)
    171175        self._tool.executive.run_and_throw_if_fail(args, cwd=self._tool.scm().checkout_root)
     176
     177    def _run_api_tests(self):
     178        args = self._tool.deprecated_port().run_api_tests_command(self._options.build_style)
     179        results_directory = self._tool.port_factory.get(options=self._options).api_results_directory()
     180        results_file_path = self._tool.filesystem.join(results_directory, "api_test_results.json")
     181        args.append("--json-output=%s" % results_file_path)
     182        self._tool.executive.run_and_throw_if_fail(args, cwd=self._tool.scm().checkout_root)
  • trunk/Tools/Scripts/webkitpy/tool/steps/steps_unittest.py

    r213722 r214377  
    283283This patch does not have relevant changes.
    284284"""
     285
     286    def test_runtests_api(self):
     287        mock_options = self._step_options()
     288        mock_options.non_interactive = False
     289        mock_options.build_style = "release"
     290        mock_options.group = "api"
     291        step = steps.RunTests(MockTool(log_executive=True), mock_options)
     292        tool = MockTool(log_executive=True)
     293        tool._deprecated_port = DeprecatedPort()
     294        step = steps.RunTests(tool, mock_options)
     295        expected_logs = """MOCK run_and_throw_if_fail: ['Tools/Scripts/run-api-tests', '--release', '--json-output=/tmp/api_test_results.json'], cwd=/mock-checkout
     296"""
     297        OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
     298
     299    def test_runtests_api_debug(self):
     300        mock_options = self._step_options()
     301        mock_options.non_interactive = False
     302        mock_options.build_style = "debug"
     303        mock_options.group = "api"
     304        step = steps.RunTests(MockTool(log_executive=True), mock_options)
     305        tool = MockTool(log_executive=True)
     306        tool._deprecated_port = DeprecatedPort()
     307        step = steps.RunTests(tool, mock_options)
     308        expected_logs = """MOCK run_and_throw_if_fail: ['Tools/Scripts/run-api-tests', '--debug', '--json-output=/tmp/api_test_results.json'], cwd=/mock-checkout
     309"""
     310        OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
Note: See TracChangeset for help on using the changeset viewer.