1160f5aa6SJean-Michel Gorius# -*- Python -*- 2160f5aa6SJean-Michel Gorius 3160f5aa6SJean-Michel Goriusimport os 4160f5aa6SJean-Michel Goriusimport platform 5160f5aa6SJean-Michel Goriusimport re 6160f5aa6SJean-Michel Goriusimport subprocess 7160f5aa6SJean-Michel Goriusimport tempfile 8160f5aa6SJean-Michel Gorius 9160f5aa6SJean-Michel Goriusimport lit.formats 10160f5aa6SJean-Michel Goriusimport lit.util 11160f5aa6SJean-Michel Gorius 12160f5aa6SJean-Michel Goriusfrom lit.llvm import llvm_config 13160f5aa6SJean-Michel Goriusfrom lit.llvm.subst import ToolSubst 14160f5aa6SJean-Michel Goriusfrom lit.llvm.subst import FindTool 15160f5aa6SJean-Michel Gorius 16160f5aa6SJean-Michel Gorius# Configuration file for the 'lit' test runner. 17160f5aa6SJean-Michel Gorius 18160f5aa6SJean-Michel Gorius# name: The name of this test suite. 19*f9008e63STobias Hietaconfig.name = "STANDALONE" 20160f5aa6SJean-Michel Gorius 21160f5aa6SJean-Michel Goriusconfig.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell) 22160f5aa6SJean-Michel Gorius 23160f5aa6SJean-Michel Gorius# suffixes: A list of file extensions to treat as test files. 24*f9008e63STobias Hietaconfig.suffixes = [".mlir"] 25160f5aa6SJean-Michel Gorius 26160f5aa6SJean-Michel Gorius# test_source_root: The root path where tests are located. 27160f5aa6SJean-Michel Goriusconfig.test_source_root = os.path.dirname(__file__) 28160f5aa6SJean-Michel Gorius 29160f5aa6SJean-Michel Gorius# test_exec_root: The root path where tests should be run. 30*f9008e63STobias Hietaconfig.test_exec_root = os.path.join(config.standalone_obj_root, "test") 31160f5aa6SJean-Michel Gorius 32*f9008e63STobias Hietaconfig.substitutions.append(("%PATH%", config.environment["PATH"])) 33*f9008e63STobias Hietaconfig.substitutions.append(("%shlibext", config.llvm_shlib_ext)) 34160f5aa6SJean-Michel Gorius 35*f9008e63STobias Hietallvm_config.with_system_environment(["HOME", "INCLUDE", "LIB", "TMP", "TEMP"]) 36160f5aa6SJean-Michel Gorius 37160f5aa6SJean-Michel Goriusllvm_config.use_default_substitutions() 38160f5aa6SJean-Michel Gorius 39160f5aa6SJean-Michel Gorius# excludes: A list of directories to exclude from the testsuite. The 'Inputs' 40160f5aa6SJean-Michel Gorius# subdirectories contain auxiliary inputs for various tests in their parent 41160f5aa6SJean-Michel Gorius# directories. 42*f9008e63STobias Hietaconfig.excludes = ["Inputs", "Examples", "CMakeLists.txt", "README.txt", "LICENSE.txt"] 43160f5aa6SJean-Michel Gorius 44160f5aa6SJean-Michel Gorius# test_exec_root: The root path where tests should be run. 45*f9008e63STobias Hietaconfig.test_exec_root = os.path.join(config.standalone_obj_root, "test") 46*f9008e63STobias Hietaconfig.standalone_tools_dir = os.path.join(config.standalone_obj_root, "bin") 47*f9008e63STobias Hietaconfig.standalone_libs_dir = os.path.join(config.standalone_obj_root, "lib") 485e2afe5cSFabian Mora 49*f9008e63STobias Hietaconfig.substitutions.append(("%standalone_libs", config.standalone_libs_dir)) 50160f5aa6SJean-Michel Gorius 51160f5aa6SJean-Michel Gorius# Tweak the PATH to include the tools dir. 52*f9008e63STobias Hietallvm_config.with_environment("PATH", config.llvm_tools_dir, append_path=True) 53160f5aa6SJean-Michel Gorius 54160f5aa6SJean-Michel Goriustool_dirs = [config.standalone_tools_dir, config.llvm_tools_dir] 55160f5aa6SJean-Michel Goriustools = [ 56*f9008e63STobias Hieta "mlir-opt", 57*f9008e63STobias Hieta "standalone-capi-test", 58*f9008e63STobias Hieta "standalone-opt", 59*f9008e63STobias Hieta "standalone-translate", 60160f5aa6SJean-Michel Gorius] 61160f5aa6SJean-Michel Gorius 62160f5aa6SJean-Michel Goriusllvm_config.add_tool_substitutions(tools, tool_dirs) 63132bc6e2SStella Laurenzo 64*f9008e63STobias Hietallvm_config.with_environment( 65*f9008e63STobias Hieta "PYTHONPATH", 66*f9008e63STobias Hieta [ 67*f9008e63STobias Hieta os.path.join(config.mlir_obj_dir, "python_packages", "standalone"), 68*f9008e63STobias Hieta ], 69*f9008e63STobias Hieta append_path=True, 70*f9008e63STobias Hieta) 71