mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-12 09:15:29 +00:00
validate:launcher: Batch inspecting scenarios
Removing almost 1 second to start running tests with the default testsuite
This commit is contained in:
parent
ca93a4b704
commit
bc622ec658
3 changed files with 34 additions and 15 deletions
|
@ -4056,13 +4056,12 @@ static gboolean
|
||||||
_parse_scenario (GFile * f, GKeyFile * kf)
|
_parse_scenario (GFile * f, GKeyFile * kf)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
gchar *fname = g_file_get_basename (f);
|
gchar *path = g_file_get_path (f);
|
||||||
|
|
||||||
if (g_str_has_suffix (fname, GST_VALIDATE_SCENARIO_SUFFIX)) {
|
if (g_str_has_suffix (path, GST_VALIDATE_SCENARIO_SUFFIX)) {
|
||||||
gboolean needs_clock_sync = FALSE;
|
gboolean needs_clock_sync = FALSE;
|
||||||
GstStructure *desc = NULL;
|
GstStructure *desc = NULL;
|
||||||
|
|
||||||
gchar **name = g_strsplit (fname, GST_VALIDATE_SCENARIO_SUFFIX, 0);
|
|
||||||
GList *tmp, *structures = gst_validate_structs_parse_from_gfile (f);
|
GList *tmp, *structures = gst_validate_structs_parse_from_gfile (f);
|
||||||
|
|
||||||
for (tmp = structures; tmp; tmp = tmp->next) {
|
for (tmp = structures; tmp; tmp = tmp->next) {
|
||||||
|
@ -4088,22 +4087,21 @@ _parse_scenario (GFile * f, GKeyFile * kf)
|
||||||
if (desc) {
|
if (desc) {
|
||||||
KeyFileGroupName kfg;
|
KeyFileGroupName kfg;
|
||||||
|
|
||||||
kfg.group_name = name[0];
|
kfg.group_name = g_file_get_path (f);
|
||||||
kfg.kf = kf;
|
kfg.kf = kf;
|
||||||
|
|
||||||
gst_structure_foreach (desc,
|
gst_structure_foreach (desc,
|
||||||
(GstStructureForeachFunc) _add_description, &kfg);
|
(GstStructureForeachFunc) _add_description, &kfg);
|
||||||
gst_structure_free (desc);
|
gst_structure_free (desc);
|
||||||
} else {
|
} else {
|
||||||
g_key_file_set_string (kf, name[0], "noinfo", "nothing");
|
g_key_file_set_string (kf, path, "noinfo", "nothing");
|
||||||
}
|
}
|
||||||
g_list_free_full (structures, (GDestroyNotify) gst_structure_free);
|
g_list_free_full (structures, (GDestroyNotify) gst_structure_free);
|
||||||
g_strfreev (name);
|
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (fname);
|
g_free (path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,14 @@ class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator):
|
||||||
uri_minfo_special_scenarios, scenarios)
|
uri_minfo_special_scenarios, scenarios)
|
||||||
|
|
||||||
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
|
||||||
|
|
||||||
|
special_scenarios = []
|
||||||
|
for description in self._pipelines_descriptions:
|
||||||
|
for s in description.get('extra_data', {}).get('scenarios', []):
|
||||||
|
if os.path.isabs(s):
|
||||||
|
special_scenarios.append(s)
|
||||||
|
|
||||||
|
self.test_manager.scenarios_manager.discover_scenarios(special_scenarios)
|
||||||
for description in self._pipelines_descriptions:
|
for description in self._pipelines_descriptions:
|
||||||
pipeline = description['pipeline']
|
pipeline = description['pipeline']
|
||||||
extra_data = description.get('extra_data', {})
|
extra_data = description.get('extra_data', {})
|
||||||
|
|
|
@ -2187,7 +2187,8 @@ class Scenario(object):
|
||||||
|
|
||||||
class ScenarioManager(Loggable):
|
class ScenarioManager(Loggable):
|
||||||
_instance = None
|
_instance = None
|
||||||
all_scenarios = []
|
system_scenarios = []
|
||||||
|
special_scenarios = {}
|
||||||
|
|
||||||
FILE_EXTENSION = "scenario"
|
FILE_EXTENSION = "scenario"
|
||||||
|
|
||||||
|
@ -2239,11 +2240,12 @@ class ScenarioManager(Loggable):
|
||||||
config.readfp(f)
|
config.readfp(f)
|
||||||
|
|
||||||
for section in config.sections():
|
for section in config.sections():
|
||||||
|
name = None
|
||||||
if scenario_paths:
|
if scenario_paths:
|
||||||
for scenario_path in scenario_paths:
|
for scenario_path in scenario_paths:
|
||||||
if section in os.path.splitext(os.path.basename(scenario_path))[0]:
|
if section == scenario_path:
|
||||||
if mfile is None:
|
if mfile is None:
|
||||||
name = section
|
name = os.path.basename(section).replace("." + self.FILE_EXTENSION, "")
|
||||||
path = scenario_path
|
path = scenario_path
|
||||||
else:
|
else:
|
||||||
# The real name of the scenario is:
|
# The real name of the scenario is:
|
||||||
|
@ -2251,22 +2253,33 @@ class ScenarioManager(Loggable):
|
||||||
name = scenario_path.replace(mfile + ".", "").replace(
|
name = scenario_path.replace(mfile + ".", "").replace(
|
||||||
"." + self.FILE_EXTENSION, "")
|
"." + self.FILE_EXTENSION, "")
|
||||||
path = scenario_path
|
path = scenario_path
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
name = section
|
name = os.path.basename(section).replace("." + self.FILE_EXTENSION, "")
|
||||||
path = None
|
path = None
|
||||||
|
|
||||||
|
assert name
|
||||||
|
|
||||||
props = config.items(section)
|
props = config.items(section)
|
||||||
scenarios.append(Scenario(name, props, path))
|
scenario = Scenario(name, props, path)
|
||||||
|
if scenario_paths:
|
||||||
|
self.special_scenarios[path] = scenario
|
||||||
|
scenarios.append(scenario)
|
||||||
|
|
||||||
if not scenario_paths:
|
if not scenario_paths:
|
||||||
self.discovered = True
|
self.discovered = True
|
||||||
self.all_scenarios.extend(scenarios)
|
self.system_scenarios.extend(scenarios)
|
||||||
|
|
||||||
return scenarios
|
return scenarios
|
||||||
|
|
||||||
def get_scenario(self, name):
|
def get_scenario(self, name):
|
||||||
if name is not None and os.path.isabs(name) and name.endswith(self.FILE_EXTENSION):
|
if name is not None and os.path.isabs(name) and name.endswith(self.FILE_EXTENSION):
|
||||||
|
scenario = self.special_scenarios.get(name)
|
||||||
|
if scenario:
|
||||||
|
return scenario
|
||||||
|
|
||||||
scenarios = self.discover_scenarios([name])
|
scenarios = self.discover_scenarios([name])
|
||||||
|
self.special_scenarios[name] = scenarios
|
||||||
|
|
||||||
if scenarios:
|
if scenarios:
|
||||||
return scenarios[0]
|
return scenarios[0]
|
||||||
|
@ -2275,10 +2288,10 @@ class ScenarioManager(Loggable):
|
||||||
self.discover_scenarios()
|
self.discover_scenarios()
|
||||||
|
|
||||||
if name is None:
|
if name is None:
|
||||||
return self.all_scenarios
|
return self.system_scenarios
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return [scenario for scenario in self.all_scenarios if scenario.name == name][0]
|
return [scenario for scenario in self.system_scenarios if scenario.name == name][0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
self.warning("Scenario: %s not found" % name)
|
self.warning("Scenario: %s not found" % name)
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue