Title: [146691] trunk/Tools
Revision
146691
Author
[email protected]
Date
2013-03-22 17:31:14 -0700 (Fri, 22 Mar 2013)

Log Message

EWS should use a human readable port name when uploading layout test archives
https://bugs.webkit.org/show_bug.cgi?id=113099

Reviewed by Dirk Pranke.

Use new port's object's name() method to report human readable port names.
This will also help us resolving the bug to apply layout test results posted by EWS.

* Scripts/webkitpy/tool/bot/botinfo.py:
(BotInfo.__init__): Take port's name.
(BotInfo.summary_text):

* Scripts/webkitpy/tool/bot/botinfo_unittest.py:
(BotInfoTest.test_summary_text):

* Scripts/webkitpy/tool/bot/flakytestreporter.py:
(FlakyTestReporter.__init__): Preserve the old behavior since we don't have a real port object here.

* Scripts/webkitpy/tool/commands/queues.py:
(PatchProcessingQueue.__init__): Initialize self._port.
(PatchProcessingQueue._upload_results_archive_for_patch): Intansitate a real port object if needed,
and use that for the attachment filename and the comment posted.

* Scripts/webkitpy/tool/commands/queues_unittest.py:
(PatchProcessingQueueTest.test_upload_results_archive_for_patch): Port name is updated to be
"mac-snowleopard" as expected for TestPort.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (146690 => 146691)


--- trunk/Tools/ChangeLog	2013-03-23 00:26:19 UTC (rev 146690)
+++ trunk/Tools/ChangeLog	2013-03-23 00:31:14 UTC (rev 146691)
@@ -1,3 +1,32 @@
+2013-03-22  Ryosuke Niwa  <[email protected]>
+
+        EWS should use a human readable port name when uploading layout test archives
+        https://bugs.webkit.org/show_bug.cgi?id=113099
+
+        Reviewed by Dirk Pranke.
+
+        Use new port's object's name() method to report human readable port names.
+        This will also help us resolving the bug to apply layout test results posted by EWS.
+
+        * Scripts/webkitpy/tool/bot/botinfo.py:
+        (BotInfo.__init__): Take port's name.
+        (BotInfo.summary_text):
+
+        * Scripts/webkitpy/tool/bot/botinfo_unittest.py:
+        (BotInfoTest.test_summary_text):
+
+        * Scripts/webkitpy/tool/bot/flakytestreporter.py:
+        (FlakyTestReporter.__init__): Preserve the old behavior since we don't have a real port object here.
+
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (PatchProcessingQueue.__init__): Initialize self._port.
+        (PatchProcessingQueue._upload_results_archive_for_patch): Intansitate a real port object if needed,
+        and use that for the attachment filename and the comment posted.
+
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        (PatchProcessingQueueTest.test_upload_results_archive_for_patch): Port name is updated to be
+        "mac-snowleopard" as expected for TestPort.
+
 2013-03-22  Roger Fong  <[email protected]>
 
         Unreviewed. Turn off EWS test on Win again.

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/botinfo.py (146690 => 146691)


--- trunk/Tools/Scripts/webkitpy/tool/bot/botinfo.py	2013-03-23 00:26:19 UTC (rev 146690)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/botinfo.py	2013-03-23 00:31:14 UTC (rev 146691)
@@ -29,11 +29,12 @@
 
 # FIXME: We should consider hanging one of these off the tool object.
 class BotInfo(object):
-    def __init__(self, tool):
+    def __init__(self, tool, port_name):
         self._tool = tool
+        self._port_name = port_name
 
     def summary_text(self):
         # bot_id is also stored on the options dictionary on the tool.
         bot_id = self._tool.status_server.bot_id
         bot_id_string = "Bot: %s  " % (bot_id) if bot_id else ""
-        return "%sPort: %s  Platform: %s" % (bot_id_string, self._tool.deprecated_port().name(), self._tool.platform.display_name())
+        return "%sPort: %s  Platform: %s" % (bot_id_string, self._port_name, self._tool.platform.display_name())

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/botinfo_unittest.py (146690 => 146691)


--- trunk/Tools/Scripts/webkitpy/tool/bot/botinfo_unittest.py	2013-03-23 00:26:19 UTC (rev 146690)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/botinfo_unittest.py	2013-03-23 00:31:14 UTC (rev 146691)
@@ -31,6 +31,7 @@
 from webkitpy.tool.bot.botinfo import BotInfo
 from webkitpy.tool.mocktool import MockTool
 from webkitpy.common.net.statusserver_mock import MockStatusServer
