|
| 1 | +# Licensed under the Apache License v2.0 with LLVM Exceptions. |
| 2 | +# See https://llvm.org/LICENSE.txt for license information. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | +# Also available under a BSD-style license. See LICENSE. |
| 5 | + |
| 6 | +load("@bazel_skylib//rules:expand_template.bzl", "expand_template") |
| 7 | +load("@llvm-project//llvm:lit_test.bzl", "lit_test") |
| 8 | + |
| 9 | +expand_template( |
| 10 | + name = "lit_site_cfg_py", |
| 11 | + testonly = True, |
| 12 | + out = "lit.site.cfg.py", |
| 13 | + substitutions = { |
| 14 | + "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.", |
| 15 | + "\"@LLVM_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'llvm-project', 'llvm')", |
| 16 | + "\"@MLIR_TENSORRT_DIALECT_BINARY_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'tensorrt-mlir')", |
| 17 | + "\"@MLIR_TENSORRT_DIALECT_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'tensorrt-mlir', 'tensorrt')", |
| 18 | + "@MLIR_ENABLE_BINDINGS_PYTHON@": "False", |
| 19 | + "@ENABLE_ASAN@": "False", |
| 20 | + }, |
| 21 | + template = "lit.site.cfg.py.in", |
| 22 | +) |
| 23 | + |
| 24 | +# Common data used by most lit tests. |
| 25 | +filegroup( |
| 26 | + name = "lit_data", |
| 27 | + testonly = True, |
| 28 | + data = [ |
| 29 | + "lit.cfg.py", |
| 30 | + "lit.site.cfg.py", |
| 31 | + "@llvm-project//llvm:FileCheck", |
| 32 | + "@llvm-project//llvm:count", |
| 33 | + "@llvm-project//llvm:not", |
| 34 | + ], |
| 35 | +) |
| 36 | + |
| 37 | +[ |
| 38 | + lit_test( |
| 39 | + name = "%s.test" % src, |
| 40 | + srcs = [src], |
| 41 | + data = [ |
| 42 | + "//:tensorrt-opt", |
| 43 | + "//tensorrt/test:lit_data", |
| 44 | + ], |
| 45 | + tags = ["tensorrt_mlir_dialect_tests"], |
| 46 | + ) |
| 47 | + for src in glob( |
| 48 | + [ |
| 49 | + "TensorRT/*.mlir", |
| 50 | + ], |
| 51 | + exclude = [ |
| 52 | + # exclude MLIR_TRT_ENABLE_TESTING related tests |
| 53 | + "TensorRT/tensor-kind-analysis.mlir", |
| 54 | + ], |
| 55 | + ) |
| 56 | +] |
| 57 | + |
| 58 | +test_suite( |
| 59 | + name = "tensorrt_mlir_dialect_tests", |
| 60 | + tags = ["tensorrt_mlir_dialect_tests"], |
| 61 | +) |
0 commit comments