Files
carbon-lang/testing/file_test/rules.bzl
T
Jon Ross-Perkins 3f24aa28b7 Introduce flag handling into file_test. (#3030)
I'm integrating absl flag support with a few thoughts here...

1. It simplifies the handling of files in file_test.
    - Removes the need for a separate subset target.
3. Looking forward, I'm planning to add a flag to allow for autoupdate
of golden files.
4. In explorer, there's been confusion about having file_test run tests
"twice" so hopefully it's clearer when it's a separate target with a
different flag on the target.
2023-07-27 23:36:21 +00:00

30 lines
992 B
Python

# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Rules for building fuzz tests."""
def file_test(name, tests, data = [], args = [], **kwargs):
"""Generates tests using the file_test base.
There will be one main test using `name` that can be sharded, and includes
all files. Additionally, per-file tests will be generated as
`name.file_path`; these per-file tests will be manual.
Args:
name: The base name of the tests.
tests: The list of test files to use as data, typically a glob.
data: Passed to cc_test.
args: Passed to cc_test.
**kwargs: Passed to cc_test.
"""
native.cc_test(
name = name,
data = tests + data,
args = ["--file_tests=" + ",".join([
"$(location {0})".format(x)
for x in tests
])] + args,
**kwargs
)