From e30f6372f9dca936248643e6dda813d6f71642b5 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 9 Jan 2014 15:15:51 +0100 Subject: [PATCH] validate:tools: Move the main function in a dedictaed file --- validate/tools/gst-validate-launcher.in | 74 +--------------------- validate/tools/launcher/apps/ges-launch.py | 7 ++ 2 files changed, 10 insertions(+), 71 deletions(-) diff --git a/validate/tools/gst-validate-launcher.in b/validate/tools/gst-validate-launcher.in index 15cba8e839..5839c6f4c2 100644 --- a/validate/tools/gst-validate-launcher.in +++ b/validate/tools/gst-validate-launcher.in @@ -19,8 +19,7 @@ import os import sys -import urlparse -from optparse import OptionParser +from launcher.main import main LIBDIR = '@LIBDIR@' @@ -29,80 +28,13 @@ def _in_devel(): root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) return os.path.exists(os.path.join(root_dir, '.git')) + def _add_gst_launcher_path(): if not _in_devel(): root = os.path.join(LIBDIR, 'gst-validate-launcher', 'python') sys.path.insert(0, root) -def main(): - _add_gst_launcher_path() - - from launcher import loggable - from launcher.baseclasses import _TestsLauncher - from launcher.utils import printc, path2url, DEFAULT_GST_QA_ASSETS - - parser = OptionParser() - # FIXME: - #parser.add_option("-g", "--gdb", dest="gdb", - #action="store_true", - #default=False, - #help="Run applications into gdb") - #parser.add_option("-f", "--forever", dest="forever", - #action="store_true", default=False, - #help="Keep running tests until one fails") - #parser.add_option("-F", "--fatal-error", dest="fatal_error", - #action="store_true", default=False, - #help="Stop on first fail") - parser.add_option('--xunit-file', action='store', - dest='xunit_file', metavar="FILE", - default=None, - help=("Path to xml file to store the xunit report in. " - "Default is xunit.xml the logs-dir directory")) - parser.add_option("-t", "--wanted-tests", dest="wanted_tests", - default=None, - help="Define the tests to execute, it can be a regex") - parser.add_option("-L", "--list-tests", - dest="list_tests", - action="store_true", - default=False, - help="List tests and exit") - parser.add_option("-l", "--logs-dir", dest="logsdir", - action="store_true", default=os.path.expanduser("~/gst-validate/logs/"), - help="Directory where to store logs") - parser.add_option("-p", "--medias-paths", dest="paths", - default=[os.path.join(DEFAULT_GST_QA_ASSETS, "medias")], - help="Paths in which to look for media files") - parser.add_option("-m", "--mute", dest="mute", - action="store_true", default=False, - help="Mute playback output, which mean that we use " - "a fakesink") - parser.add_option("-o", "--output-path", dest="dest", - default=None, - help="Set the path to which projects should be" - " renderd") - loggable.init("GST_VALIDATE_LAUNCHER_DEBUG", True, False) - - tests_launcher = _TestsLauncher() - tests_launcher.add_options(parser) - (options, args) = parser.parse_args() - if options.xunit_file is None: - options.xunit_file = os.path.join(options.logsdir, "xunit.xml") - if options.dest is None: - options.dest = os.path.join(options.logsdir, "rendered") - if urlparse.urlparse(options.dest).scheme == "": - options.dest = path2url(options.dest) - tests_launcher.set_settings(options, args) - tests_launcher.list_tests() - - if options.list_tests: - for test in tests_launcher.tests: - printc(test) - return 0 - - tests_launcher.run_tests() - tests_launcher.final_report() - return 0 - if "__main__" == __name__: + _add_gst_launcher_path() exit(main()) diff --git a/validate/tools/launcher/apps/ges-launch.py b/validate/tools/launcher/apps/ges-launch.py index 54cd459bff..6e0aa4dab0 100644 --- a/validate/tools/launcher/apps/ges-launch.py +++ b/validate/tools/launcher/apps/ges-launch.py @@ -174,6 +174,13 @@ class GESTestsManager(TestsManager): Gst.init(None) GES.init() + + def init(self): + if os.system("which ges-launch") == 0: + return True + + return False + def add_options(self, group): group.add_option("-P", "--projects-paths", dest="projects_paths", default=os.path.join(DEFAULT_GST_QA_ASSETS, "ges-projects"),