Title: [214377] trunk/Tools
Revision
214377
Author
[email protected]
Date
2017-03-24 14:23:59 -0700 (Fri, 24 Mar 2017)

Log Message

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

Patch by Srinivasan Vijayaraghavan <[email protected]> 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.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (214376 => 214377)


--- trunk/Tools/ChangeLog	2017-03-24 21:14:37 UTC (rev 214376)
+++ trunk/Tools/ChangeLog	2017-03-24 21:23:59 UTC (rev 214377)
@@ -1,5 +1,21 @@
 2017-03-24  Srinivasan Vijayaraghavan  <[email protected]>
 
+        webkitpy should be able to run API tests
+        https://bugs.webkit.org/show_bug.cgi?id=170028
+
+        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.
+
+2017-03-24  Srinivasan Vijayaraghavan  <[email protected]>
+
         Add JSON results for API tests
         https://bugs.webkit.org/show_bug.cgi?id=170021
 

Modified: trunk/Tools/Scripts/webkitpy/common/config/ports.py (214376 => 214377)


--- trunk/Tools/Scripts/webkitpy/common/config/ports.py	2017-03-24 21:14:37 UTC (rev 214376)
+++ trunk/Tools/Scripts/webkitpy/common/config/ports.py	2017-03-24 21:23:59 UTC (rev 214377)
@@ -130,7 +130,11 @@
     def run_bindings_tests_command(self):
         return self.script_shell_command("run-bindings-tests")
 
+    def run_api_tests_command(self, build_style=None):
+        command = self.script_shell_command("run-api-tests")
+        return self._append_build_style_flag(command, build_style)
 
+
 class IOSPort(DeprecatedPort):
     port_flag_name = "ios-device"
 

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (214376 => 214377)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2017-03-24 21:14:37 UTC (rev 214376)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2017-03-24 21:23:59 UTC (rev 214377)
@@ -814,6 +814,9 @@
     def bindings_results_directory(self):
         return self._build_path()
 
+    def api_results_directory(self):
+        return self._build_path()
+
     def results_directory(self):
         """Absolute path to the place to store the test results (uses --results-directory)."""
         if not self._results_directory:

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/runtests.py (214376 => 214377)


--- trunk/Tools/Scripts/webkitpy/tool/steps/runtests.py	2017-03-24 21:14:37 UTC (rev 214376)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/runtests.py	2017-03-24 21:23:59 UTC (rev 214377)
@@ -62,6 +62,10 @@
             self._run_javascriptcore_tests()
             return
 
+        if self._options.group == "api":
+            self._run_api_tests()
+            return
+
         if self._options.group == "bindings":
             self._run_bindings_tests()
             return
@@ -169,3 +173,10 @@
         results_file_path = self._tool.filesystem.join(results_directory, "bindings_test_results.json")
         args.append("--json-output=%s" % results_file_path)
         self._tool.executive.run_and_throw_if_fail(args, cwd=self._tool.scm().checkout_root)
+
+    def _run_api_tests(self):
+        args = self._tool.deprecated_port().run_api_tests_command(self._options.build_style)
+        results_directory = self._tool.port_factory.get(options=self._options).api_results_directory()
+        results_file_path = self._tool.filesystem.join(results_directory, "api_test_results.json")
+        args.append("--json-output=%s" % results_file_path)
+        self._tool.executive.run_and_throw_if_fail(args, cwd=self._tool.scm().checkout_root)

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/steps_unittest.py (214376 => 214377)


--- trunk/Tools/Scripts/webkitpy/tool/steps/steps_unittest.py	2017-03-24 21:14:37 UTC (rev 214376)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/steps_unittest.py	2017-03-24 21:23:59 UTC (rev 214377)
@@ -282,3 +282,29 @@
         expected_logs = """Checking relevance of patch
 This patch does not have relevant changes.
 """
+
+    def test_runtests_api(self):
+        mock_options = self._step_options()
+        mock_options.non_interactive = False
+        mock_options.build_style = "release"
+        mock_options.group = "api"
+        step = steps.RunTests(MockTool(log_executive=True), mock_options)
+        tool = MockTool(log_executive=True)
+        tool._deprecated_port = DeprecatedPort()
+        step = steps.RunTests(tool, mock_options)
+        expected_logs = """MOCK run_and_throw_if_fail: ['Tools/Scripts/run-api-tests', '--release', '--json-output=/tmp/api_test_results.json'], cwd=/mock-checkout
+"""
+        OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
+
+    def test_runtests_api_debug(self):
+        mock_options = self._step_options()
+        mock_options.non_interactive = False
+        mock_options.build_style = "debug"
+        mock_options.group = "api"
+        step = steps.RunTests(MockTool(log_executive=True), mock_options)
+        tool = MockTool(log_executive=True)
+        tool._deprecated_port = DeprecatedPort()
+        step = steps.RunTests(tool, mock_options)
+        expected_logs = """MOCK run_and_throw_if_fail: ['Tools/Scripts/run-api-tests', '--debug', '--json-output=/tmp/api_test_results.json'], cwd=/mock-checkout
+"""
+        OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expected_logs)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to