Title: [219088] trunk/Tools
Revision
219088
Author
[email protected]
Date
2017-07-03 13:15:04 -0700 (Mon, 03 Jul 2017)

Log Message

webkitpy: Properly number duplicated crashlogs
https://bugs.webkit.org/show_bug.cgi?id=172002

Reviewed by Aakash Jain.

* Scripts/webkitpy/common/system/crashlogs.py:
(CrashLogs._find_all_logs_darwin): Number multiple crash logs for a single process with
an increasing integer.
* Scripts/webkitpy/common/system/crashlogs_unittest.py:
(CrashLogsTest.create_crash_logs_darwin): Create duplicated crashlog for testing.
(CrashLogsTest.test_find_all_log_darwin): Now 7 Darwin logs instead of 5.
(CrashLogsTest.test_duplicate_log_darwin): Test that duplicated logs are correctly numbered.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (219087 => 219088)


--- trunk/Tools/ChangeLog	2017-07-03 19:47:11 UTC (rev 219087)
+++ trunk/Tools/ChangeLog	2017-07-03 20:15:04 UTC (rev 219088)
@@ -1,3 +1,18 @@
+2017-07-03  Jonathan Bedard  <[email protected]>
+
+        webkitpy: Properly number duplicated crashlogs
+        https://bugs.webkit.org/show_bug.cgi?id=172002
+
+        Reviewed by Aakash Jain.
+
+        * Scripts/webkitpy/common/system/crashlogs.py:
+        (CrashLogs._find_all_logs_darwin): Number multiple crash logs for a single process with
+        an increasing integer.
+        * Scripts/webkitpy/common/system/crashlogs_unittest.py:
+        (CrashLogsTest.create_crash_logs_darwin): Create duplicated crashlog for testing.
+        (CrashLogsTest.test_find_all_log_darwin): Now 7 Darwin logs instead of 5.
+        (CrashLogsTest.test_duplicate_log_darwin): Test that duplicated logs are correctly numbered.
+
 2017-07-03  Ryosuke Niwa  <[email protected]>
 
         WebContent processes crash when the network process crashes with pending connection requests

Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py (219087 => 219088)


--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2017-07-03 19:47:11 UTC (rev 219087)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2017-07-03 20:15:04 UTC (rev 219088)
@@ -161,9 +161,16 @@
                     if parsed_name:
                         result_name = parsed_name + "-" + str(parsed_pid)
 
-                    while result_name in crash_logs:
-                        result_name = result_name + "-1"
-                    crash_logs[result_name] = errors + log_contents
+                    # Processes can remain running after Sandbox violations, which generate crash logs.
+                    # This means that we can have mutliple crash logs attributed to the same process.
+                    # The unique_name must be named in the format PROCESS_NAME-PID-#, where '-#' is optional.
+                    # This is because of how DarwinPort._merge_crash_logs parses the crash name.
+                    count = 1
+                    unique_name = result_name
+                    while unique_name in crash_logs:
+                        unique_name = result_name + '-' + str(count)
+                        count += 1
+                    crash_logs[unique_name] = errors + log_contents
             except IOError, e:
                 if include_errors:
                     errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e))

Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py (219087 => 219088)


--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py	2017-07-03 19:47:11 UTC (rev 219087)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py	2017-07-03 20:15:04 UTC (rev 219088)
@@ -248,7 +248,9 @@
         self.other_process_mock_crash_report = make_mock_crash_report_darwin('FooProcess', 28527)
         self.misformatted_mock_crash_report = 'Junk that should not appear in a crash report' + make_mock_crash_report_darwin('DumpRenderTree', 28526)[200:]
         self.files = {}
-        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150718_quadzen.crash'] = self.older_mock_crash_report
+        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150716_quadzen.crash'] = self.older_mock_crash_report
+        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150717_quadzen_1.crash'] = self.older_mock_crash_report
+        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150718_quadzen_2.crash'] = self.older_mock_crash_report
         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150719_quadzen.crash'] = self.mock_crash_report
         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150720_quadzen.crash'] = self.newer_mock_crash_report
         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150721_quadzen.crash'] = None
@@ -267,12 +269,26 @@
 
         crash_logs = self.create_crash_logs_darwin()
         all_logs = crash_logs.find_all_logs()
-        self.assertEqual(len(all_logs), 5)
+        self.assertEqual(len(all_logs), 7)
 
         for test, crash_log in all_logs.iteritems():
             self.assertTrue(crash_log in self.files.values())
             self.assertTrue(test == "Unknown" or int(test.split("-")[1]) in range(28527, 28531))
 
+    def test_duplicate_log_darwin(self):
+        if not SystemHost().platform.is_mac():
+            return
+
+        crash_logs = self.create_crash_logs_darwin()
+        all_logs = crash_logs.find_all_logs()
+        expected_logs = ['DumpRenderTree-28528', 'DumpRenderTree-28528-1', 'DumpRenderTree-28528-2',
+                         'DumpRenderTree-28529', 'DumpRenderTree-28530', 'FooProcess-28527', 'Unknown']
+
+        for log in expected_logs:
+            self.assertIn(log, all_logs)
+        for log in all_logs:
+            self.assertIn(log, expected_logs)
+
     def test_find_log_darwin(self):
         if not SystemHost().platform.is_mac():
             return
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to