diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-08 16:39:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-08 16:39:23 +0000 |
commit | 724827ff93b2c563c4a90ea43aed959f4af35e54 (patch) | |
tree | 6654ef4be4fb6934653057f2449db8781df392e0 /test/lit.cfg | |
parent | e0be8b1729d8978de433d229c065830b95d0ae68 (diff) | |
download | clang-724827ff93b2c563c4a90ea43aed959f4af35e54.tar.gz |
Support running tests using the new 'lit', via 'make test LIT2=1'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81225 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/lit.cfg')
-rw-r--r-- | test/lit.cfg | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/test/lit.cfg b/test/lit.cfg index 2375a43213..dcda2ab378 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -1,10 +1,92 @@ # -*- Python -*- +def config_new(): + # Configuration file for the 'lit' test runner. + + # name: The name of this test suite. + config.name = 'Clang' + + # testFormat: The test format to use to interpret tests. + # + # For now we require '&&' between commands, until they get globally killed and + # the test runner updated. + config.test_format = lit.formats.ShTest(execute_external = True, + require_and_and = True) + + # suffixes: A list of file extensions to treat as test files. + config.suffixes = ['.c', '.cpp', '.m', '.mm'] + + ### + + # Discover the 'clang' and 'clangcc' to use. + + import os + + def inferClang(PATH): + # Determine which clang to use. + clang = os.getenv('CLANG') + + # If the user set clang in the environment, definitely use that and don't + # try to validate. + if clang: + return clang + + # Otherwise look in the path. + clang = lit.util.which('clang', PATH) + + if not clang: + lit.fatal("couldn't find 'clang' program, try setting " + "CLANG in your environment") + + 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 + ' ') ) + +if 'config' in globals(): + config_new() + raise SystemExit # End configuration. + # Configuration file for the 'lit' test runner. # suffixes: A list of file extensions to treat as test files. suffixes = ['.c', '.cpp', '.m', '.mm'] - + # environment: The base environment to use when running test commands. # # The 'PATH' and 'SYSTEMROOT' variables will be set automatically from the lit |