mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-07 15:02:40 +00:00
launcher: Don't hardcode option defaults
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
This commit is contained in:
parent
c39a44441e
commit
12ccebe0a9
1 changed files with 33 additions and 29 deletions
|
@ -25,7 +25,7 @@ from optparse import OptionParser, OptionGroup
|
||||||
|
|
||||||
from httpserver import HTTPServer
|
from httpserver import HTTPServer
|
||||||
from baseclasses import _TestsLauncher, ScenarioManager
|
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"
|
QA_ASSETS = "gst-qa-assets"
|
||||||
|
@ -74,34 +74,25 @@ def main():
|
||||||
dest='xunit_file', metavar="FILE",
|
dest='xunit_file', metavar="FILE",
|
||||||
default=None,
|
default=None,
|
||||||
help=("Path to xml file to store the xunit report in. "
|
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",
|
dir_group.add_option("-M", "--main-dir", dest="main_dir",
|
||||||
default=DEFAULT_MAIN_DIR,
|
default=DEFAULT_MAIN_DIR,
|
||||||
help="Main directory where to put files."
|
help="Main directory where to put files. Default is %s" % DEFAULT_MAIN_DIR)
|
||||||
"Logs will land into 'main_dir'" + os.pathsep + "'logs' and"
|
dir_group.add_option("-o", "--output-dir", dest="output_dir",
|
||||||
"assets will be cloned into 'main_dir'" + os.pathsep + "'gst-qa-assets'"
|
default=None,
|
||||||
" if not explicitely changed")
|
help="Directory where to store logs and rendered files. Default is MAIN_DIR")
|
||||||
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")
|
|
||||||
dir_group.add_option("-l", "--logs-dir", dest="logsdir",
|
dir_group.add_option("-l", "--logs-dir", dest="logsdir",
|
||||||
default=None,
|
default=None,
|
||||||
help="Directory where to store logs, default is logs/ in "
|
help="Directory where to store logs, default is OUTPUT_DIR/logs")
|
||||||
"--output-dir result")
|
|
||||||
dir_group.add_option("-R", "--render-path", dest="dest",
|
dir_group.add_option("-R", "--render-path", dest="dest",
|
||||||
default=None,
|
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",
|
dir_group.add_option("-p", "--medias-paths", dest="paths", action="append",
|
||||||
default=None,
|
default=None,
|
||||||
help="Paths in which to look for media files, will be %s "
|
help="Paths in which to look for media files, default is MAIN_DIR/gst-qa-assets/media")
|
||||||
"if nothing specified" %
|
|
||||||
os.path.join(DEFAULT_MAIN_DIR, QA_ASSETS, "medias"))
|
|
||||||
dir_group.add_option("", "--clone-dir", dest="clone_dir",
|
dir_group.add_option("", "--clone-dir", dest="clone_dir",
|
||||||
default=None,
|
default=None,
|
||||||
help="Paths in which to look for media files, will be %s "
|
help="Paths in which to look for media files, default is MAIN_DIR/gst-qa-assets")
|
||||||
"if nothing specified" %
|
|
||||||
[os.path.join(DEFAULT_MAIN_DIR, QA_ASSETS)])
|
|
||||||
parser.add_option_group(dir_group)
|
parser.add_option_group(dir_group)
|
||||||
|
|
||||||
http_server_group = OptionGroup(parser, "Handle the HTTP server to be created")
|
http_server_group = OptionGroup(parser, "Handle the HTTP server to be created")
|
||||||
|
@ -109,8 +100,8 @@ def main():
|
||||||
default=8079,
|
default=8079,
|
||||||
help="Port on which to run the http server on localhost")
|
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",
|
http_server_group.add_option("-s", "--folder-for-http-server", dest="http_server_dir",
|
||||||
default=os.path.join(DEFAULT_MAIN_DIR, QA_ASSETS, "medias"),
|
default=None,
|
||||||
help="Folder in which to create an http server on localhost")
|
help="Folder in which to create an http server on localhost. Default is PATHS")
|
||||||
parser.add_option_group(http_server_group)
|
parser.add_option_group(http_server_group)
|
||||||
|
|
||||||
assets_group = OptionGroup(parser, "Handle remote assets")
|
assets_group = OptionGroup(parser, "Handle remote assets")
|
||||||
|
@ -122,7 +113,7 @@ def main():
|
||||||
help="Command to get assets")
|
help="Command to get assets")
|
||||||
assets_group.add_option("", "--remote-assets-url", dest="remote_assets_url",
|
assets_group.add_option("", "--remote-assets-url", dest="remote_assets_url",
|
||||||
default=DEFAULT_GST_QA_ASSETS_REPO,
|
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",
|
assets_group.add_option("-S", "--sync", dest="sync", action="store_true",
|
||||||
default=False, help="Synchronize asset repository")
|
default=False, help="Synchronize asset repository")
|
||||||
parser.add_option_group(assets_group)
|
parser.add_option_group(assets_group)
|
||||||
|
@ -134,17 +125,23 @@ def main():
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if not options.sync and not os.path.exists(options.main_dir):
|
# Get absolute path for main_dir and base everything on that
|
||||||
printc("MAIN_DIR (%s) does not exists. Forgot to run --sync ?" % os.path.abspath(options.main_dir), Colors.FAIL, True)
|
options.main_dir = os.path.abspath(options.main_dir)
|
||||||
return -1
|
|
||||||
|
|
||||||
|
# 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:
|
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:
|
if options.xunit_file is None:
|
||||||
options.xunit_file = os.path.join(options.logsdir, "xunit.xml")
|
options.xunit_file = os.path.join(options.logsdir, "xunit.xml")
|
||||||
|
|
||||||
if options.dest is None:
|
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):
|
if not os.path.exists(options.dest):
|
||||||
os.makedirs(options.dest)
|
os.makedirs(options.dest)
|
||||||
if urlparse.urlparse(options.dest).scheme == "":
|
if urlparse.urlparse(options.dest).scheme == "":
|
||||||
|
@ -153,10 +150,17 @@ def main():
|
||||||
if options.no_color:
|
if options.no_color:
|
||||||
utils.desactivate_colors()
|
utils.desactivate_colors()
|
||||||
if options.clone_dir is None:
|
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:
|
if options.paths is None:
|
||||||
options.paths = os.path.join(options.clone_dir, MEDIAS_FOLDER)
|
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)
|
tests_launcher.set_settings(options, args)
|
||||||
|
|
||||||
blacklisted = tests_launcher.get_blacklisted()
|
blacklisted = tests_launcher.get_blacklisted()
|
||||||
|
|
Loading…
Reference in a new issue