mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
validate:launcher: Add a way to specify a set of tests to run under the leak tracer
https://bugzilla.gnome.org/show_bug.cgi?id=767856
This commit is contained in:
parent
e4f05cb577
commit
7773ca7765
3 changed files with 38 additions and 8 deletions
|
@ -18,6 +18,7 @@
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import pickle
|
import pickle
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -31,7 +32,7 @@ from launcher.utils import printc, Colors
|
||||||
class MesonTest(Test):
|
class MesonTest(Test):
|
||||||
|
|
||||||
def __init__(self, name, options, reporter, test, child_env=None):
|
def __init__(self, name, options, reporter, test, child_env=None):
|
||||||
ref_env = os.environ
|
ref_env = os.environ.copy()
|
||||||
if child_env is None:
|
if child_env is None:
|
||||||
child_env = {}
|
child_env = {}
|
||||||
else:
|
else:
|
||||||
|
@ -80,14 +81,14 @@ class MesonTestsManager(TestsManager):
|
||||||
if self.arggroup:
|
if self.arggroup:
|
||||||
return
|
return
|
||||||
|
|
||||||
MesonTestsManager.arggroup = parser.add_argument_group(
|
arggroup = MesonTestsManager.arggroup = parser.add_argument_group(
|
||||||
"meson tests specific options and behaviours")
|
"meson tests specific options and behaviours")
|
||||||
parser.add_argument("--meson-build-dir",
|
arggroup.add_argument("--meson-build-dir",
|
||||||
action="append",
|
action="append",
|
||||||
dest='meson_build_dirs',
|
dest='meson_build_dirs',
|
||||||
default=[config.BUILDDIR],
|
default=[config.BUILDDIR],
|
||||||
help="defines the paths to look for GstValidate tools.")
|
help="defines the paths to look for GstValidate tools.")
|
||||||
parser.add_argument("--meson-no-rebuild",
|
arggroup.add_argument("--meson-no-rebuild",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
help="Whether to avoid to rebuild tests before running them.")
|
help="Whether to avoid to rebuild tests before running them.")
|
||||||
|
@ -228,6 +229,28 @@ class GstCheckTestsManager(MesonTestsManager):
|
||||||
with open(dumpfile, 'wb') as f:
|
with open(dumpfile, 'wb') as f:
|
||||||
pickle.dump(self.tests_info, f)
|
pickle.dump(self.tests_info, f)
|
||||||
|
|
||||||
|
def add_options(self, parser):
|
||||||
|
super().add_options(parser)
|
||||||
|
arggroup = parser.add_argument_group("gstcheck specific options")
|
||||||
|
arggroup.add_argument("--gst-check-leak-trace-testnames",
|
||||||
|
default=None,
|
||||||
|
help="A regex to specifying testsnames of the test"
|
||||||
|
"to run with the leak tracer activated, if 'known-not-leaky'"
|
||||||
|
" is specified, the testsuite will automatically activate"
|
||||||
|
" leak tracers on tests known to be not leaky.")
|
||||||
|
|
||||||
|
def get_child_env(self, testname, check_name=None):
|
||||||
|
child_env = {}
|
||||||
|
if check_name:
|
||||||
|
child_env['GST_CHECKS'] = check_name
|
||||||
|
|
||||||
|
if self.options.gst_check_leak_trace_testnames:
|
||||||
|
if re.findall(self.options.gst_check_leak_trace_testnames, testname):
|
||||||
|
tracers = set(os.environ.get('GST_TRACERS', '').split(';')) | set(['leaks'])
|
||||||
|
child_env['GST_TRACERS'] = ';'.join(tracers)
|
||||||
|
|
||||||
|
return child_env
|
||||||
|
|
||||||
def list_tests(self):
|
def list_tests(self):
|
||||||
if self.tests:
|
if self.tests:
|
||||||
return self.tests
|
return self.tests
|
||||||
|
@ -266,12 +289,15 @@ class GstCheckTestsManager(MesonTestsManager):
|
||||||
for test in mesontests:
|
for test in mesontests:
|
||||||
gst_tests = self.tests_info[test.fname[0]][1]
|
gst_tests = self.tests_info[test.fname[0]][1]
|
||||||
if not gst_tests:
|
if not gst_tests:
|
||||||
self.add_test(MesonTest(self.get_test_name(test),
|
name = self.get_test_name(test)
|
||||||
self.options, self.reporter, test))
|
child_env = self.get_child_env(name)
|
||||||
|
self.add_test(MesonTest(name, self.options, self.reporter, test,
|
||||||
|
child_env))
|
||||||
else:
|
else:
|
||||||
for ltest in gst_tests:
|
for ltest in gst_tests:
|
||||||
name = self.get_test_name(test) + '.' + ltest
|
name = self.get_test_name(test) + '.' + ltest
|
||||||
|
child_env = self.get_child_env(name, ltest)
|
||||||
self.add_test(MesonTest(name, self.options, self.reporter, test,
|
self.add_test(MesonTest(name, self.options, self.reporter, test,
|
||||||
{'GST_CHECKS': ltest}))
|
child_env))
|
||||||
self.save_tests_info()
|
self.save_tests_info()
|
||||||
return self.tests
|
return self.tests
|
||||||
|
|
|
@ -876,7 +876,7 @@ class GstValidateTest(Test):
|
||||||
result = super(GstValidateTest, self).get_valgrind_suppressions()
|
result = super(GstValidateTest, self).get_valgrind_suppressions()
|
||||||
gst_sup = self.get_valgrind_suppression_file('common', 'gst.supp')
|
gst_sup = self.get_valgrind_suppression_file('common', 'gst.supp')
|
||||||
if gst_sup:
|
if gst_sup:
|
||||||
resut.append(gst_sup)
|
result.append(gst_sup)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@ GStreamer unit tests
|
||||||
|
|
||||||
TEST_MANAGER = "check"
|
TEST_MANAGER = "check"
|
||||||
|
|
||||||
|
KNOWN_NOT_LEAKY = r'^check.gst-devtools.*|^check.gstreamer.*|^check-gst-plugins-base|^check.gst-plugins-ugly|^check.gst-plugins-good'
|
||||||
|
|
||||||
|
|
||||||
def setup_tests(test_manager, options):
|
def setup_tests(test_manager, options):
|
||||||
|
if options.gst_check_leak_trace_testnames == 'known-not-leaky':
|
||||||
|
options.gst_check_leak_trace_testnames = KNOWN_NOT_LEAKY
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue