[ASan] add llvm_tools_dir to lit.site.cfg for ASan and add it to PATH
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161411 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/lit.common.cfg b/lib/lit.common.cfg
index 725156b..16ba076 100644
--- a/lib/lit.common.cfg
+++ b/lib/lit.common.cfg
@@ -35,6 +35,13 @@
if name in config.environment:
del config.environment[name]
+# Tweak PATH to include llvm tools dir.
+llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)):
+ lit.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir)
+path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
+config.environment['PATH'] = path
+
# Define %clang substitution to use in test RUN lines.
config.substitutions.append( ("%clang ", (" " + config.clang + " ")) )