[Lldb-commits] [lldb] b04b92c - [lldb/pexpect] Force-set the TERM environment variable

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 20 06:17:35 PST 2019


Author: Pavel Labath
Date: 2019-12-20T15:19:41+01:00
New Revision: b04b92c3a4640417f2074e7e903df8c2b76eadfd

URL: https://github.com/llvm/llvm-project/commit/b04b92c3a4640417f2074e7e903df8c2b76eadfd
DIFF: https://github.com/llvm/llvm-project/commit/b04b92c3a4640417f2074e7e903df8c2b76eadfd.diff

LOG: [lldb/pexpect] Force-set the TERM environment variable

In some environments (typically, buildbots), this variable may not be
available. This can cause tests to behave differently.

Explicitly set the variable to "vt100" to ensure consistent test
behavior. It should not matter that we do not inherit the process TERM
variable, as the child process runs in a new virtual terminal anyway.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbpexpect.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
index 13552dca7b9a..d599bc397622 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -1,6 +1,7 @@
 from __future__ import absolute_import
 
 # System modules
+import os
 import sys
 
 # Third-party modules
@@ -29,6 +30,7 @@ def expect_prompt(self):
         def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None):
             logfile = getattr(sys.stdout, 'buffer',
                               sys.stdout) if self.TraceOn() else None
+
             args = ['--no-lldbinit', '--no-use-colors']
             for cmd in self.setUpCommands():
                 args += ['-O', cmd]
@@ -36,9 +38,13 @@ def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None):
                 args += ['--file', executable]
             if extra_args is not None:
                 args.extend(extra_args)
+
+            env = dict(os.environ)
+            env["TERM"]="vt100"
+
             self.child = pexpect.spawn(
                     lldbtest_config.lldbExec, args=args, logfile=logfile,
-                    timeout=timeout, dimensions=dimensions)
+                    timeout=timeout, dimensions=dimensions, env=env)
             self.expect_prompt()
             for cmd in self.setUpCommands():
                 self.child.expect_exact(cmd)


        


More information about the lldb-commits mailing list