validate:launcher: Run validate unit tests as GstValidate tests

So we have all the features and we can properly document known issue
for them

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1130>
This commit is contained in:
Thibault Saunier 2021-10-12 23:05:20 -03:00 committed by GStreamer Marge Bot
parent 4dd0c6ce44
commit 34d05cd876
2 changed files with 61 additions and 11 deletions

View file

@ -32,10 +32,17 @@ import concurrent.futures as conc
from launcher import config
from launcher.utils import printc, Colors, get_gst_build_valgrind_suppressions
from launcher.main import setup_launcher_from_args
from launcher.baseclasses import VALGRIND_TIMEOUT_FACTOR
from launcher.baseclasses import VALGRIND_TIMEOUT_FACTOR, GstValidateTest
from launcher.apps.gstvalidate import GstValidateSimpleTest
VALIDATE_TOOLS = ['gst-validate-1.0', 'gst-validate-1.0.exe',
'ges-launch-1.0', 'ges-launch-1.0.exe',
'gst-validate-transcoding-1.0', 'gst-validate-transcoding-1.0.exe',
'gst-validate-media-check-1.0', 'gst-validate-media-check-1.0.exe',
]
class MesonTest(Test):
def __init__(self, name, options, reporter, test_infos, child_env=None):
@ -108,6 +115,39 @@ class GstCheckTest(MesonTest):
return env
class GstValidateCheckTest(GstValidateTest):
def __init__(self, name, options, reporter, test_infos, child_env=None):
ref_env = os.environ.copy()
if child_env is None:
child_env = {}
else:
ref_env.update(child_env)
child_env.update(test_infos['env'])
self.child_env = child_env
timeout = int(test_infos['timeout'])
super().__init__(
test_infos['cmd'][0], name, options,
reporter, timeout=timeout, hard_timeout=timeout,
is_parallel=test_infos.get('is_parallel', True),
workdir=test_infos['workdir']
)
self.test_infos = test_infos
def build_arguments(self):
self.add_arguments(*self.test_infos['cmd'][1:])
def get_subproc_env(self):
env = super().get_subproc_env()
env.update(self.child_env)
for var, val in self.child_env.items():
if val != os.environ.get(var):
self.add_env_variable(var, val)
return env
class MesonTestsManager(TestsManager):
name = "mesontest"
@ -394,7 +434,15 @@ class GstCheckTestsManager(MesonTestsManager):
self.options,
self.reporter))
continue
if not gst_tests:
if os.path.basename(test['cmd'][0]) in VALIDATE_TOOLS:
child_env = self.get_child_env(name)
self.add_test(
GstValidateCheckTest(
name, self.options, self.reporter, test,
child_env
)
)
elif not gst_tests:
child_env = self.get_child_env(name)
self.add_test(GstCheckTest(name, self.options, self.reporter, test,
child_env))

View file

@ -823,7 +823,7 @@ class GstValidateTest(Test):
options, reporter, duration=0,
timeout=DEFAULT_TIMEOUT, scenario=None, hard_timeout=None,
media_descriptor=None, extra_env_variables=None,
expected_issues=None, workdir=None):
expected_issues=None, workdir=None, **kwargs):
extra_env_variables = extra_env_variables or {}
@ -861,14 +861,16 @@ class GstValidateTest(Test):
extra_env_variables["GST_VALIDATE_OVERRIDE"] = override_path
super(GstValidateTest, self).__init__(application_name, classname,
options, reporter,
duration=duration,
timeout=timeout,
hard_timeout=hard_timeout,
extra_env_variables=extra_env_variables,
expected_issues=expected_issues,
workdir=workdir)
super().__init__(application_name,
classname,
options, reporter,
duration=duration,
timeout=timeout,
hard_timeout=hard_timeout,
extra_env_variables=extra_env_variables,
expected_issues=expected_issues,
workdir=workdir,
**kwargs)
if media_descriptor and media_descriptor.get_media_filepath():
config_file = os.path.join(media_descriptor.get_media_filepath() + '.config')
if os.path.isfile(config_file):