Changeset 153721 in webkit


Ignore:
Timestamp:
Aug 5, 2013 1:26:29 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Implement leak checking with valgrind
https://bugs.webkit.org/show_bug.cgi?id=118785

Patch by Brian Holt <brian.holt@samsung.com> on 2013-08-05
Reviewed by Dirk Pranke.

Launch the DRT under Valgrind to generate xml files with details
of leaks found.

  • Scripts/webkitpy/layout_tests/run_webkit_tests.py:

(parse_args):

  • Scripts/webkitpy/port/gtk.py:

(GtkPort.init):
(GtkPort.default_timeout_ms): Allow extra time to run under
Valgrind.
(GtkPort.setup_environ_for_server): Pass Valgrind instructions
using environment variables.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r153651 r153721  
     12013-08-05  Brian Holt  <brian.holt@samsung.com>
     2
     3        [GTK] Implement leak checking with valgrind
     4        https://bugs.webkit.org/show_bug.cgi?id=118785
     5
     6        Reviewed by Dirk Pranke.
     7
     8        Launch the DRT under Valgrind to generate xml files with details
     9        of leaks found.
     10
     11        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     12        (parse_args):
     13        * Scripts/webkitpy/port/gtk.py:
     14        (GtkPort.__init__):
     15        (GtkPort.default_timeout_ms): Allow extra time to run under
     16        Valgrind.
     17        (GtkPort.setup_environ_for_server): Pass Valgrind instructions
     18        using environment variables.
     19
    1202013-08-02  Mario Sanchez Prada  <mario.prada@samsung.com>
    221
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r151462 r153721  
    111111            help="Use the complex text code path for all text (Mac OS X and Windows only)"),
    112112        optparse.make_option("-l", "--leaks", action="store_true", default=False,
    113             help="Enable leaks checking (Mac OS X only)"),
     113            help="Enable leaks checking (Mac OS X and Gtk+ only)"),
    114114        optparse.make_option("-g", "--guard-malloc", action="store_true", default=False,
    115115            help="Enable Guard Malloc (Mac OS X only)"),
  • trunk/Tools/Scripts/webkitpy/port/gtk.py

    r153439 r153721  
    11# Copyright (C) 2010 Google Inc. All rights reserved.
     2# Copyright (C) 2013 Samsung Electronics.  All rights reserved.
    23#
    34# Redistribution and use in source and binary forms, with or without
     
    2930import os
    3031import subprocess
     32import uuid
    3133
    3234from webkitpy.common.memoized import memoized
     
    4547        self._pulseaudio_sanitizer = PulseAudioSanitizer()
    4648
     49        if self.get_option("leaks"):
     50            if not self.get_option("wrapper"):
     51                raise ValueError('use --wrapper=\"valgrind\" for memory leak detection on GTK')
     52
    4753    def warn_if_bug_missing_in_test_expectations(self):
    4854        return not self.get_option('webkit_test_runner')
     
    5864
    5965    def default_timeout_ms(self):
     66        # Starting an application under Valgrind takes a lot longer than normal
     67        # so increase the timeout (empirically 10x is enough to avoid timeouts).
     68        multiplier = 10 if self.get_option("leaks") else 1
    6069        if self.get_option('configuration') == 'Debug':
    61             return 12 * 1000
    62         return 6 * 1000
     70            return multiplier * 12 * 1000
     71        return multiplier * 6 * 1000
    6372
    6473    def setup_test_run(self):
     
    8089        environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base('Source', 'WebCore', 'platform', 'audio', 'resources')
    8190        self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR')
     91        if self.get_option("leaks"):
     92            #  Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind.
     93            environment['G_SLICE'] = 'always-malloc'
     94            environment['G_DEBUG'] = 'gc-friendly'
     95            xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml"))
     96            xmlfile = os.path.join(self.results_directory(), xmlfilename)
     97            environment['VALGRIND_OPTS'] = \
     98                "--tool=memcheck " \
     99                "--num-callers=40 " \
     100                "--demangle=no " \
     101                "--trace-children=no " \
     102                "--smc-check=all-non-file " \
     103                "--leak-check=yes " \
     104                "--leak-resolution=high " \
     105                "--show-possibly-lost=no " \
     106                "--show-reachable=no " \
     107                "--leak-check=full " \
     108                "--undef-value-errors=no " \
     109                "--gen-suppressions=all " \
     110                "--xml=yes " \
     111                "--xml-file=\"%s\" " % (xmlfile)
    82112        return environment
    83113
Note: See TracChangeset for help on using the changeset viewer.