llvm/utils/bazel/llvm-project-overlay/llvm/utils/lit/tests/BUILD.bazel

# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("//llvm:lit_test.bzl", "lit_test", "package_path")

expand_template(
    name = "lit_site_cfg",
    testonly = True,
    out = "lit.site.cfg",
    substitutions = {
        "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.",
        "@LLVM_LIT_TOOLS_DIR@": package_path("//llvm/utils/lit:BUILD"),
        "@LLVM_SOURCE_DIR@": package_path("//llvm:BUILD"),
        "@LLVM_BINARY_DIR@": package_path("//llvm:BUILD"),
        "@LLVM_TOOLS_DIR@": package_path("//llvm:BUILD"),
    },
    template = "lit.site.cfg.in",
)

[
    lit_test(
        name = "%s.test" % src,
        srcs = [src],
        args = ["--path %s" % package_path("//llvm:BUILD")],
        data = [
            "check-tested-lit-timeout-ability",
            "lit.cfg",
            "lit.site.cfg",
            "//llvm:FileCheck",
            "//llvm:count",
            "//llvm:not",
        ] + glob(["Inputs/**"]),
    )
    for src in glob(
        ["**/*.py"],
        exclude = [
            "Inputs/**",
            "discovery.py",  # TODO: debug and re-enable
            "max-time.py",
            "selecting.py",
            "shtest-recursive-substitution.py",
            "use-llvm-tool.py",
        ],
    )
]