mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
validate:tools: Veryfy test manager are operationnal before using them
This commit is contained in:
parent
e30f6372f9
commit
cdff1c93ca
4 changed files with 38 additions and 6 deletions
|
@ -176,7 +176,7 @@ class GESTestsManager(TestsManager):
|
|||
|
||||
|
||||
def init(self):
|
||||
if os.system("which ges-launch") == 0:
|
||||
if which(DEFAULT_GES_LAUNCH):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
@ -202,7 +202,6 @@ class GESTestsManager(TestsManager):
|
|||
projects = list()
|
||||
if not self.args:
|
||||
path = self.options.projects_paths
|
||||
print path
|
||||
for root, dirs, files in os.walk(path):
|
||||
for f in files:
|
||||
if not f.endswith(".xges"):
|
||||
|
|
|
@ -110,6 +110,12 @@ class GstValidateManager(TestsManager, Loggable):
|
|||
Loggable.__init__(self)
|
||||
self._uris = []
|
||||
|
||||
def init(self):
|
||||
if which(DEFAULT_GST_VALIDATE) and which(DEFAULT_GST_VALIDATE_TRANSCODING):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def add_options(self, group):
|
||||
group.add_option("-c", "--check-discovering", dest="check_discovering",
|
||||
default=False, action="store_true",
|
||||
|
|
|
@ -234,6 +234,9 @@ class TestsManager(object):
|
|||
self.reporter = None
|
||||
self.wanted_tests_patterns = []
|
||||
|
||||
def init(self):
|
||||
return False
|
||||
|
||||
def list_tests(self):
|
||||
pass
|
||||
|
||||
|
@ -273,8 +276,11 @@ class TestsManager(object):
|
|||
self.reporter.after_test()
|
||||
|
||||
|
||||
class _TestsLauncher(object):
|
||||
class _TestsLauncher(Loggable):
|
||||
def __init__(self):
|
||||
|
||||
Loggable.__init__(self)
|
||||
|
||||
self.testers = []
|
||||
self.tests = []
|
||||
self.reporter = None
|
||||
|
@ -299,8 +305,12 @@ class _TestsLauncher(object):
|
|||
if f.endswith(".py"):
|
||||
execfile(os.path.join(d, "apps", f), env)
|
||||
|
||||
self.testers = [i() for i in get_subclasses(TestsManager, env)]
|
||||
|
||||
testers = [i() for i in get_subclasses(TestsManager, env)]
|
||||
for tester in testers:
|
||||
if tester.init() is True:
|
||||
self.testers.append(tester)
|
||||
else:
|
||||
self.warning("Can not init tester: %s", tester.name)
|
||||
|
||||
def add_options(self, parser):
|
||||
for tester in self.testers:
|
||||
|
|
|
@ -61,6 +61,23 @@ def mkdir(directory):
|
|||
pass
|
||||
|
||||
|
||||
def which(name):
|
||||
result = []
|
||||
exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
|
||||
path = os.environ.get('PATH', None)
|
||||
if path is None:
|
||||
return []
|
||||
for p in os.environ.get('PATH', '').split(os.pathsep):
|
||||
p = os.path.join(p, name)
|
||||
if os.access(p, os.X_OK):
|
||||
result.append(p)
|
||||
for e in exts:
|
||||
pext = p + e
|
||||
if os.access(pext, os.X_OK):
|
||||
result.append(pext)
|
||||
return result
|
||||
|
||||
|
||||
def printc(message, color="", title=False):
|
||||
if title:
|
||||
length = 0
|
||||
|
|
Loading…
Reference in a new issue