Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Bug 1199574 - Add --workspace CLI option as configurable location for…
Browse files Browse the repository at this point in the history
… all temporary data. r=chmanchester

(cherry picked from commit 7376b59)
  • Loading branch information
whimboo committed Aug 31, 2015
1 parent 9d3657b commit 25229c6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion firefox_ui_harness/options/base.py
Expand Up @@ -15,7 +15,10 @@ def __init__(self, **kwargs):
# Inheriting object must call this __init__ to set up option handling
self.add_option('--installer',
dest='installer',
help='installer of a Gecko application to use for running the tests')
help='Installer of a Gecko application to use for running the tests')
self.add_option('--workspace',
dest='workspace_path',
help='Path to use for all temporary data. Defaults to TEMP.')

def parse_args(self, *args, **kwargs):
options, tests = BaseMarionetteOptions.parse_args(self, *args, **kwargs)
Expand Down
14 changes: 13 additions & 1 deletion firefox_ui_harness/runtests.py
Expand Up @@ -23,11 +23,23 @@ def startTestRunner(runner_class, options, tests):
install_folder = None

try:
# Prepare the workspace path so that all temporary data can be stored inside it.
if options.workspace_path:
path = os.path.expanduser(options.workspace_path)
options.workspace = os.path.abspath(path)

if not os.path.exists(options.workspace):
os.makedirs(options.workspace)
else:
options.workspace = tempfile.mkdtemp('.{}'.format(os.path.basename(sys.argv[0])))

options.logger.info('Using workspace for temporary data: "{}"'.format(options.workspace))

# If the specified binary is an installer it needs to be installed
if options.installer:
installer = os.path.realpath(options.installer)

dest_folder = tempfile.mkdtemp()
dest_folder = os.path.join(options.workspace, 'binary')
options.logger.info('Installing application "%s" to "%s"' % (installer,
dest_folder))
install_folder = mozinstall.install(installer, dest_folder)
Expand Down

0 comments on commit 25229c6

Please sign in to comment.