1# -*- Python -*- 2 3import os 4import sys 5 6import lit.formats 7 8# Configuration file for the 'lit' test runner. 9 10# name: The name of this test suite. 11config.name = 'lit' 12 13# testFormat: The test format to use to interpret tests. 14config.test_format = lit.formats.ShTest(execute_external=False) 15 16# suffixes: A list of file extensions to treat as test files. 17config.suffixes = ['.py'] 18 19# excludes: A list of individual files to exclude. 20config.excludes = ['Inputs'] 21 22# test_source_root: The root path where tests are located. 23config.test_source_root = os.path.dirname(__file__) 24config.test_exec_root = config.test_source_root 25 26config.target_triple = '(unused)' 27 28src_root = os.path.join(config.test_source_root, '..') 29config.environment['PYTHONPATH'] = src_root 30config.substitutions.append(('%{src_root}', src_root)) 31config.substitutions.append(('%{inputs}', os.path.join( 32 src_root, 'tests', 'Inputs'))) 33config.substitutions.append(('%{lit}', "%%{python} %s" % ( 34 os.path.join(src_root, 'lit.py'),))) 35config.substitutions.append(('%{python}', sys.executable)) 36 37# Enable coverage.py reporting, assuming the coverage module has been installed 38# and sitecustomize.py in the virtualenv has been modified appropriately. 39if lit_config.params.get('check-coverage', None): 40 config.environment['COVERAGE_PROCESS_START'] = os.path.join( 41 os.path.dirname(__file__), ".coveragerc") 42 43# Add a feature to detect the Python version. 44config.available_features.add("python%d.%d" % (sys.version_info[0], 45 sys.version_info[1])) 46 47# Add a feature to detect if psutil is available 48try: 49 import psutil 50 lit_config.note('Found python psutil module') 51 config.available_features.add("python-psutil") 52except ImportError: 53 lit_config.warning('Could not import psutil. Some tests will be skipped and' 54 ' the --timeout command line argument will not work.') 55