1# -*- Python -*-
2
3# Configuration file for the 'lit' test runner.
4
5# name: The name of this test suite.
6config.name = 'Clang'
7
8# testFormat: The test format to use to interpret tests.
9#
10# For now we require '&&' between commands, until they get globally killed and
11# the test runner updated.
12config.test_format = lit.formats.ShTest(execute_external = True)
13
14# suffixes: A list of file extensions to treat as test files.
15config.suffixes = ['.c', '.cpp', '.m', '.mm']
16
17# target_triple: Used by ShTest and TclTest formats for XFAIL checks.
18config.target_triple = 'foo'
19
20###
21
22# Discover the 'clang' and 'clangcc' to use.
23
24import os
25
26def inferClang(PATH):
27    # Determine which clang to use.
28    clang = os.getenv('CLANG')
29
30    # If the user set clang in the environment, definitely use that and don't
31    # try to validate.
32    if clang:
33        return clang
34
35    # Otherwise look in the path.
36    clang = lit.util.which('clang', PATH)
37
38    if not clang:
39        lit.fatal("couldn't find 'clang' program, try setting "
40                  "CLANG in your environment")
41
42    return clang
43
44clang = inferClang(config.environment['PATH'])
45if not lit.quiet:
46    lit.note('using clang: %r' % clang)
47config.substitutions.append( (' clang ', ' ' + clang + ' ') )
48