summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2014-03-19 18:09:09 +0100
committerEdward Hervey <edward@collabora.com>2014-03-19 18:09:09 +0100
commit12ccebe0a9acee0f55b5dfe051726fcd4cfcf520 (patch)
treed5d6ab279c67689541873634024030cd708e54a9
parentc39a44441e8379fe402e40d42775bd148a4b1cea (diff)
launcher: Don't hardcode option defaultstest_launch
Since they are relative to other options, we need to post-process them to get the proper value. Fixes using the launcher with non-default MAIN_DIR
-rw-r--r--validate/tools/launcher/main.py62
1 files changed, 33 insertions, 29 deletions
diff --git a/validate/tools/launcher/main.py b/validate/tools/launcher/main.py
index 51654cc..c54eab8 100644
--- a/validate/tools/launcher/main.py
+++ b/validate/tools/launcher/main.py
@@ -25,7 +25,7 @@ from optparse import OptionParser, OptionGroup
from httpserver import HTTPServer
from baseclasses import _TestsLauncher, ScenarioManager
-from utils import printc, path2url, DEFAULT_MAIN_DIR, launch_command, Colors
+from utils import printc, path2url, DEFAULT_MAIN_DIR, DEFAULT_GST_QA_ASSETS, launch_command, Colors
QA_ASSETS = "gst-qa-assets"
@@ -74,34 +74,25 @@ def main():
dest='xunit_file', metavar="FILE",
default=None,
help=("Path to xml file to store the xunit report in. "
- "Default is xunit.xml in the logs-dir directory"))
+ "Default is LOGSDIR/xunit.xml"))
dir_group.add_option("-M", "--main-dir", dest="main_dir",
default=DEFAULT_MAIN_DIR,
- help="Main directory where to put files."
- "Logs will land into 'main_dir'" + os.pathsep + "'logs' and"
- "assets will be cloned into 'main_dir'" + os.pathsep + "'gst-qa-assets'"
- " if not explicitely changed")
- dir_group.add_option("-o", "--output-dir", dest="outputdir",
- action="store_true", default=os.path.join(DEFAULT_MAIN_DIR,
- "logs"),
- help="Directory where to store logs and rendered files")
+ help="Main directory where to put files. Default is %s" % DEFAULT_MAIN_DIR)
+ dir_group.add_option("-o", "--output-dir", dest="output_dir",
+ default=None,
+ help="Directory where to store logs and rendered files. Default is MAIN_DIR")
dir_group.add_option("-l", "--logs-dir", dest="logsdir",
default=None,
- help="Directory where to store logs, default is logs/ in "
- "--output-dir result")
+ help="Directory where to store logs, default is OUTPUT_DIR/logs")
dir_group.add_option("-R", "--render-path", dest="dest",
default=None,
- help="Set the path to which projects should be rendered")
+ help="Set the path to which projects should be rendered, default is OUTPUT_DIR/rendered")
dir_group.add_option("-p", "--medias-paths", dest="paths", action="append",
default=None,
- help="Paths in which to look for media files, will be %s "
- "if nothing specified" %
- os.path.join(DEFAULT_MAIN_DIR, QA_ASSETS, "medias"))
+ help="Paths in which to look for media files, default is MAIN_DIR/gst-qa-assets/media")
dir_group.add_option("", "--clone-dir", dest="clone_dir",
default=None,
- help="Paths in which to look for media files, will be %s "
- "if nothing specified" %
- [os.path.join(DEFAULT_MAIN_DIR, QA_ASSETS)])
+ help="Paths in which to look for media files, default is MAIN_DIR/gst-qa-assets")
parser.add_option_group(dir_group)
http_server_group = OptionGroup(parser, "Handle the HTTP server to be created")
@@ -109,8 +100,8 @@ def main():
default=8079,
help="Port on which to run the http server on localhost")
http_server_group.add_option("-s", "--folder-for-http-server", dest="http_server_dir",
- default=os.path.join(DEFAULT_MAIN_DIR, QA_ASSETS, "medias"),
- help="Folder in which to create an http server on localhost")
+ default=None,
+ help="Folder in which to create an http server on localhost. Default is PATHS")
parser.add_option_group(http_server_group)
assets_group = OptionGroup(parser, "Handle remote assets")
@@ -122,7 +113,7 @@ def main():
help="Command to get assets")
assets_group.add_option("", "--remote-assets-url", dest="remote_assets_url",
default=DEFAULT_GST_QA_ASSETS_REPO,
- help="Url to the remote assets")
+ help="Url to the remote assets (default:%s)" % DEFAULT_GST_QA_ASSETS_REPO)
assets_group.add_option("-S", "--sync", dest="sync", action="store_true",
default=False, help="Synchronize asset repository")
parser.add_option_group(assets_group)
@@ -134,17 +125,23 @@ def main():
(options, args) = parser.parse_args()
- if not options.sync and not os.path.exists(options.main_dir):
- printc("MAIN_DIR (%s) does not exists. Forgot to run --sync ?" % os.path.abspath(options.main_dir), Colors.FAIL, True)
- return -1
+ # Get absolute path for main_dir and base everything on that
+ options.main_dir = os.path.abspath(options.main_dir)
+ # default for output_dir is MAINDIR
+ if not options.output_dir:
+ options.output_dir = options.main_dir
+ else:
+ options.output_dir = os.path.abspath(options.output_dir)
+
+ # other output directories
if options.logsdir is None:
- options.logsdir = os.path.join(options.outputdir, "logs")
+ options.logsdir = os.path.join(options.output_dir, "logs")
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.outputdir, "rendered")
+ options.dest = os.path.join(options.output_dir, "rendered")
+
if not os.path.exists(options.dest):
os.makedirs(options.dest)
if urlparse.urlparse(options.dest).scheme == "":
@@ -153,10 +150,17 @@ def main():
if options.no_color:
utils.desactivate_colors()
if options.clone_dir is None:
- options.clone_dir = os.path.join(DEFAULT_MAIN_DIR, QA_ASSETS)
+ options.clone_dir = os.path.join(options.main_dir, QA_ASSETS)
if options.paths is None:
options.paths = os.path.join(options.clone_dir, MEDIAS_FOLDER)
+ if options.http_server_dir is None:
+ options.http_server_dir = options.paths
+
+ if not options.sync and not os.path.exists(options.clone_dir):
+ printc("Media path (%s) does not exists. Forgot to run --sync ?" % options.clone_dir, Colors.FAIL, True)
+ return -1
+
tests_launcher.set_settings(options, args)
blacklisted = tests_launcher.get_blacklisted()