mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 08:11:16 +00:00
launcher: add valgrind support
Add a --valgrind option to gst-validate-launcher to run the tests inside Valgrind and tune GLib's memory allocator accordingly. Fix https://bugzilla.gnome.org/show_bug.cgi?id=746465
This commit is contained in:
parent
2778e501c4
commit
271f9f3c8e
2 changed files with 32 additions and 0 deletions
|
@ -38,6 +38,10 @@ import xml.etree.cElementTree as ET
|
|||
from utils import mkdir, Result, Colors, printc, DEFAULT_TIMEOUT, GST_SECOND, \
|
||||
Protocols
|
||||
|
||||
# The factor by which we increase the hard timeout when running inside
|
||||
# Valgrind
|
||||
VALGRIND_TIMEOUT_FACTOR = 5
|
||||
|
||||
|
||||
class Test(Loggable):
|
||||
|
||||
|
@ -270,6 +274,27 @@ class Test(Loggable):
|
|||
if self.result is not Result.TIMEOUT:
|
||||
self.queue.put(None)
|
||||
|
||||
def use_valgrind(self):
|
||||
vg_args = [
|
||||
('trace-children', 'yes'),
|
||||
('tool', 'memcheck'),
|
||||
('leak-check', 'full'),
|
||||
('leak-resolution', 'high'),
|
||||
('num-callers', '20'),
|
||||
]
|
||||
|
||||
self.command = "valgrind %s %s" % (' '.join(map(lambda x: '--%s=%s' % (x[0], x[1]), vg_args)),
|
||||
self.command)
|
||||
|
||||
# Tune GLib's memory allocator to be more valgrind friendly
|
||||
self.proc_env['G_DEBUG'] = 'gc-friendly'
|
||||
self.add_env_variable('G_DEBUG', 'gc-friendly')
|
||||
|
||||
self.proc_env['G_SLICE'] = 'always-malloc'
|
||||
self.add_env_variable('G_SLICE', 'always-malloc')
|
||||
|
||||
self.hard_timeout *= VALGRIND_TIMEOUT_FACTOR
|
||||
|
||||
def test_start(self, queue):
|
||||
self.open_logfile()
|
||||
|
||||
|
@ -279,6 +304,9 @@ class Test(Loggable):
|
|||
self.build_arguments()
|
||||
self.proc_env = self.get_subproc_env()
|
||||
|
||||
if self.options.valgrind:
|
||||
self.use_valgrind()
|
||||
|
||||
message = "Launching: %s%s\n" \
|
||||
" Command: '%s %s'\n" % (Colors.ENDC, self.classname,
|
||||
self._env_variable, self.command)
|
||||
|
|
|
@ -217,6 +217,7 @@ class LauncherConfig(Loggable):
|
|||
self.generate_info_full = False
|
||||
self.long_limit = utils.LONG_TEST
|
||||
self.config = None
|
||||
self.valgrind = False
|
||||
self.xunit_file = None
|
||||
self.main_dir = utils.DEFAULT_MAIN_DIR
|
||||
self.output_dir = None
|
||||
|
@ -416,6 +417,9 @@ Note that all testsuite should be inside python modules, so the directory should
|
|||
parser.add_argument("-c", "--config", dest="config",
|
||||
help="This is DEPRECATED, prefer using the testsuite format"
|
||||
" to configure testsuites")
|
||||
parser.add_argument("-vg", "--valgrind", dest="valgrind",
|
||||
action="store_true",
|
||||
help="Run the tests inside Valgrind")
|
||||
dir_group = parser.add_argument_group(
|
||||
"Directories and files to be used by the launcher")
|
||||
parser.add_argument('--xunit-file', action='store',
|
||||
|
|
Loading…
Reference in a new issue