mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
validate: launcher: Allow discovering scenario from full path
https://bugzilla.gnome.org/show_bug.cgi?id=743994
This commit is contained in:
parent
9f5310b1d8
commit
a85ace1783
2 changed files with 15 additions and 4 deletions
|
@ -187,7 +187,7 @@ class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator):
|
||||||
scenarios = [None]
|
scenarios = [None]
|
||||||
elif self._valid_scenarios:
|
elif self._valid_scenarios:
|
||||||
scenarios = [scenario for scenario in scenarios if
|
scenarios = [scenario for scenario in scenarios if
|
||||||
scenario.name in self._valid_scenarios]
|
scenario is not None and scenario.name in self._valid_scenarios]
|
||||||
|
|
||||||
return super(GstValidatePipelineTestsGenerator, self).generate_tests(
|
return super(GstValidatePipelineTestsGenerator, self).generate_tests(
|
||||||
uri_minfo_special_scenarios, scenarios)
|
uri_minfo_special_scenarios, scenarios)
|
||||||
|
@ -246,6 +246,7 @@ class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
|
||||||
protocol = minfo.media_descriptor.get_protocol()
|
protocol = minfo.media_descriptor.get_protocol()
|
||||||
|
|
||||||
pipe += " uri=%s" % uri
|
pipe += " uri=%s" % uri
|
||||||
|
|
||||||
for scenario in special_scenarios + scenarios:
|
for scenario in special_scenarios + scenarios:
|
||||||
cpipe = pipe
|
cpipe = pipe
|
||||||
if not minfo.media_descriptor.is_compatible(scenario):
|
if not minfo.media_descriptor.is_compatible(scenario):
|
||||||
|
|
|
@ -910,6 +910,7 @@ class _TestsLauncher(Loggable):
|
||||||
if env_dirs is not None:
|
if env_dirs is not None:
|
||||||
for dir_ in env_dirs.split(":"):
|
for dir_ in env_dirs.split(":"):
|
||||||
app_dirs.append(dir_)
|
app_dirs.append(dir_)
|
||||||
|
sys.path.append(dir_)
|
||||||
|
|
||||||
return app_dirs
|
return app_dirs
|
||||||
|
|
||||||
|
@ -1206,9 +1207,9 @@ class ScenarioManager(Loggable):
|
||||||
def find_special_scenarios(self, mfile):
|
def find_special_scenarios(self, mfile):
|
||||||
scenarios = []
|
scenarios = []
|
||||||
mfile_bname = os.path.basename(mfile)
|
mfile_bname = os.path.basename(mfile)
|
||||||
|
|
||||||
for f in os.listdir(os.path.dirname(mfile)):
|
for f in os.listdir(os.path.dirname(mfile)):
|
||||||
if re.findall("%s\..*\.%s$" % (mfile_bname, self.FILE_EXTENDION),
|
if re.findall("%s\..*\.%s$" % (mfile_bname, self.FILE_EXTENDION), f):
|
||||||
f):
|
|
||||||
scenarios.append(os.path.join(os.path.dirname(mfile), f))
|
scenarios.append(os.path.join(os.path.dirname(mfile), f))
|
||||||
|
|
||||||
if scenarios:
|
if scenarios:
|
||||||
|
@ -1241,7 +1242,10 @@ class ScenarioManager(Loggable):
|
||||||
for section in config.sections():
|
for section in config.sections():
|
||||||
if scenario_paths:
|
if scenario_paths:
|
||||||
for scenario_path in scenario_paths:
|
for scenario_path in scenario_paths:
|
||||||
if section in scenario_path:
|
if mfile is None:
|
||||||
|
name = section
|
||||||
|
path = scenario_path
|
||||||
|
elif section in scenario_path:
|
||||||
# The real name of the scenario is:
|
# The real name of the scenario is:
|
||||||
# filename.REALNAME.scenario
|
# filename.REALNAME.scenario
|
||||||
name = scenario_path.replace(mfile + ".", "").replace(
|
name = scenario_path.replace(mfile + ".", "").replace(
|
||||||
|
@ -1260,6 +1264,12 @@ class ScenarioManager(Loggable):
|
||||||
return scenarios
|
return scenarios
|
||||||
|
|
||||||
def get_scenario(self, name):
|
def get_scenario(self, name):
|
||||||
|
if os.path.isabs(name) and name.endswith(self.FILE_EXTENDION):
|
||||||
|
scenarios = self.discover_scenarios([name])
|
||||||
|
|
||||||
|
if scenarios:
|
||||||
|
return scenarios[0]
|
||||||
|
|
||||||
if self.discovered is False:
|
if self.discovered is False:
|
||||||
self.discover_scenarios()
|
self.discover_scenarios()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue