[lit] Pass more environment variables through to child processes.

This arose when I was trying to have a substitution which invoked a
python script P, and that python script tried to invoke clang-cl (or
even cl). Since we invoke P with a custom environment, it doesn't
inherit the environment of the parent, and then when we go to invoke
clang-cl, it's unable to find the MSVC installation directory. There
were many more I could have passed through which are set by vcvarsall,
but I tried to keep it simple and only pass through the important ones.

Differential Revision: https://reviews.llvm.org/D54963

llvm-svn: 347691
This commit is contained in:
Zachary Turner 2018-11-27 19:29:12 +00:00
parent ffba54493f
commit d37fa56a8e
1 changed files with 10 additions and 10 deletions

View File

@ -26,7 +26,16 @@ class TestingConfig:
'LSAN_OPTIONS', 'ADB', 'ANDROID_SERIAL',
'SANITIZER_IGNORE_CVE_2016_2143', 'TMPDIR', 'TMP', 'TEMP',
'TEMPDIR', 'AVRLIT_BOARD', 'AVRLIT_PORT',
'FILECHECK_DUMP_INPUT_ON_FAILURE', 'FILECHECK_OPTS']
'FILECHECK_DUMP_INPUT_ON_FAILURE', 'FILECHECK_OPTS',
'VCINSTALLDIR', 'VCToolsinstallDir', 'VSINSTALLDIR',
'WindowsSdkDir', 'WindowsSDKLibVersion']
if sys.platform == 'win32':
pass_vars.append('INCLUDE')
pass_vars.append('LIB')
pass_vars.append('PATHEXT')
environment['PYTHONBUFFERED'] = '1'
for var in pass_vars:
val = os.environ.get(var, '')
# Check for empty string as some variables such as LD_PRELOAD cannot be empty
@ -34,15 +43,6 @@ class TestingConfig:
if val:
environment[var] = val
if sys.platform == 'win32':
environment.update({
'INCLUDE' : os.environ.get('INCLUDE',''),
'PATHEXT' : os.environ.get('PATHEXT',''),
'PYTHONUNBUFFERED' : '1',
'TEMP' : os.environ.get('TEMP',''),
'TMP' : os.environ.get('TMP',''),
})
# Set the default available features based on the LitConfig.
available_features = []
if litConfig.useValgrind: