1 # -*- Python -*- 2 3 import os 4 import sys 5 6 import lit.formats 7 8 # Configuration file for the 'lit' test runner. 9 10 # name: The name of this test suite. 11 config.name = 'lit' 12 13 # testFormat: The test format to use to interpret tests. 14 config.test_format = lit.formats.ShTest(execute_external=False) 15 16 # suffixes: A list of file extensions to treat as test files. 17 config.suffixes = ['.py'] 18 19 # excludes: A list of individual files to exclude. 20 config.excludes = ['Inputs'] 21 22 # test_source_root: The root path where tests are located. 23 config.test_source_root = os.path.dirname(__file__) 24 config.test_exec_root = config.test_source_root 25 26 config.target_triple = '(unused)' 27 28 src_root = os.path.join(config.test_source_root, '..') 29 config.environment['PYTHONPATH'] = src_root 30 config.substitutions.append(('%{src_root}', src_root)) 31 config.substitutions.append(('%{inputs}', os.path.join( 32 src_root, 'tests', 'Inputs'))) 33 config.substitutions.append(('%{lit}', "%%{python} %s" % ( 34 os.path.join(src_root, 'lit.py'),))) 35 config.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. 39 if 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. 44 config.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 48 try: 49 import psutil 50 lit_config.note('Found python psutil module') 51 config.available_features.add("python-psutil") 52 except 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