+from webkitpy.layout_tests.port.test import TestPort
 
 
 class BotInfoTest(unittest.TestCase):
@@ -38,4 +39,4 @@
     def test_summary_text(self):
         tool = MockTool()
         tool.status_server = MockStatusServer("MockBotId")
-        self.assertEqual(BotInfo(tool).summary_text(), "Bot: MockBotId  Port: MockPort  Platform: MockPlatform 1.0")
+        self.assertEqual(BotInfo(tool, 'port-name').summary_text(), "Bot: MockBotId  Port: port-name  Platform: MockPlatform 1.0")

Modified: trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py (146690 => 146691)


--- trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py	2013-03-23 00:26:19 UTC (rev 146690)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py	2013-03-23 00:31:14 UTC (rev 146691)
@@ -42,7 +42,8 @@
     def __init__(self, tool, bot_name):
         self._tool = tool
         self._bot_name = bot_name
-        self._bot_info = BotInfo(tool)
+        # FIXME: Use the real port object
+        self._bot_info = BotInfo(tool, tool.deprecated_port().name())
 
     def _author_emails_for_test(self, flaky_test):
         test_path = path_for_layout_test(flaky_test)

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues.py (146690 => 146691)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queues.py	2013-03-23 00:26:19 UTC (rev 146690)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues.py	2013-03-23 00:31:14 UTC (rev 146691)
@@ -255,6 +255,10 @@
     # Subclasses must override.
     port_name = None
 
+    def __init__(self, options=None):
+        self._port = None  # We can't instantiate port here because tool isn't avaialble.
+        AbstractPatchQueue.__init__(self, options)
+
     # FIXME: This is a hack to map between the old port names and the new port names.
     def _new_port_name_from_old(self, port_name):
         # The new port system has no concept of xvfb yet.
@@ -278,8 +282,11 @@
         self._port = self._tool.port_factory.get(self._new_port_name_from_old(self.port_name))
 
     def _upload_results_archive_for_patch(self, patch, results_archive_zip):
+        if not self._port:
+            self._port = self._tool.port_factory.get(self._new_port_name_from_old(self.port_name))
+
         bot_id = self._tool.status_server.bot_id or "bot"
-        description = "Archive of layout-test-results from %s" % bot_id
+        description = "Archive of layout-test-results from %s for %s" % (bot_id, self._port.name())
         # results_archive is a ZipFile object, grab the File object (.fp) to pass to Mechanize for uploading.
         results_archive_file = results_archive_zip.fp
         # Rewind the file object to start (since Mechanize won't do that automatically)
@@ -290,7 +297,7 @@
         comment_text = "The attached test failures were seen while running run-webkit-tests on the %s.\n" % (self.name)
         # FIXME: We could easily list the test failures from the archive here,
         # currently callers do that separately.
-        comment_text += BotInfo(self._tool).summary_text()
+        comment_text += BotInfo(self._tool, self._port.name()).summary_text()
         self._tool.bugs.add_attachment_to_bug(patch.bug_id(), results_archive_file, description, filename="layout-test-results.zip", comment_text=comment_text)
 
 

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py (146690 => 146691)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2013-03-23 00:26:19 UTC (rev 146690)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2013-03-23 00:31:14 UTC (rev 146691)
@@ -176,10 +176,10 @@
         queue._options = Mock()
         queue._options.port = None
         patch = queue._tool.bugs.fetch_attachment(10001)
-        expected_logs = """MOCK add_attachment_to_bug: bug_id=50000, description=Archive of layout-test-results from bot filename=layout-test-results.zip mimetype=None
+        expected_logs = """MOCK add_attachment_to_bug: bug_id=50000, description=Archive of layout-test-results from bot for mac-snowleopard filename=layout-test-results.zip mimetype=None
 -- Begin comment --
 The attached test failures were seen while running run-webkit-tests on the mock-queue.
-Port: MockPort  Platform: MockPlatform 1.0
+Port: mac-snowleopard  Platform: MockPlatform 1.0
 -- End comment --
 """
         OutputCapture().assert_outputs(self, queue._upload_results_archive_for_patch, [patch, Mock()], expected_logs=expected_logs)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to