Automated g4 rollback of changelist 449982178.
*** Reason for rollback ***
We've figured out how to make this work in Envoy.
*** Original change description ***
Automated g4 rollback of changelist 449624054.
*** Reason for rollback ***
This CL breaks Envoy:
ERROR: /usr/local/google/home/rch/.cache/bazel/_bazel_rch/1bcaf4376ad2a122efbb41b7f1024923/external/com_github_google_quiche/BUILD.bazel:239:22: Label '@com_github_google_quiche//:quiche/http2/adapter/mock_http2_visitor.h' is invalid because '@com_github_google_quiche//quiche' is a subpackage; perhaps you meant to put the colon here: '@com_github_google_quiche//quiche:http2/adapter/mock_http2_visi...
***
PiperOrigin-RevId: 450749239
diff --git a/build/test.bzl b/build/test.bzl
new file mode 100644
index 0000000..9beb0ca
--- /dev/null
+++ b/build/test.bzl
@@ -0,0 +1,26 @@
+"""Tools for building QUICHE tests."""
+
+load("@bazel_skylib//lib:paths.bzl", "paths")
+
+def test_suite_from_source_list(name, srcs, **kwargs):
+ """
+ Generates a test target for every individual test source file specified.
+
+ Args:
+ name: the name of the resulting test_suite target.
+ srcs: the list of source files from which the test targets are generated.
+ **kwargs: other arguments that are passed to the cc_test rule directly.s
+ """
+
+ tests = []
+ for sourcefile in srcs:
+ if not sourcefile.endswith("_test.cc"):
+ fail("All source files passed to test_suite_from_source_list() must end with _test.cc")
+ test_name, _ = paths.split_extension(paths.basename(sourcefile))
+ native.cc_test(
+ name = test_name,
+ srcs = [sourcefile],
+ **kwargs
+ )
+ tests.append(test_name)
+ native.test_suite(name = name, tests = tests)