Use **kwargs to forward attributes in cc_fuzz_test (#39)
Use **kwargs to forward attributes in cc_fuzz_test
Forward all attributes that cc_fuzz_test can't handle to cc_test by
using keyword arguments **kwargs.
Signed-off-by: tengpeng <tengpeng.li2020@gmail.com>
modified: fuzzing/cc_deps.bzl
diff --git a/fuzzing/cc_deps.bzl b/fuzzing/cc_deps.bzl
index ee9988a..88df3f0 100644
--- a/fuzzing/cc_deps.bzl
+++ b/fuzzing/cc_deps.bzl
@@ -20,25 +20,20 @@
def cc_fuzz_test(
name,
- srcs,
- copts = [],
- linkopts = [],
- deps = [],
- tags = [],
- visibility = None):
- """This macro provide two targets:
+ **kwargs):
+ """Macro for c++ fuzzing test
+
+ This macro provides two targets:
<name>: the executable file built by cc_test.
<name>_run: an executable to launch the fuzz test.
"""
+ # Add fuzz_test tag
+ kwargs.setdefault("tags", []).append("fuzz_test")
+
cc_test(
name = name,
- srcs = srcs,
- copts = ["-fsanitize=fuzzer"] + copts,
- linkopts = ["-fsanitize=fuzzer"] + linkopts,
- deps = deps,
- tags = tags + ["fuzz_test"],
- visibility = visibility,
+ **kwargs
)
fuzzing_launcher(