Title: [257144] trunk/Tools
Revision
257144
Author
[email protected]
Date
2020-02-21 10:08:18 -0800 (Fri, 21 Feb 2020)

Log Message

Stub repositories fail to upload some results due to missing head svn revision
https://bugs.webkit.org/show_bug.cgi?id=207684

Reviewed by Jonathan Bedard.

* Scripts/webkitpy/common/host_mock.py: Added in call for creating stub repo checkout information for upload tests.
(MockHost.__init__):
* Scripts/webkitpy/layout_tests/models/test_run_results.py:
(summarize_results): Changed call to head_svn_revision to port.commits_for_upload() to bring
* Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py:
(SummarizedResultsTest.setUp): Added in new required parameter for testing.
* Scripts/webkitpy/port/base.py:
(Port.commits_for_upload): Removed the forced movement up the systems tree that prevented us
from using mock SCMs and more
* Scripts/webkitpy/port/test.py: Added function to make the checkout_information.json for upload testing.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (257143 => 257144)


--- trunk/Tools/ChangeLog	2020-02-21 18:03:11 UTC (rev 257143)
+++ trunk/Tools/ChangeLog	2020-02-21 18:08:18 UTC (rev 257144)
@@ -1,3 +1,21 @@
+2020-02-20  Matt Lewis  <[email protected]>
+
+        Stub repositories fail to upload some results due to missing head svn revision
+        https://bugs.webkit.org/show_bug.cgi?id=207684
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitpy/common/host_mock.py: Added in call for creating stub repo checkout information for upload tests.
+        (MockHost.__init__):
+        * Scripts/webkitpy/layout_tests/models/test_run_results.py:
+        (summarize_results): Changed call to head_svn_revision to port.commits_for_upload() to bring
+        * Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py:
+        (SummarizedResultsTest.setUp): Added in new required parameter for testing.
+        * Scripts/webkitpy/port/base.py:
+        (Port.commits_for_upload): Removed the forced movement up the systems tree that prevented us 
+        from using mock SCMs and more
+        * Scripts/webkitpy/port/test.py: Added function to make the checkout_information.json for upload testing.
+
 2020-02-21  Diego Pino Garcia  <[email protected]>
 
         [JSCOnly] Add --verbose flag when running _javascript_Core tests

Modified: trunk/Tools/Scripts/webkitpy/common/host_mock.py (257143 => 257144)


--- trunk/Tools/Scripts/webkitpy/common/host_mock.py	2020-02-21 18:03:11 UTC (rev 257143)
+++ trunk/Tools/Scripts/webkitpy/common/host_mock.py	2020-02-21 18:08:18 UTC (rev 257144)
@@ -36,13 +36,15 @@
 
 # New-style ports need to move down into webkitpy.common.
 from webkitpy.port.factory import PortFactory
-from webkitpy.port.test import add_unit_tests_to_mock_filesystem
+from webkitpy.port.test import add_unit_tests_to_mock_filesystem, add_checkout_information_json_to_mock_filesystem
 
 
 class MockHost(MockSystemHost):
-    def __init__(self, log_executive=False, executive_throws_when_run=None, initialize_scm_by_default=True, web=None):
+    def __init__(self, log_executive=False, executive_throws_when_run=None, initialize_scm_by_default=True, web=None, create_stub_repository_files=False):
         MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
         add_unit_tests_to_mock_filesystem(self.filesystem)
+        if create_stub_repository_files:
+            add_checkout_information_json_to_mock_filesystem(self.filesystem)
         self.web = web or MockWeb()
 
         self._checkout = MockCheckout()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py (257143 => 257144)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py	2020-02-21 18:03:11 UTC (rev 257143)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py	2020-02-21 18:08:18 UTC (rev 257144)
@@ -359,7 +359,7 @@
         # FIXME: Do we really need to populate this both here and in the json_results_generator?
         if port_obj.get_option("builder_name"):
             port_obj.host.initialize_scm()
-            results['revision'] = port_obj.host.scm().head_svn_revision()
+            results['revision'] = port_obj.commits_for_upload()[0]['id']
     except Exception as e:
         _log.warn("Failed to determine svn revision for checkout (cwd: %s, webkit_base: %s), leaving 'revision' key blank in full_results.json.\n%s" % (port_obj._filesystem.getcwd(), port_obj.path_from_webkit_base(), e))
         # Handle cases where we're running outside of version control.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py (257143 => 257144)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py	2020-02-21 18:03:11 UTC (rev 257143)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py	2020-02-21 18:08:18 UTC (rev 257144)
@@ -147,7 +147,7 @@
 
 class SummarizedResultsTest(unittest.TestCase):
     def setUp(self):
-        host = MockHost(initialize_scm_by_default=False)
+        host = MockHost(initialize_scm_by_default=False, create_stub_repository_files=True)
         self.port = host.port_factory.get(port_name='test', options=MockOptions(http=True, pixel_tests=False, world_leaks=False))
 
     def test_no_svn_revision(self):

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (257143 => 257144)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2020-02-21 18:03:11 UTC (rev 257143)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2020-02-21 18:08:18 UTC (rev 257144)
@@ -1598,13 +1598,11 @@
     def commits_for_upload(self):
         from webkitpy.results.upload import Upload
 
+        self.host.initialize_scm()
         repos = {}
         if port_config.apple_additions() and getattr(port_config.apple_additions(), 'repos', False):
             repos = port_config.apple_additions().repos()
-
-        up = os.path.dirname
-        repos['webkit'] = up(up(up(up(up(os.path.abspath(__file__))))))
-
+        repos['webkit'] = self.host.scm().checkout_root
         commits = []
         for repo_id, path in repos.items():
             scm = SCMDetector(self._filesystem, self._executive).detect_scm_system(path)

Modified: trunk/Tools/Scripts/webkitpy/port/test.py (257143 => 257144)


--- trunk/Tools/Scripts/webkitpy/port/test.py	2020-02-21 18:03:11 UTC (rev 257143)
+++ trunk/Tools/Scripts/webkitpy/port/test.py	2020-02-21 18:08:18 UTC (rev 257144)
@@ -282,6 +282,7 @@
 
 LAYOUT_TEST_DIR = '/test.checkout/LayoutTests'
 PERF_TEST_DIR = '/test.checkout/PerformanceTests'
+TEST_DIR = '/mock-checkout'
 
 
 # Here we synthesize an in-memory filesystem from the test list
@@ -365,6 +366,12 @@
     filesystem.clear_written_files()
 
 
+def add_checkout_information_json_to_mock_filesystem(filesystem):
+    if not filesystem.exists(TEST_DIR):
+        filesystem.maybe_make_directory(TEST_DIR)
+    filesystem.write_text_file(TEST_DIR + '/checkout_information.json', '{ "branch": "trunk", "id": "2738499" }')
+
+
 class TestPort(Port):
     port_name = 'test'
     default_port_name = 'test-mac-leopard'
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to