[GTK] Parse Valgrind xml leak files

https://bugs.webkit.org/show_bug.cgi?id=119446

Reviewed by Alejandro G. Castro.

Parse the xml files generated by Valgrind to yield useful
information about the memory leaks.

* Scripts/webkitpy/port/gtk.py:
(GtkPort.__init__):
(GtkPort.setup_test_run): Clear the previous output files before new
run.
(GtkPort.print_leaks_summary):

* Scripts/webkitpy/port/leakdetector_valgrind.py: Added.
Parse the xml files generated by Valgrind and summarise leaks
into an easily understandable list.
(get_text_of):
(get_CDATA_of):
(gather_frames):
(ValgrindError):
(ValgrindError.__init__):
(ValgrindError.__str__):
(ValgrindError.unique_string):
(ValgrindError.error_hash):
(ValgrindError.__hash__):
(ValgrindError.__eq__):
(LeakDetectorValgrind):
(LeakDetectorValgrind.__init__):
(LeakDetectorValgrind._parse_leaks_output):
(LeakDetectorValgrind.leaks_files_in_results_directory):
(LeakDetectorValgrind.clean_leaks_files_from_results_directory):
(LeakDetectorValgrind.parse_and_print_leaks_detail):

* Scripts/webkitpy/port/leakdetector_valgrind_unittest.py: Added.
(make_mock_valgrind_output):
(make_mock_incomplete_valgrind_output):
(make_mock_valgrind_results):
(make_mock_valgrind_results_incomplete):
(make_mock_valgrind_results_empty):
(make_mock_valgrind_results_misformatted):
(LeakDetectorValgrindTest):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161512 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3e993009
2014-01-08 Brian Holt <brian.holt@samsung.com>
[GTK] Parse Valgrind xml leak files
https://bugs.webkit.org/show_bug.cgi?id=119446
Reviewed by Alejandro G. Castro.
Parse the xml files generated by Valgrind to yield useful
information about the memory leaks.
* Scripts/webkitpy/port/gtk.py:
(GtkPort.__init__):
(GtkPort.setup_test_run): Clear the previous output files before new
run.
(GtkPort.print_leaks_summary):
* Scripts/webkitpy/port/leakdetector_valgrind.py: Added.
Parse the xml files generated by Valgrind and summarise leaks
into an easily understandable list.
(get_text_of):
(get_CDATA_of):
(gather_frames):
(ValgrindError):
(ValgrindError.__init__):
(ValgrindError.__str__):
(ValgrindError.unique_string):
(ValgrindError.error_hash):
(ValgrindError.__hash__):
(ValgrindError.__eq__):
(LeakDetectorValgrind):
(LeakDetectorValgrind.__init__):
(LeakDetectorValgrind._parse_leaks_output):
(LeakDetectorValgrind.leaks_files_in_results_directory):
(LeakDetectorValgrind.clean_leaks_files_from_results_directory):
(LeakDetectorValgrind.parse_and_print_leaks_detail):
* Scripts/webkitpy/port/leakdetector_valgrind_unittest.py: Added.
(make_mock_valgrind_output):
(make_mock_incomplete_valgrind_output):
(make_mock_valgrind_results):
(make_mock_valgrind_results_incomplete):
(make_mock_valgrind_results_empty):
(make_mock_valgrind_results_misformatted):
(LeakDetectorValgrindTest):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_pass):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_incomplete):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_empty):
(LeakDetectorValgrindTest.test_parse_and_print_leaks_detail_misformatted):
2014-01-08 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r161427.
......
......@@ -38,6 +38,7 @@ from webkitpy.port.pulseaudio_sanitizer import PulseAudioSanitizer
from webkitpy.port.xvfbdriver import XvfbDriver
from webkitpy.port.westondriver import WestonDriver
from webkitpy.port.linux_get_crash_log import GDBCrashLogGenerator
from webkitpy.port.leakdetector_valgrind import LeakDetectorValgrind
class GtkPort(Port):
......@@ -46,6 +47,7 @@ class GtkPort(Port):
def __init__(self, *args, **kwargs):
super(GtkPort, self).__init__(*args, **kwargs)
self._pulseaudio_sanitizer = PulseAudioSanitizer()
self._leakdetector = LeakDetectorValgrind(self._filesystem, self.results_directory())
if self.get_option("leaks"):
if not self.get_option("wrapper"):
......@@ -81,6 +83,9 @@ class GtkPort(Port):
super(GtkPort, self).setup_test_run()
self._pulseaudio_sanitizer.unload_pulseaudio_module()
if self.get_option("leaks"):
self._leakdetector.clean_leaks_files_from_results_directory()
def clean_up_test_run(self):
super(GtkPort, self).clean_up_test_run()
self._pulseaudio_sanitizer.restore_pulseaudio_module()
......@@ -159,6 +164,16 @@ class GtkPort(Port):
def _port_specific_expectations_files(self):
return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())]
def print_leaks_summary(self):
if not self.get_option('leaks'):
return
# FIXME: This is a hack, but we don't have a better way to get this information from the workers yet
# because we're in the manager process.
leaks_files = self._leakdetector.leaks_files_in_results_directory()
if not leaks_files:
return
self._leakdetector.parse_and_print_leaks_detail(leaks_files)
# FIXME: We should find a way to share this implmentation with Gtk,
# or teach run-launcher how to call run-safari and move this down to Port.
def show_results_html_file(self, results_filename):
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment