validate:launcher: Properly handle missing scenarios on the system

This commit is contained in:
Thibault Saunier 2014-03-28 15:01:12 +01:00
parent 339703d2eb
commit 3d8201d52b
3 changed files with 24 additions and 9 deletions

View file

@ -175,6 +175,7 @@ class GESTestsManager(TestsManager):
def init(self):
try:
if "--set-scenario=" in subprocess.check_output([GES_LAUNCH_COMMAND, "--help"]):
return True
else:
self.warning("Can not use ges-launch, it seems not to be compiled against"
@ -198,7 +199,6 @@ class GESTestsManager(TestsManager):
try:
os.makedirs(utils.url2path(options.dest)[0])
print "Created directory: %s" % options.dest
except OSError:
pass
@ -210,7 +210,6 @@ class GESTestsManager(TestsManager):
for f in files:
if not f.endswith(".xges"):
continue
projects.append(utils.path2url(os.path.join(path, root, f)))
else:
for proj in self.args:
@ -227,6 +226,8 @@ class GESTestsManager(TestsManager):
# First playback casses
for scenario_name in SCENARIOS:
scenario = self._scenarios.get_scenario(scenario_name)
if scenario is None:
continue
classname = "ges.playback.%s.%s" % (scenario.name,
os.path.basename(proj).replace(".xges", ""))
self.add_test(GESPlaybackTest(classname,

View file

@ -70,7 +70,12 @@ class PlaybinDescriptor(PipelineDescriptor):
# definitions of commands to use
GST_VALIDATE_COMMAND = "gst-validate-1.0"
GST_VALIDATE_TRANSCODING_COMMAND = "gst-validate-transcoding-1.0"
G_V_DISCOVERER_COMMAND = "gst-validate-media-check-1.0 --discover-only"
G_V_DISCOVERER_COMMAND = "gst-validate-media-check-1.0"
if "win32" in sys.platform:
GST_VALIDATE_COMMAND += ".exe"
GST_VALIDATE_TRANSCODING_COMMAND += ".exe"
G_V_DISCOVERER_COMMAND += ".exe"
G_V_DISCOVERER_COMMAND += " --discover-only"
# Some extension file for discovering results
G_V_MEDIA_INFO_EXT = "media_info"

View file

@ -645,12 +645,11 @@ class ScenarioManager(Loggable):
cls._instance = super(ScenarioManager, cls).__new__(
cls, *args, **kwargs)
cls._instance.config = None
cls._instance.discovered = False
Loggable.__init__(cls._instance)
return cls._instance
def get_scenario(self, name):
if self.all_scenarios:
return [scenario for scenario in self.all_scenarios if scenario.name == name][0]
def _discover_scenarios(self):
scenario_defs = os.path.join(self.config.main_dir, "scenarios.def")
try:
subprocess.check_output([self.GST_VALIDATE_COMMAND,
@ -667,4 +666,14 @@ class ScenarioManager(Loggable):
self.all_scenarios.append(Scenario(section,
config.items(section)))
return [scenario for scenario in self.all_scenarios if scenario.name == name][0]
self.discovered = True
def get_scenario(self, name):
if self.discovered is False:
self._discover_scenarios()
try:
return [scenario for scenario in self.all_scenarios if scenario.name == name][0]
except IndexError:
self.warning("Scenario: %s not found" % name)
return None