lit: Tweak example tests config.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98859 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-03-18 20:06:05 +00:00
parent f98bc6320b
commit 1814cf0f10

View File

@ -41,40 +41,7 @@ def inferClang(PATH):
return clang
def inferClangCC(clang, PATH):
clangcc = os.getenv('CLANGCC')
# If the user set clang in the environment, definitely use that and don't
# try to validate.
if clangcc:
return clangcc
# Otherwise try adding -cc since we expect to be looking in a build
# directory.
if clang.endswith('.exe'):
clangccName = clang[:-4] + '-cc.exe'
else:
clangccName = clang + '-cc'
clangcc = lit.util.which(clangccName, PATH)
if not clangcc:
# Otherwise ask clang.
res = lit.util.capture([clang, '-print-prog-name=clang-cc'])
res = res.strip()
if res and os.path.exists(res):
clangcc = res
if not clangcc:
lit.fatal("couldn't find 'clang-cc' program, try setting "
"CLANGCC in your environment")
return clangcc
clang = inferClang(config.environment['PATH'])
if not lit.quiet:
lit.note('using clang: %r' % clang)
config.substitutions.append( (' clang ', ' ' + clang + ' ') )
clang_cc = inferClangCC(clang, config.environment['PATH'])
if not lit.quiet:
lit.note('using clang-cc: %r' % clang_cc)
config.substitutions.append( (' clang-cc ', ' ' + clang_cc + ' ') )