Initial boiler-plate for python bindings. · llvm/llvm-project@722475a (original) (raw)

`@@ -21,7 +21,7 @@

`

21

21

`config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)

`

22

22

``

23

23

`# suffixes: A list of file extensions to treat as test files.

`

24

``

`-

config.suffixes = ['.td', '.mlir', '.toy', '.ll', '.tc']

`

``

24

`+

config.suffixes = ['.td', '.mlir', '.toy', '.ll', '.tc', '.py']

`

25

25

``

26

26

`# test_source_root: The root path where tests are located.

`

27

27

`config.test_source_root = os.path.dirname(file)

`

`@@ -41,7 +41,8 @@

`

41

41

`# excludes: A list of directories to exclude from the testsuite. The 'Inputs'

`

42

42

`# subdirectories contain auxiliary inputs for various tests in their parent

`

43

43

`# directories.

`

44

``

`-

config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']

`

``

44

`+

config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt',

`

``

45

`+

'lit.cfg.py', 'lit.site.cfg.py']

`

45

46

``

46

47

`# test_source_root: The root path where tests are located.

`

47

48

`config.test_source_root = os.path.dirname(file)

`

`@@ -62,6 +63,7 @@

`

62

63

``

63

64

`# The following tools are optional

`

64

65

`tools.extend([

`

``

66

`+

ToolSubst('%PYTHON', config.python_executable),

`

65

67

`ToolSubst('toy-ch1', unresolved='ignore'),

`

66

68

`ToolSubst('toy-ch2', unresolved='ignore'),

`

67

69

`ToolSubst('toy-ch3', unresolved='ignore'),

`

`@@ -71,7 +73,7 @@

`

71

73

`ToolSubst('%linalg_test_lib_dir', config.linalg_test_lib_dir, unresolved='ignore'),

`

72

74

`ToolSubst('%mlir_runner_utils_dir', config.mlir_runner_utils_dir, unresolved='ignore'),

`

73

75

`ToolSubst('%rocm_wrapper_library_dir', config.rocm_wrapper_library_dir, unresolved='ignore'),

`

74

``

`-

ToolSubst('%vulkan_wrapper_library_dir', config.vulkan_wrapper_library_dir, unresolved='ignore')

`

``

76

`+

ToolSubst('%vulkan_wrapper_library_dir', config.vulkan_wrapper_library_dir, unresolved='ignore'),

`

75

77

`])

`

76

78

``

77

79

`llvm_config.add_tool_substitutions(tools, tool_dirs)

`

`@@ -89,3 +91,13 @@

`

89

91

`# to be available for JIT tests.

`

90

92

`if config.target_triple:

`

91

93

`config.available_features.add('default_triple')

`

``

94

+

``

95

`+

Add the python path for both the source and binary tree.

`

``

96

`+

Note that presently, the python sources come from the source tree and the

`

``

97

`+

binaries come from the build tree. This should be unified to the build tree

`

``

98

`+

by copying/linking sources to build.

`

``

99

`+

if config.enable_bindings_python:

`

``

100

`+

llvm_config.with_environment('PYTHONPATH', [

`

``

101

`+

os.path.join(config.mlir_src_root, "lib", "Bindings", "Python"),

`

``

102

`+

os.path.join(config.mlir_obj_root, "lib", "Bindings", "Python"),

`

``

103

`+

], append_path=True)

`