validate: launcher: Allow discovering scenario from full path

https://bugzilla.gnome.org/show_bug.cgi?id=743994
This commit is contained in:
Thibault Saunier 2015-02-04 15:27:37 +01:00
parent 9f5310b1d8
commit a85ace1783
2 changed files with 15 additions and 4 deletions

View file

@ -187,7 +187,7 @@ class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator):
scenarios = [None]
elif self._valid_scenarios:
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(
uri_minfo_special_scenarios, scenarios)
@ -246,6 +246,7 @@ class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
protocol = minfo.media_descriptor.get_protocol()
pipe += " uri=%s" % uri
for scenario in special_scenarios + scenarios:
cpipe = pipe
if not minfo.media_descriptor.is_compatible(scenario):

View file

@ -910,6 +910,7 @@ class _TestsLauncher(Loggable):
if env_dirs is not None:
for dir_ in env_dirs.split(":"):
app_dirs.append(dir_)
sys.path.append(dir_)
return app_dirs
@ -1206,9 +1207,9 @@ class ScenarioManager(Loggable):
def find_special_scenarios(self, mfile):
scenarios = []
mfile_bname = os.path.basename(mfile)
for f in os.listdir(os.path.dirname(mfile)):
if re.findall("%s\..*\.%s$" % (mfile_bname, self.FILE_EXTENDION),
f):
if re.findall("%s\..*\.%s$" % (mfile_bname, self.FILE_EXTENDION), f):
scenarios.append(os.path.join(os.path.dirname(mfile), f))
if scenarios:
@ -1241,7 +1242,10 @@ class ScenarioManager(Loggable):
for section in config.sections():
if 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:
# filename.REALNAME.scenario
name = scenario_path.replace(mfile + ".", "").replace(
@ -1260,6 +1264,12 @@ class ScenarioManager(Loggable):
return scenarios
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:
self.discover_scenarios()