github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/mlir/test/lit.cfg.py (about) 1 # -*- Python -*- 2 3 import os 4 import platform 5 import re 6 import subprocess 7 import tempfile 8 9 import lit.formats 10 import lit.util 11 12 from lit.llvm import llvm_config 13 from lit.llvm.subst import ToolSubst 14 from lit.llvm.subst import FindTool 15 16 # Configuration file for the 'lit' test runner. 17 18 # name: The name of this test suite. 19 config.name = 'MLIR' 20 21 config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell) 22 23 # suffixes: A list of file extensions to treat as test files. 24 config.suffixes = ['.td', '.mlir', '.toy'] 25 26 # test_source_root: The root path where tests are located. 27 config.test_source_root = os.path.dirname(__file__) 28 29 # test_exec_root: The root path where tests should be run. 30 config.test_exec_root = os.path.join(config.mlir_obj_root, 'test') 31 32 config.substitutions.append(('%PATH%', config.environment['PATH'])) 33 config.substitutions.append(('%shlibext', config.llvm_shlib_ext)) 34 35 llvm_config.with_system_environment( 36 ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP']) 37 38 llvm_config.use_default_substitutions() 39 40 # excludes: A list of directories to exclude from the testsuite. The 'Inputs' 41 # subdirectories contain auxiliary inputs for various tests in their parent 42 # directories. 43 config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt'] 44 45 # test_source_root: The root path where tests are located. 46 config.test_source_root = os.path.dirname(__file__) 47 48 # test_exec_root: The root path where tests should be run. 49 config.test_exec_root = os.path.join(config.mlir_obj_root, 'test') 50 51 # Tweak the PATH to include the tools dir. 52 llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True) 53 54 tool_dirs = [config.mlir_tools_dir, config.llvm_tools_dir] 55 tools = [ 56 'mlir-opt', 57 'mlir-tblgen', 58 'mlir-translate', 59 'mlir-edsc-builder-api-test', 60 ] 61 62 # The following tools are optional 63 tools.extend([ 64 ToolSubst('toy-ch1', unresolved='ignore'), 65 ToolSubst('toy-ch2', unresolved='ignore'), 66 ToolSubst('toy-ch3', unresolved='ignore'), 67 ToolSubst('toy-ch4', unresolved='ignore'), 68 ToolSubst('toy-ch5', unresolved='ignore'), 69 ToolSubst('%linalg_test_lib_dir', config.linalg_test_lib_dir, unresolved='ignore'), 70 ToolSubst('%cuda_wrapper_library_dir', config.cuda_wrapper_library_dir, unresolved='ignore') 71 ]) 72 73 llvm_config.add_tool_substitutions(tools, tool_dirs)