71 lines · python
1# -*- Python -*-2 3import os4import platform5import re6import subprocess7import tempfile8 9import lit.formats10import lit.util11 12from lit.llvm import llvm_config13from lit.llvm.subst import ToolSubst14from lit.llvm.subst import FindTool15 16# Configuration file for the 'lit' test runner.17 18# name: The name of this test suite.19config.name = "STANDALONE"20 21config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)22 23# suffixes: A list of file extensions to treat as test files.24config.suffixes = [".mlir"]25 26# test_source_root: The root path where tests are located.27config.test_source_root = os.path.dirname(__file__)28 29# test_exec_root: The root path where tests should be run.30config.test_exec_root = os.path.join(config.standalone_obj_root, "test")31 32config.substitutions.append(("%PATH%", config.environment["PATH"]))33config.substitutions.append(("%shlibext", config.llvm_shlib_ext))34 35llvm_config.with_system_environment(["HOME", "INCLUDE", "LIB", "TMP", "TEMP"])36 37llvm_config.use_default_substitutions()38 39# excludes: A list of directories to exclude from the testsuite. The 'Inputs'40# subdirectories contain auxiliary inputs for various tests in their parent41# directories.42config.excludes = ["Inputs", "Examples", "CMakeLists.txt", "README.txt", "LICENSE.txt"]43 44# test_exec_root: The root path where tests should be run.45config.test_exec_root = os.path.join(config.standalone_obj_root, "test")46config.standalone_tools_dir = os.path.join(config.standalone_obj_root, "bin")47config.standalone_libs_dir = os.path.join(config.standalone_obj_root, "lib")48 49config.substitutions.append(("%standalone_libs", config.standalone_libs_dir))50 51# Tweak the PATH to include the tools dir.52llvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True)53 54tool_dirs = [config.standalone_tools_dir, config.llvm_tools_dir]55tools = [56 "mlir-opt",57 "standalone-capi-test",58 "standalone-opt",59 "standalone-translate",60]61 62llvm_config.add_tool_substitutions(tools, tool_dirs)63 64llvm_config.with_environment(65 "PYTHONPATH",66 [67 os.path.join(config.mlir_obj_dir, "python_packages", "standalone"),68 ],69 append_path=True,70)71