rules.bzl 992 B

1234567891011121314151617181920212223242526272829
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. """Rules for building fuzz tests."""
  5. def file_test(name, tests, data = [], args = [], **kwargs):
  6. """Generates tests using the file_test base.
  7. There will be one main test using `name` that can be sharded, and includes
  8. all files. Additionally, per-file tests will be generated as
  9. `name.file_path`; these per-file tests will be manual.
  10. Args:
  11. name: The base name of the tests.
  12. tests: The list of test files to use as data, typically a glob.
  13. data: Passed to cc_test.
  14. args: Passed to cc_test.
  15. **kwargs: Passed to cc_test.
  16. """
  17. native.cc_test(
  18. name = name,
  19. data = tests + data,
  20. args = ["--file_tests=" + ",".join([
  21. "$(location {0})".format(x)
  22. for x in tests
  23. ])] + args,
  24. **kwargs
  25. )