summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest_args.py6
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest_config.py3
4 files changed, 15 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index ab2ad790f8f..5113ccdf114 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -270,6 +270,9 @@ def parseOptionsAndInitTestdirs():
else:
os.environ[parts[0]] = parts[1]
+ if args.set_inferior_env_vars:
+ lldbtest_config.inferior_env = ' '.join(args.set_inferior_env_vars)
+
# only print the args if being verbose (and parsable is off)
if args.v and not args.q:
print(sys.argv)
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 225ccf1181c..a673d1d3489 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -210,6 +210,12 @@ def create_parser():
metavar='variable',
action='append',
help='Specify an environment variable to set to the given value before running the test cases e.g.: --env CXXFLAGS=-O3 --env DYLD_INSERT_LIBRARIES')
+ group.add_argument(
+ '--inferior-env',
+ dest='set_inferior_env_vars',
+ metavar='variable',
+ action='append',
+ help='Specify an environment variable to set to the given value for the inferior.')
X('-v', 'Do verbose mode of unittest framework (print out each test case invocation)')
group.add_argument(
'--enable-crash-dialog',
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 019a24b4bf8..0fbdfd82f53 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1856,6 +1856,9 @@ class TestBase(Base):
# decorators.
Base.setUp(self)
+ if lldbtest_config.inferior_env:
+ self.runCmd('settings set target.env-vars {}'.format(lldbtest_config.inferior_env))
+
# Set the clang modules cache path used by LLDB.
mod_cache = os.path.join(os.environ["LLDB_BUILD"], "module-cache-lldb")
self.runCmd('settings set symbols.clang-modules-cache-path "%s"'
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest_config.py b/lldb/packages/Python/lldbsuite/test/lldbtest_config.py
index 29184dd7831..d31588ab15c 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest_config.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest_config.py
@@ -20,3 +20,6 @@ out_of_tree_debugserver = False
# path to the lldb command line executable tool
lldbExec = None
+
+# Environment variables for the inferior
+inferior_env = None
OpenPOWER on IntegriCloud