[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.
This commit is contained in:
Pavel Labath 2019-12-20 15:11:49 +01:00
parent 453dc4d7ec
commit b04b92c3a4
1 changed files with 7 additions and 1 deletions

View File

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