From 34d05cd876585db6fb9c718b6af14a7fcdaf78d4 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 12 Oct 2021 23:05:20 -0300 Subject: [PATCH] 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: --- .../validate/launcher/apps/gstcheck.py | 52 +++++++++++++++++++++- .../gst-devtools/validate/launcher/baseclasses.py | 20 +++++---- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/subprojects/gst-devtools/validate/launcher/apps/gstcheck.py b/subprojects/gst-devtools/validate/launcher/apps/gstcheck.py index 8b29fb8..61441fc 100644 --- a/subprojects/gst-devtools/validate/launcher/apps/gstcheck.py +++ b/subprojects/gst-devtools/validate/launcher/apps/gstcheck.py @@ -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)) diff --git a/subprojects/gst-devtools/validate/launcher/baseclasses.py b/subprojects/gst-devtools/validate/launcher/baseclasses.py index 762ad7b..e3b0a1d 100644 --- a/subprojects/gst-devtools/validate/launcher/baseclasses.py +++ b/subprojects/gst-devtools/validate/launcher/baseclasses.py @@ -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): -- 2.7.4