aboutsummaryrefslogtreecommitdiff
path: root/test/lit.cfg
diff options
context:
space:
mode:
authorJordy Rose <jediknil@belkadan.com>2012-04-06 18:14:01 +0000
committerJordy Rose <jediknil@belkadan.com>2012-04-06 18:14:01 +0000
commit40f45ee42bb81ab3dfd5436d9c0e24fc5331034b (patch)
tree4a6c4552c38a0479a3ca1b8e94c5c99890330123 /test/lit.cfg
parentb2f6820773aabff3c5c9e0dbb1cbbbda0d80c41f (diff)
Clear environment variables that might affect Clang before running tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/lit.cfg')
-rw-r--r--test/lit.cfg26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/lit.cfg b/test/lit.cfg
index f759275784..3dee99652c 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -46,6 +46,32 @@ if clang_obj_root is not None:
config.llvm_src_root = getattr(config, 'llvm_src_root', None)
config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
+# Clear some environment variables that might affect Clang.
+#
+# This first set of vars are read by Clang, but shouldn't affect tests
+# that aren't specifically looking for these features, or are required
+# simply to run the tests at all.
+#
+# FIXME: Should we have a tool that enforces this?
+
+# safe_env_vars = ('TMPDIR', 'TEMP', 'TMP', 'USERPROFILE', 'PWD',
+# 'MACOSX_DEPLOYMENT_TARGET', 'IPHONEOS_DEPLOYMENT_TARGET',
+# 'IOS_SIMULATOR_DEPLOYMENT_TARGET',
+# 'VCINSTALLDIR', 'VC100COMNTOOLS', 'VC90COMNTOOLS',
+# 'VC80COMNTOOLS')
+possibly_dangerous_env_vars = ('COMPILER_PATH', 'RC_DEBUG_OPTIONS', 'INCLUDE',
+ 'CINDEXTEST_PREAMBLE_FILE', 'LIBRARY_PATH',
+ 'CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
+ 'OBJC_INCLUDE_PATH', 'OBJCPLUS_INCLUDE_PATH',
+ 'LIBCLANG_TIMING', 'LIBCLANG_OBJTRACKING',
+ 'LIBCLANG_LOGGING', 'LIBCLANG_BGPRIO_INDEX',
+ 'LIBCLANG_BGPRIO_EDIT', 'LIBCLANG_NOTHREADS',
+ 'LIBCLANG_RESOURCE_USAGE',
+ 'LIBCLANG_CODE_COMPLETION_LOGGING')
+for name in possibly_dangerous_env_vars:
+ if name in config.environment:
+ del config.environment[name]
+
# Tweak the PATH to include the tools dir and the scripts dir.
if clang_obj_root is not None:
llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)