validate: Handle testfiles that need an HTTP server

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3122>
This commit is contained in:
Thibault Saunier 2022-10-04 19:14:49 -03:00 committed by GStreamer Marge Bot
parent a642b17c97
commit f9e6044124
5 changed files with 46 additions and 19 deletions

View file

@ -56,6 +56,7 @@ G_GNUC_INTERNAL void _priv_validate_override_registry_deinit(void);
G_GNUC_INTERNAL GstValidateReportingDetails gst_validate_runner_get_default_reporting_details (GstValidateRunner *runner);
#define GST_VALIDATE_VALIDATE_TEST_SUFFIX ".validatetest"
G_GNUC_INTERNAL GstValidateMonitor * gst_validate_get_monitor (GObject *object);
G_GNUC_INTERNAL void gst_validate_init_runner (void);
G_GNUC_INTERNAL void gst_validate_deinit_runner (void);

View file

@ -5441,7 +5441,8 @@ _parse_scenario (GFile * f, GKeyFile * kf)
gboolean ret = FALSE;
gchar *path = g_file_get_path (f);
if (g_str_has_suffix (path, GST_VALIDATE_SCENARIO_SUFFIX)) {
if (g_str_has_suffix (path, GST_VALIDATE_SCENARIO_SUFFIX)
|| g_str_has_suffix (path, GST_VALIDATE_VALIDATE_TEST_SUFFIX)) {
GstStructure *meta = NULL;
GList *tmp, *structures = gst_validate_structs_parse_from_gfile (f,
(GstValidateGetIncludePathsFunc)

View file

@ -192,18 +192,24 @@ class GstValidateSimpleTestsGenerator(GstValidateTestsGenerator):
super().__init__(name, test_manager)
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
validatetests = []
for root, _, files in os.walk(self.tests_dir):
for f in files:
name, ext = os.path.splitext(f)
if ext != ".validatetest":
continue
fpath = os.path.abspath(os.path.join(root, f))
pathname = os.path.abspath(os.path.join(root, name))
name = pathname.replace(os.path.commonpath([self.tests_dir, root]), '').replace('/', '.')
self.add_test(GstValidateSimpleTest(fpath, 'test' + name,
self.test_manager.options,
self.test_manager.reporter))
validatetests.append(os.path.abspath(os.path.join(root, f)))
for validatetest in self.test_manager.scenarios_manager.discover_scenarios(validatetests):
pathname, _ext = os.path.splitext(validatetest.path)
name = pathname.replace(os.path.commonpath([self.tests_dir, root]), '').replace('/', '.')
self.add_test(GstValidateSimpleTest(validatetest.path,
'test' + name,
self.test_manager.options,
self.test_manager.reporter,
test_info=validatetest))
class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator):
@ -679,8 +685,10 @@ class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator):
class GstValidateSimpleTest(GstValidateTest):
def __init__(self, test_file, *args, **kwargs):
def __init__(self, test_file, *args, test_info=None, **kwargs):
self.test_file = test_file
self.test_info = test_info
super().__init__(GstValidateBaseTestManager.COMMAND, *args, **kwargs)
def build_arguments(self):
@ -688,6 +696,12 @@ class GstValidateSimpleTest(GstValidateTest):
if self.options.mute:
self.add_arguments('--use-fakesinks')
def needs_http_server(self):
try:
return bool(self.test_info.needs_http_server)
except AttributeError:
return False
class GstValidateLaunchTest(GstValidateTest):
@ -1192,18 +1206,10 @@ not been tested and explicitly activated if you set use --wanted-tests ALL""")
def needs_http_server(self):
for test in self.list_tests():
if self._is_test_wanted(test) and test.media_descriptor is not None:
protocol = test.media_descriptor.get_protocol()
uri = test.media_descriptor.get_uri()
uri_requires_http_server = False
if uri:
if 'http-server-port' in uri:
expanded_uri = uri % {
'http-server-port': self.options.http_server_port}
uri_requires_http_server = expanded_uri.find(
"127.0.0.1:%s" % self.options.http_server_port) != -1
if protocol in [Protocols.HTTP, Protocols.HLS, Protocols.DASH] or uri_requires_http_server:
if self._is_test_wanted(test):
if test.needs_http_server():
return True
return False
def set_settings(self, options, args, reporter):

View file

@ -881,6 +881,24 @@ class GstValidateTest(Test):
else:
self.scenario = scenario
def needs_http_server(self):
if self.media_descriptor is None:
return False
protocol = self.media_descriptor.get_protocol()
uri = self.media_descriptor.get_uri()
uri_requires_http_server = False
if uri:
if 'http-server-port' in uri:
expanded_uri = uri % {
'http-server-port': self.options.http_server_port}
uri_requires_http_server = expanded_uri.find(
"127.0.0.1:%s" % self.options.http_server_port) != -1
if protocol in [Protocols.HTTP, Protocols.HLS, Protocols.DASH] or uri_requires_http_server:
return True
return False
def kill_subprocess(self):
Test.kill_subprocess(self)

View file

@ -8,6 +8,7 @@ KNOWN_ISSUES = {
r"^validate\.((?!glvideomixer).)*$",
r"^validate\.((?!launch_pipeline).)*$",
r"^validate\.((?!rtsp*).)*$",
r"^validate\.((?!dash*).)*$",
],
"max_retries": 2,
},