зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1899669 - Add --setenv support to mach xpcshell-test r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D212075
This commit is contained in:
Родитель
79677c2de9
Коммит
b77759f116
|
@ -93,7 +93,7 @@ from manifestparser.filters import chunk_by_slice, failures, pathprefix, tags
|
|||
from manifestparser.util import normsep
|
||||
from mozlog import commandline
|
||||
from mozprofile import Profile
|
||||
from mozprofile.cli import parse_preferences
|
||||
from mozprofile.cli import parse_key_value, parse_preferences
|
||||
from mozrunner.utils import get_stack_fixer_function
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
@ -1855,6 +1855,13 @@ class XPCShellTests(object):
|
|||
|
||||
# buildEnvironment() needs mozInfo, so we call it after mozInfo is initialized.
|
||||
self.buildEnvironment()
|
||||
extraEnv = parse_key_value(options.get("extraEnv") or [], context="--setenv")
|
||||
for k, v in extraEnv:
|
||||
if k in self.env:
|
||||
self.log.info(
|
||||
"Using environment variable %s instead of %s." % (v, self.env[k])
|
||||
)
|
||||
self.env[k] = v
|
||||
|
||||
# The appDirKey is a optional entry in either the default or individual test
|
||||
# sections that defines a relative application directory for test runs. If
|
||||
|
|
|
@ -283,6 +283,14 @@ def add_common_arguments(parser):
|
|||
metavar="PREF=VALUE",
|
||||
help="Defines an extra user preference (can be passed multiple times.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--setenv",
|
||||
action="append",
|
||||
dest="extraEnv",
|
||||
metavar="NAME=VALUE",
|
||||
help="Set one or more environment variable before launching the test "
|
||||
"(can be passed multiple times).",
|
||||
)
|
||||
parser.add_argument(
|
||||
"testPaths", nargs="*", default=None, help="Paths of tests to run."
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче