Organize BUILD files. PiperOrigin-RevId: 764542690
diff --git a/.github/workflows/bazel_test.yml b/.github/workflows/bazel_test.yml index a83bee7..62048e0 100644 --- a/.github/workflows/bazel_test.yml +++ b/.github/workflows/bazel_test.yml
@@ -63,7 +63,7 @@ if: matrix.config == 'default' run: | bazel build -c ${{ matrix.compilation_mode }} \ - --copt=-DFUZZTEST_COMPATIBILITY_MODE -- //fuzztest:compatibility_mode + --copt=-DFUZZTEST_COMPATIBILITY_MODE -- //fuzztest/internal:compatibility_mode - name: Run end-to-end tests with --config=fuzztest if: matrix.config == 'fuzztest' run: |
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e34de3..e38c072 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + cmake_minimum_required(VERSION 3.19) project(fuzztest) @@ -36,6 +50,7 @@ include(cmake/BuildDependencies.cmake) include(cmake/FuzzTestHelpers.cmake) +include(cmake/CompatibilityModeLinkLibFuzzer.cmake) include_directories(${re2_SOURCE_DIR}) @@ -48,12 +63,16 @@ include(${protobuf_SOURCE_DIR}/cmake/protobuf-generate.cmake) endif () -add_subdirectory(grammar_codegen) -add_subdirectory(tools) add_subdirectory(common) add_subdirectory(fuzztest) - +add_subdirectory(fuzztest/grammars) +add_subdirectory(fuzztest/internal) +add_subdirectory(fuzztest/internal/domains) +add_subdirectory(grammar_codegen) +add_subdirectory(grammar_codegen/generated_antlr_parser) +add_subdirectory(tools) if (FUZZTEST_BUILD_TESTING) add_subdirectory(domain_tests) add_subdirectory(e2e_tests) + add_subdirectory(e2e_tests/testdata) endif ()
diff --git a/bazel/setup_configs.sh b/bazel/setup_configs.sh index cd86628..f4c40c9 100755 --- a/bazel/setup_configs.sh +++ b/bazel/setup_configs.sh
@@ -68,7 +68,7 @@ # When used in the fuzztest repo itself. if [[ ${REPO_NAME} == "@" ]]; then COMMON_FILTER="//common:" - FUZZTEST_FILTER="//fuzztest:" + FUZZTEST_FILTER="//fuzztest:,//fuzztest/internal:,//fuzztest/internal/domains:" CENTIPEDE_FILTER="//centipede:,-//centipede/.*fuzz_target" else # When used in a client repo. COMMON_FILTER="common/.*"
diff --git a/build_defs/cc_fuzztest_grammar_library.bzl b/build_defs/cc_fuzztest_grammar_library.bzl index 0deafba..8d7e0b8 100644 --- a/build_defs/cc_fuzztest_grammar_library.bzl +++ b/build_defs/cc_fuzztest_grammar_library.bzl
@@ -56,5 +56,5 @@ native.cc_library( name = name, hdrs = [output_file_name], - deps = ["@com_google_fuzztest//fuzztest:domain"], + deps = ["@com_google_fuzztest//fuzztest/internal/domains:in_grammar_impl"], )
diff --git a/centipede/BUILD b/centipede/BUILD index 9f6da75..9c43a21 100644 --- a/centipede/BUILD +++ b/centipede/BUILD
@@ -845,7 +845,7 @@ "@com_google_fuzztest//common:logging", "@com_google_fuzztest//common:remote_file", "@com_google_fuzztest//common:status_macros", - "@com_google_fuzztest//fuzztest:configuration", + "@com_google_fuzztest//fuzztest/internal:configuration", ], ) @@ -878,7 +878,7 @@ "@com_google_fuzztest//common:logging", "@com_google_fuzztest//common:remote_file", "@com_google_fuzztest//common:status_macros", - "@com_google_fuzztest//fuzztest:configuration", + "@com_google_fuzztest//fuzztest/internal:configuration", ], ) @@ -947,7 +947,7 @@ "@abseil-cpp//absl/types:span", "@com_google_fuzztest//common:defs", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:table_of_recent_compares", + "@com_google_fuzztest//fuzztest/internal:table_of_recent_compares", ], ) @@ -1252,7 +1252,7 @@ ":environment", "@abseil-cpp//absl/log:check", "@abseil-cpp//absl/time", - "@com_google_fuzztest//fuzztest:configuration", + "@com_google_fuzztest//fuzztest/internal:configuration", "@googletest//:gtest_main", ], )
diff --git a/cmake/CompatibilityModeLinkLibFuzzer.cmake b/cmake/CompatibilityModeLinkLibFuzzer.cmake new file mode 100644 index 0000000..2b767d0 --- /dev/null +++ b/cmake/CompatibilityModeLinkLibFuzzer.cmake
@@ -0,0 +1,36 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +function(_link_libfuzzer_in_compatibility_mode name) + if (FUZZTEST_COMPATIBILITY_MODE STREQUAL "libfuzzer") + EXECUTE_PROCESS ( + COMMAND bash -c "find \${PATH//:/ } -maxdepth 1 -executable -name 'llvm-config*'" + OUTPUT_VARIABLE LLVM_CONFIG OUTPUT_STRIP_TRAILING_WHITESPACE + ) + EXECUTE_PROCESS( + COMMAND bash -c "find $(${LLVM_CONFIG} --libdir) \ + -name libclang_rt.fuzzer_no_main-x86_64.a" + OUTPUT_VARIABLE FUZZER_NO_MAIN OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT FUZZER_NO_MAIN) + # LLVM_ENABLE_PER_TARGET_RUNTIME_DIR was set to ON when building LLVM. + EXECUTE_PROCESS( + COMMAND bash -c "find / -regex \ + \"$(${LLVM_CONFIG} --libdir).*$(${LLVM_CONFIG} --host-target).*libclang_rt.fuzzer_no_main.a\"" + OUTPUT_VARIABLE FUZZER_NO_MAIN OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() + target_link_libraries(${name} PRIVATE ${FUZZER_NO_MAIN}) + endif () +endfunction() \ No newline at end of file
diff --git a/domain_tests/BUILD b/domain_tests/BUILD index 2756234..a2584b1 100644 --- a/domain_tests/BUILD +++ b/domain_tests/BUILD
@@ -31,8 +31,8 @@ "@abseil-cpp//absl/types:span", "@abseil-cpp//absl/types:variant", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:serialization", - "@com_google_fuzztest//fuzztest:type_support", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:type_support", "@googletest//:gtest_main", ], ) @@ -48,7 +48,7 @@ "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:string_view", "@com_google_fuzztest//fuzztest:domain", - "@com_google_fuzztest//fuzztest:test_protobuf_cc_proto", + "@com_google_fuzztest//fuzztest/internal:test_protobuf_cc_proto", "@googletest//:gtest_main", "@protobuf", ], @@ -64,11 +64,11 @@ "@abseil-cpp//absl/random:bit_gen_ref", "@abseil-cpp//absl/status", "@abseil-cpp//absl/time", - "@com_google_fuzztest//fuzztest:absl_helpers", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:serialization", - "@com_google_fuzztest//fuzztest:test_protobuf_cc_proto", - "@com_google_fuzztest//fuzztest:type_support", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:test_protobuf_cc_proto", + "@com_google_fuzztest//fuzztest/internal:type_support", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", "@googletest//:gtest_main", ], ) @@ -95,7 +95,7 @@ "@abseil-cpp//absl/random", "@abseil-cpp//absl/strings", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:meta", + "@com_google_fuzztest//fuzztest/internal:meta", "@googletest//:gtest_main", ], ) @@ -109,7 +109,7 @@ "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/random", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:table_of_recent_compares", + "@com_google_fuzztest//fuzztest/internal:table_of_recent_compares", "@googletest//:gtest_main", ], ) @@ -126,11 +126,11 @@ "@abseil-cpp//absl/random:bit_gen_ref", "@abseil-cpp//absl/status", "@abseil-cpp//absl/strings", - "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:logging", - "@com_google_fuzztest//fuzztest:meta", - "@com_google_fuzztest//fuzztest:serialization", - "@com_google_fuzztest//fuzztest:test_protobuf_cc_proto", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:meta", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:test_protobuf_cc_proto", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", "@googletest//:gtest", "@protobuf", ], @@ -144,8 +144,8 @@ "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/random", "@com_google_fuzztest//fuzztest:domain", - "@com_google_fuzztest//fuzztest:serialization", "@com_google_fuzztest//fuzztest/grammars:json_grammar", + "@com_google_fuzztest//fuzztest/internal:serialization", "@googletest//:gtest_main", "@nlohmann_json//:json", ], @@ -187,8 +187,8 @@ "@abseil-cpp//absl/strings", "@abseil-cpp//absl/types:span", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:meta", - "@com_google_fuzztest//fuzztest:type_support", + "@com_google_fuzztest//fuzztest/internal:meta", + "@com_google_fuzztest//fuzztest/internal:type_support", "@googletest//:gtest_main", ], ) @@ -204,7 +204,7 @@ "@abseil-cpp//absl/status", "@abseil-cpp//absl/strings", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:serialization", + "@com_google_fuzztest//fuzztest/internal:serialization", "@googletest//:gtest_main", ], ) @@ -253,7 +253,7 @@ "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/random", "@com_google_fuzztest//fuzztest:domain_core", - "@com_google_fuzztest//fuzztest:table_of_recent_compares", + "@com_google_fuzztest//fuzztest/internal:table_of_recent_compares", "@googletest//:gtest_main", ], )
diff --git a/domain_tests/CMakeLists.txt b/domain_tests/CMakeLists.txt index b7875eb..d7f5088 100644 --- a/domain_tests/CMakeLists.txt +++ b/domain_tests/CMakeLists.txt
@@ -52,7 +52,6 @@ absl::random_bit_gen_ref absl::status absl::time - fuzztest::absl_helpers fuzztest::domain_core fuzztest::serialization test_protobuf
diff --git a/domain_tests/arbitrary_domains_test.cc b/domain_tests/arbitrary_domains_test.cc index 1df4489..ce61170 100644 --- a/domain_tests/arbitrary_domains_test.cc +++ b/domain_tests/arbitrary_domains_test.cc
@@ -37,9 +37,6 @@ #include "absl/time/time.h" #include "./fuzztest/domain_core.h" // IWYU pragma: keep #include "./domain_tests/domain_testing.h" -#include "./fuzztest/internal/domains/absl_helpers.h" -#include "./fuzztest/internal/domains/arbitrary_impl.h" -#include "./fuzztest/internal/domains/container_mutation_helpers.h" #include "./fuzztest/internal/domains/domain_base.h" #include "./fuzztest/internal/serialization.h" #include "./fuzztest/internal/test_protobuf.pb.h"
diff --git a/e2e_tests/BUILD b/e2e_tests/BUILD index 71bf36c..9f85b8d 100644 --- a/e2e_tests/BUILD +++ b/e2e_tests/BUILD
@@ -29,8 +29,8 @@ "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:string_view", "@abseil-cpp//absl/time", - "@com_google_fuzztest//fuzztest:flag_name", - "@com_google_fuzztest//fuzztest:subprocess", + "@com_google_fuzztest//fuzztest/internal:flag_name", + "@com_google_fuzztest//fuzztest/internal:subprocess", ], ) @@ -66,13 +66,13 @@ "@abseil-cpp//absl/time", "@com_google_fuzztest//centipede:weak_sancov_stubs", "@com_google_fuzztest//common:temp_dir", - "@com_google_fuzztest//fuzztest:escaping", - "@com_google_fuzztest//fuzztest:io", - "@com_google_fuzztest//fuzztest:logging", - "@com_google_fuzztest//fuzztest:printer", - "@com_google_fuzztest//fuzztest:serialization", - "@com_google_fuzztest//fuzztest:subprocess", - "@com_google_fuzztest//fuzztest:type_support", + "@com_google_fuzztest//fuzztest/internal:escaping", + "@com_google_fuzztest//fuzztest/internal:io", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:printer", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:subprocess", + "@com_google_fuzztest//fuzztest/internal:type_support", "@googletest//:gtest_main", "@re2", ], @@ -91,8 +91,8 @@ "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:str_format", "@abseil-cpp//absl/time", - "@com_google_fuzztest//fuzztest:logging", - "@com_google_fuzztest//fuzztest:subprocess", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:subprocess", "@re2", ], ) @@ -127,10 +127,10 @@ "@abseil-cpp//absl/time", "@com_google_fuzztest//centipede:weak_sancov_stubs", "@com_google_fuzztest//common:temp_dir", - "@com_google_fuzztest//fuzztest:escaping", - "@com_google_fuzztest//fuzztest:io", - "@com_google_fuzztest//fuzztest:logging", - "@com_google_fuzztest//fuzztest:subprocess", + "@com_google_fuzztest//fuzztest/internal:escaping", + "@com_google_fuzztest//fuzztest/internal:io", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:subprocess", "@googletest//:gtest_main", ], )
diff --git a/e2e_tests/CMakeLists.txt b/e2e_tests/CMakeLists.txt index 59dcaa2..75a1eb9 100644 --- a/e2e_tests/CMakeLists.txt +++ b/e2e_tests/CMakeLists.txt
@@ -1,8 +1,6 @@ get_filename_component(PARENT_DIR ../ ABSOLUTE) include_directories(${PARENT_DIR}) -add_subdirectory(testdata) - fuzztest_cc_library( NAME test_binary_util
diff --git a/e2e_tests/testdata/BUILD b/e2e_tests/testdata/BUILD index 2d91193..3c623f3 100644 --- a/e2e_tests/testdata/BUILD +++ b/e2e_tests/testdata/BUILD
@@ -36,7 +36,7 @@ "@abseil-cpp//absl/strings:string_view", "@com_google_fuzztest//fuzztest", "@com_google_fuzztest//fuzztest:fuzztest_gtest_main", - "@com_google_fuzztest//fuzztest:test_protobuf_cc_proto", + "@com_google_fuzztest//fuzztest/internal:test_protobuf_cc_proto", ], ) @@ -55,7 +55,7 @@ "@abseil-cpp//absl/time", "@abseil-cpp//absl/types:span", "@com_google_fuzztest//fuzztest", - "@com_google_fuzztest//fuzztest:test_protobuf_cc_proto", + "@com_google_fuzztest//fuzztest/internal:test_protobuf_cc_proto", "@googletest//:gtest", "@protobuf", "@re2", @@ -103,8 +103,8 @@ "@com_google_fuzztest//fuzztest", "@com_google_fuzztest//fuzztest:fuzztest_gtest_main", "@com_google_fuzztest//fuzztest:googletest_fixture_adapter", - "@com_google_fuzztest//fuzztest:logging", - "@com_google_fuzztest//fuzztest:test_protobuf_cc_proto", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:test_protobuf_cc_proto", "@protobuf", "@re2", ],
diff --git a/fuzztest/BUILD b/fuzztest/BUILD index 933f539..7dc2a14 100644 --- a/fuzztest/BUILD +++ b/fuzztest/BUILD
@@ -15,7 +15,6 @@ # FuzzTest: a coverage-guided fuzzing / property-based testing framework. load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") -load("@rules_proto//proto:defs.bzl", "proto_library") package(default_visibility = ["//visibility:public"]) @@ -76,14 +75,14 @@ "fuzztest_macros.h", ], deps = [ - ":logging", - ":registration", - ":registry", - ":runtime", "@abseil-cpp//absl/status", "@abseil-cpp//absl/status:statusor", "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:string_view", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:registration", + "@com_google_fuzztest//fuzztest/internal:registry", + "@com_google_fuzztest//fuzztest/internal:runtime", ], ) @@ -116,13 +115,6 @@ srcs = ["init_fuzztest.cc"], hdrs = ["init_fuzztest.h"], deps = [ - ":configuration", - ":flag_name", - ":googletest_adaptor", - ":io", - ":logging", - ":registry", - ":runtime", "@abseil-cpp//absl/algorithm:container", "@abseil-cpp//absl/base:no_destructor", "@abseil-cpp//absl/container:flat_hash_set", @@ -132,6 +124,13 @@ "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:str_format", "@abseil-cpp//absl/time", + "@com_google_fuzztest//fuzztest/internal:configuration", + "@com_google_fuzztest//fuzztest/internal:flag_name", + "@com_google_fuzztest//fuzztest/internal:googletest_adaptor", + "@com_google_fuzztest//fuzztest/internal:io", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:registry", + "@com_google_fuzztest//fuzztest/internal:runtime", "@googletest//:gtest", ], alwayslink = True, @@ -156,11 +155,8 @@ testonly = True, srcs = ["llvm_fuzzer_wrapper.cc"], deps = [ - ":domain_core", ":fuzztest", ":fuzztest_macros", - ":io", - ":logging", "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/base:no_destructor", "@abseil-cpp//absl/flags:flag", @@ -168,217 +164,21 @@ "@abseil-cpp//absl/random", "@abseil-cpp//absl/random:bit_gen_ref", "@abseil-cpp//absl/synchronization", + "@com_google_fuzztest//fuzztest/internal:io", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", ], alwayslink = True, ) -################################################################################ -# Internal -################################################################################ - -# TODO(lszekeres): Move these to internal/BUILD. - -cc_library( - name = "absl_helpers", - hdrs = ["internal/domains/absl_helpers.h"], - deps = [ - ":logging", - "@abseil-cpp//absl/time", - ], -) - -cc_library( - name = "any", - hdrs = ["internal/any.h"], - deps = [ - ":logging", - ":meta", - ], -) - -cc_test( - name = "any_test", - srcs = ["internal/any_test.cc"], - deps = [ - ":any", - "@abseil-cpp//absl/strings", - "@googletest//:gtest_main", - ], -) - -cc_library( - name = "centipede_adaptor", - srcs = ["internal/centipede_adaptor.cc"], - hdrs = ["internal/centipede_adaptor.h"], - defines = ["FUZZTEST_USE_CENTIPEDE"], - deps = [ - ":any", - ":configuration", - ":domain_core", - ":escaping", - ":fixture_driver", - ":flag_name", - ":io", - ":logging", - ":runtime", - ":subprocess", - ":table_of_recent_compares", - "@abseil-cpp//absl/algorithm:container", - "@abseil-cpp//absl/base:no_destructor", - "@abseil-cpp//absl/functional:any_invocable", - "@abseil-cpp//absl/log:absl_log", - "@abseil-cpp//absl/memory", - "@abseil-cpp//absl/random", - "@abseil-cpp//absl/random:distributions", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/status:statusor", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/strings:string_view", - "@abseil-cpp//absl/time", - "@abseil-cpp//absl/types:span", - "@com_google_fuzztest//centipede:centipede_callbacks", - "@com_google_fuzztest//centipede:centipede_default_callbacks", - "@com_google_fuzztest//centipede:centipede_interface", - "@com_google_fuzztest//centipede:centipede_runner_no_main", - "@com_google_fuzztest//centipede:environment", - "@com_google_fuzztest//centipede:execution_metadata", - "@com_google_fuzztest//centipede:mutation_input", - "@com_google_fuzztest//centipede:runner_result", - "@com_google_fuzztest//centipede:workdir", - "@com_google_fuzztest//common:defs", - "@com_google_fuzztest//common:remote_file", - "@com_google_fuzztest//common:temp_dir", - ], -) - -cc_library( - name = "compatibility_mode", - srcs = ["internal/compatibility_mode.cc"], - hdrs = ["internal/compatibility_mode.h"], - deps = [ - ":domain_core", - ":fixture_driver", - ":logging", - ":runtime", - "@abseil-cpp//absl/random:distributions", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/time", - ] + select({ - "//conditions:default": [], - }), -) - -cc_library( - name = "configuration", - srcs = ["internal/configuration.cc"], - hdrs = ["internal/configuration.h"], - deps = [ - "@abseil-cpp//absl/log:absl_check", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/status:statusor", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:string_view", - "@abseil-cpp//absl/time", - ], -) - -cc_test( - name = "configuration_test", - srcs = ["internal/configuration_test.cc"], - deps = [ - ":configuration", - "@abseil-cpp//absl/status:statusor", - "@abseil-cpp//absl/time", - "@googletest//:gtest_main", - ], -) - -cc_library( - name = "corpus_database", - srcs = ["internal/corpus_database.cc"], - hdrs = ["internal/corpus_database.h"], - deps = [ - ":configuration", - ":io", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:string_view", - "@abseil-cpp//absl/time", - ], -) - -cc_library( - name = "coverage", - srcs = ["internal/coverage.cc"], - hdrs = ["internal/coverage.h"], - defines = select({ - "@com_google_fuzztest//fuzztest:use_centipede": ["FUZZTEST_USE_CENTIPEDE"], - "//conditions:default": [], - }), - deps = [ - ":domain_core", - ":flag_name", - ":logging", - ":table_of_recent_compares", - "@abseil-cpp//absl/base:core_headers", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/types:span", - ], -) - cc_library( name = "domain", - srcs = [ - "internal/domains/in_grammar_impl.cc", - "internal/domains/in_regexp_impl.cc", - ], - hdrs = [ - "domain.h", - "internal/domains/in_grammar_impl.h", - "internal/domains/in_regexp_impl.h", - "internal/domains/protobuf_domain_impl.h", - ], - # Public for cc_fuzztest_grammar_library rule. - visibility = ["//visibility:public"], + hdrs = ["domain.h"], deps = [ - ":any", ":domain_core", - ":logging", - ":meta", - ":regexp_dfa", - ":serialization", - ":status", - ":type_support", - "@abseil-cpp//absl/base:core_headers", - "@abseil-cpp//absl/base:no_destructor", - "@abseil-cpp//absl/container:flat_hash_map", - "@abseil-cpp//absl/container:flat_hash_set", - "@abseil-cpp//absl/random", - "@abseil-cpp//absl/random:bit_gen_ref", - "@abseil-cpp//absl/random:distributions", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/status:statusor", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/synchronization", - "@abseil-cpp//absl/types:span", - ], -) - -cc_library( - name = "utf", - srcs = [ - "internal/domains/rune.cc", - "internal/domains/rune.h", - "internal/domains/utf.cc", - ], - hdrs = [ - "internal/domains/utf.h", - ], - visibility = ["//visibility:private"], - deps = [ - "@abseil-cpp//absl/strings:string_view", + "@com_google_fuzztest//fuzztest/internal/domains:domains_impl", + "@com_google_fuzztest//fuzztest/internal/domains:in_regexp_impl", + "@com_google_fuzztest//fuzztest/internal/domains:protobuf_domain_impl", ], ) @@ -386,119 +186,29 @@ # by the default Centipede mutation. cc_library( name = "domain_core", - hdrs = [ - "domain_core.h", - "internal/domains/aggregate_of_impl.h", - "internal/domains/arbitrary_impl.h", - "internal/domains/bit_flag_combination_of_impl.h", - "internal/domains/bit_gen_ref.h", - "internal/domains/container_mutation_helpers.h", - "internal/domains/container_of_impl.h", - "internal/domains/domain.h", - "internal/domains/domain_base.h", - "internal/domains/domain_type_erasure.h", - "internal/domains/element_of_impl.h", - "internal/domains/filter_impl.h", - "internal/domains/flat_map_impl.h", - "internal/domains/in_range_impl.h", - "internal/domains/map_impl.h", - "internal/domains/mutation_metadata.h", - "internal/domains/one_of_impl.h", - "internal/domains/optional_of_impl.h", - "internal/domains/overlap_of_impl.h", - "internal/domains/serialization_helpers.h", - "internal/domains/smart_pointer_of_impl.h", - "internal/domains/special_values.h", - "internal/domains/unique_elements_container_of_impl.h", - "internal/domains/value_mutation_helpers.h", - "internal/domains/variant_of_impl.h", - ], - visibility = ["//visibility:public"], + hdrs = ["domain_core.h"], deps = [ - ":absl_helpers", - ":any", - ":fuzzing_bit_gen", - ":logging", - ":meta", - ":printer", - ":serialization", - ":status", - ":table_of_recent_compares", - ":type_support", - ":utf", "@abseil-cpp//absl/container:flat_hash_map", - "@abseil-cpp//absl/container:flat_hash_set", - "@abseil-cpp//absl/functional:function_ref", - "@abseil-cpp//absl/log:absl_check", - "@abseil-cpp//absl/log:absl_log", - "@abseil-cpp//absl/numeric:bits", - "@abseil-cpp//absl/numeric:int128", - "@abseil-cpp//absl/random", "@abseil-cpp//absl/random:bit_gen_ref", - "@abseil-cpp//absl/random:distributions", "@abseil-cpp//absl/status", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/time", + "@abseil-cpp//absl/strings:string_view", "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest/internal:any", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:meta", + "@com_google_fuzztest//fuzztest/internal:printer", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:type_support", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", + "@com_google_fuzztest//fuzztest/internal/domains:utf", ], ) cc_library( - name = "escaping", - srcs = ["internal/escaping.cc"], - hdrs = ["internal/escaping.h"], - deps = [ - "@abseil-cpp//absl/strings", - ], -) - -cc_library( - name = "fixture_driver", - srcs = ["internal/fixture_driver.cc"], - hdrs = ["internal/fixture_driver.h"], - deps = [ - ":any", - ":domain_core", - ":logging", - ":meta", - ":printer", - ":registration", - ":type_support", - "@abseil-cpp//absl/functional:any_invocable", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/types:span", - ], -) - -cc_test( - name = "fixture_driver_test", - size = "small", - srcs = ["internal/fixture_driver_test.cc"], - deps = [ - ":any", - ":domain_core", - ":fixture_driver", - ":logging", - ":registration", - "@abseil-cpp//absl/functional:any_invocable", - "@abseil-cpp//absl/types:span", - "@googletest//:gtest_main", - ], -) - -cc_library( - name = "flag_name", - hdrs = ["internal/flag_name.h"], -) - -cc_library( name = "fuzzing_bit_gen", srcs = ["fuzzing_bit_gen.cc"], hdrs = ["fuzzing_bit_gen.h"], deps = [ - ":register_fuzzing_mocks", "@abseil-cpp//absl/base:fast_type_id", "@abseil-cpp//absl/base:no_destructor", "@abseil-cpp//absl/container:flat_hash_map", @@ -506,365 +216,16 @@ "@abseil-cpp//absl/numeric:int128", "@abseil-cpp//absl/random:bit_gen_ref", "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest/internal:register_fuzzing_mocks", ], ) cc_library( - name = "googletest_adaptor", - testonly = True, - srcs = ["internal/googletest_adaptor.cc"], - hdrs = ["internal/googletest_adaptor.h"], - deps = [ - ":configuration", - ":corpus_database", - ":flag_name", - ":io", - ":registry", - ":runtime", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/strings:string_view", - "@googletest//:gtest", - ] + select({ - "@com_google_fuzztest//fuzztest:use_centipede": [":centipede_adaptor"], - "//conditions:default": [], - }), -) - -cc_library( name = "googletest_fixture_adapter", testonly = True, hdrs = ["googletest_fixture_adapter.h"], deps = [ - ":fixture_driver", + "@com_google_fuzztest//fuzztest/internal:fixture_driver", "@googletest//:gtest", ], ) - -cc_library( - name = "io", - srcs = ["internal/io.cc"], - hdrs = ["internal/io.h"], - deps = [ - ":logging", - "@abseil-cpp//absl/functional:function_ref", - "@abseil-cpp//absl/hash", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/strings:string_view", - "@abseil-cpp//absl/time", - "@abseil-cpp//absl/types:span", - "@com_google_fuzztest//common:blob_file", - "@com_google_fuzztest//common:defs", - "@com_google_fuzztest//common:remote_file", - ] + select({ - "//conditions:default": [], - }), -) - -cc_test( - name = "io_test", - srcs = ["internal/io_test.cc"], - deps = [ - ":fuzztest_core", - ":io", - "@abseil-cpp//absl/log:check", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/time", - "@com_google_fuzztest//common:blob_file", - "@com_google_fuzztest//common:defs", - "@com_google_fuzztest//common:temp_dir", - "@googletest//:gtest_main", - ], -) - -cc_library( - name = "logging", - srcs = ["internal/logging.cc"], - hdrs = ["internal/logging.h"], - deps = [ - "@abseil-cpp//absl/base:core_headers", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/synchronization", - ], -) - -cc_library( - name = "meta", - hdrs = ["internal/meta.h"], - deps = ["@abseil-cpp//absl/numeric:int128"], -) - -cc_library( - name = "printer", - hdrs = ["internal/printer.h"], - deps = [ - ":meta", - "@abseil-cpp//absl/strings:str_format", - ], -) - -cc_library( - name = "regexp_dfa", - srcs = ["internal/domains/regexp_dfa.cc"], - hdrs = ["internal/domains/regexp_dfa.h"], - deps = [ - ":logging", - "@abseil-cpp//absl/container:flat_hash_map", - "@abseil-cpp//absl/random:bit_gen_ref", - "@abseil-cpp//absl/random:distributions", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/status:statusor", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:string_view", - "@re2", - ], -) - -cc_library( - name = "register_fuzzing_mocks", - srcs = ["internal/register_fuzzing_mocks.cc"], - hdrs = ["internal/register_fuzzing_mocks.h"], - deps = [ - "@abseil-cpp//absl/base:fast_type_id", - "@abseil-cpp//absl/functional:function_ref", - "@abseil-cpp//absl/log:absl_check", - "@abseil-cpp//absl/random:distributions", - "@abseil-cpp//absl/types:span", - ], -) - -cc_library( - name = "registration", - hdrs = ["internal/registration.h"], - deps = [ - ":domain_core", - ":meta", - ":printer", - ":type_support", - "@abseil-cpp//absl/functional:any_invocable", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/types:span", - ], -) - -cc_library( - name = "registry", - srcs = ["internal/registry.cc"], - hdrs = ["internal/registry.h"], - deps = [ - ":compatibility_mode", - ":fixture_driver", - ":registration", - ":runtime", - "@abseil-cpp//absl/container:flat_hash_map", - "@abseil-cpp//absl/functional:function_ref", - "@abseil-cpp//absl/strings:string_view", - ] + select({ - "@com_google_fuzztest//fuzztest:use_centipede": [":centipede_adaptor"], - "//conditions:default": [], - }), -) - -cc_library( - name = "runtime", - srcs = ["internal/runtime.cc"], - hdrs = ["internal/runtime.h"], - deps = [ - ":configuration", - ":corpus_database", - ":coverage", - ":domain_core", - ":fixture_driver", - ":flag_name", - ":io", - ":logging", - ":printer", - ":registration", - ":seed_seq", - ":serialization", - ":status", - "@abseil-cpp//absl/base:core_headers", - "@abseil-cpp//absl/functional:any_invocable", - "@abseil-cpp//absl/functional:bind_front", - "@abseil-cpp//absl/functional:function_ref", - "@abseil-cpp//absl/log:absl_check", - "@abseil-cpp//absl/random", - "@abseil-cpp//absl/random:bit_gen_ref", - "@abseil-cpp//absl/random:distributions", - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/status:statusor", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/time", - "@abseil-cpp//absl/types:span", - "@com_google_fuzztest//common:bazel", - ], -) - -cc_test( - name = "runtime_test", - srcs = ["internal/runtime_test.cc"], - deps = [ - ":configuration", - ":domain_core", - ":flag_name", - ":runtime", - ":test_protobuf_cc_proto", - "@abseil-cpp//absl/flags:flag", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/time", - "@googletest//:gtest_main", - ], -) - -cc_library( - name = "seed_seq", - srcs = ["internal/seed_seq.cc"], - hdrs = ["internal/seed_seq.h"], - deps = [ - ":logging", - "@abseil-cpp//absl/random", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/types:span", - ], -) - -cc_test( - name = "seed_seq_test", - srcs = ["internal/seed_seq_test.cc"], - deps = [ - ":seed_seq", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/types:span", - "@googletest//:gtest_main", - ], -) - -cc_library( - name = "serialization", - srcs = ["internal/serialization.cc"], - hdrs = ["internal/serialization.h"], - deps = [ - ":meta", - "@abseil-cpp//absl/numeric:int128", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/types:span", - ], -) - -cc_test( - name = "serialization_test", - srcs = ["internal/serialization_test.cc"], - deps = [ - ":serialization", - ":test_protobuf_cc_proto", - "@googletest//:gtest_main", - "@protobuf", - ], -) - -cc_library( - name = "status", - srcs = ["internal/status.cc"], - hdrs = ["internal/status.h"], - deps = [ - "@abseil-cpp//absl/status", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:cord", - ], -) - -cc_library( - name = "subprocess", - srcs = ["internal/subprocess.cc"], - hdrs = ["internal/subprocess.h"], - deps = [ - ":logging", - "@abseil-cpp//absl/container:flat_hash_map", - "@abseil-cpp//absl/functional:function_ref", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/time", - "@abseil-cpp//absl/types:span", - ], -) - -cc_test( - name = "subprocess_test", - srcs = ["internal/subprocess_test.cc"], - deps = [ - ":subprocess", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/time", - "@googletest//:gtest_main", - ], -) - -cc_library( - name = "table_of_recent_compares", - hdrs = ["internal/table_of_recent_compares.h"], - deps = [ - ":type_support", - "@abseil-cpp//absl/container:flat_hash_set", - "@abseil-cpp//absl/random:bit_gen_ref", - "@abseil-cpp//absl/random:distributions", - ], -) - -cc_test( - name = "table_of_recent_compares_test", - srcs = ["internal/table_of_recent_compares_test.cc"], - deps = [ - ":table_of_recent_compares", - "@abseil-cpp//absl/random", - "@googletest//:gtest_main", - ], -) - -proto_library( - name = "test_protobuf", - srcs = ["internal/test_protobuf.proto"], -) - -cc_proto_library( - name = "test_protobuf_cc_proto", - deps = [":test_protobuf"], -) - -cc_library( - name = "type_support", - srcs = ["internal/type_support.cc"], - hdrs = ["internal/type_support.h"], - deps = [ - ":absl_helpers", - ":meta", - ":printer", - "@abseil-cpp//absl/debugging:symbolize", - "@abseil-cpp//absl/functional:function_ref", - "@abseil-cpp//absl/numeric:int128", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/time", - ], -) - -cc_test( - name = "type_support_test", - srcs = ["internal/type_support_test.cc"], - deps = [ - ":domain", - ":meta", - ":printer", - ":test_protobuf_cc_proto", - ":type_support", - "@abseil-cpp//absl/numeric:int128", - "@abseil-cpp//absl/strings", - "@abseil-cpp//absl/strings:str_format", - "@abseil-cpp//absl/time", - "@googletest//:gtest_main", - "@protobuf", - ], -)
diff --git a/fuzztest/CMakeLists.txt b/fuzztest/CMakeLists.txt index 5de10c0..62a854a 100644 --- a/fuzztest/CMakeLists.txt +++ b/fuzztest/CMakeLists.txt
@@ -1,40 +1,75 @@ -# The DEPS in this file are sorted in the same order as the corresponding -# deps in the BUILD file. This is to make it easier to compare the two files. - -function(_link_libfuzzer_in_compatibility_mode name) - if (FUZZTEST_COMPATIBILITY_MODE STREQUAL "libfuzzer") - EXECUTE_PROCESS ( - COMMAND bash -c "find \${PATH//:/ } -maxdepth 1 -executable -name 'llvm-config*'" - OUTPUT_VARIABLE LLVM_CONFIG OUTPUT_STRIP_TRAILING_WHITESPACE - ) - EXECUTE_PROCESS( - COMMAND bash -c "find $(${LLVM_CONFIG} --libdir) \ - -name libclang_rt.fuzzer_no_main-x86_64.a" - OUTPUT_VARIABLE FUZZER_NO_MAIN OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(NOT FUZZER_NO_MAIN) - # LLVM_ENABLE_PER_TARGET_RUNTIME_DIR was set to ON when building LLVM. - EXECUTE_PROCESS( - COMMAND bash -c "find / -regex \ - \"$(${LLVM_CONFIG} --libdir).*$(${LLVM_CONFIG} --host-target).*libclang_rt.fuzzer_no_main.a\"" - OUTPUT_VARIABLE FUZZER_NO_MAIN OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif() - target_link_libraries(${name} PRIVATE ${FUZZER_NO_MAIN}) - endif () -endfunction() +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. get_filename_component(PARENT_DIR ../ ABSOLUTE) include_directories(${PARENT_DIR}) -add_subdirectory(grammars) - - if (NOT COMPILER_GCC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-coverage=0") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-coverage=0") endif() +fuzztest_cc_library( + NAME + domain + HDRS + "domain.h" + DEPS + fuzztest::domain_core + fuzztest::domains_impl + fuzztest::in_regexp_impl + fuzztest::protobuf_domain_impl +) + +fuzztest_cc_library( + NAME + domain_core + HDRS + "domain_core.h" + DEPS + absl::flat_hash_map + absl::random_bit_gen_ref + absl::status + absl::string_view + absl::span + fuzztest::any + fuzztest::logging + fuzztest::meta + fuzztest::printer + fuzztest::serialization + fuzztest::type_support + fuzztest::core_domains_impl + fuzztest::utf +) + +fuzztest_cc_library( + NAME + fuzzing_bit_gen + HDRS + "fuzzing_bit_gen.h" + SRCS + "fuzzing_bit_gen.cc" + DEPS + absl::fast_type_id + absl::no_destructor + absl::flat_hash_map + absl::bits + absl::int128 + absl::random_bit_gen_ref + absl::span + fuzztest::register_fuzzing_mocks +) fuzztest_cc_library( NAME @@ -58,40 +93,6 @@ fuzztest_cc_library( NAME - fuzztest_macros - HDRS - "fuzztest_macros.h" - SRCS - "fuzztest_macros.cc" - DEPS - fuzztest::logging - fuzztest::registration - fuzztest::registry - fuzztest::runtime - absl::status - absl::statusor - absl::strings - absl::string_view -) - -fuzztest_cc_test( - NAME - fuzztest_macros_test - HDRS - "fuzztest_macros_test.h" - SRCS - "fuzztest_macros_test.cc" - DEPS - fuzztest::fuzztest_macros - GTest::gmock_main - absl::check - absl::status - absl::strings - fuzztest::temp_dir -) - -fuzztest_cc_library( - NAME fuzztest_gtest_main SRCS "fuzztest_gtest_main.cc" @@ -102,379 +103,34 @@ fuzztest_cc_library( NAME - init_fuzztest + fuzztest_macros HDRS - "init_fuzztest.h" + "fuzztest_macros.h" SRCS - "init_fuzztest.cc" + "fuzztest_macros.cc" DEPS - fuzztest::configuration - fuzztest::flag_name - fuzztest::googletest_adaptor - fuzztest::io + absl::status + absl::statusor + absl::strings + absl::string_view fuzztest::logging + fuzztest::registration fuzztest::registry fuzztest::runtime - GTest::gtest - absl::algorithm_container - absl::no_destructor - absl::flat_hash_set - absl::flags - absl::flags_parse - absl::flags_reflection - absl::strings - absl::str_format - absl::time ) -fuzztest_cc_library( +fuzztest_cc_test( NAME - llvm_fuzzer_main + fuzztest_macros_test SRCS - "llvm_fuzzer_main.cc" + "fuzztest_macros_test.cc" DEPS - fuzztest::init_fuzztest - GTest::gtest - absl::flags - absl::flags_parse -) - -fuzztest_cc_library( - NAME - llvm_fuzzer_wrapper - SRCS - "llvm_fuzzer_wrapper.cc" - DEPS - fuzztest::domain_core - fuzztest::fuzztest fuzztest::fuzztest_macros - fuzztest::io - fuzztest::logging - absl::core_headers - absl::no_destructor - absl::flags - absl::absl_check - absl::random_random - absl::random_bit_gen_ref - absl::synchronization -) - -################################################################################ -# Internal -################################################################################ - -# TODO(lszekeres): Move these under internal/CMakeLists.txt - -fuzztest_cc_library( - NAME - absl_helpers - HDRS - "internal/domains/absl_helpers.h" - DEPS - fuzztest::logging - absl::time -) - -fuzztest_cc_library( - NAME - any - HDRS - "internal/any.h" - DEPS - fuzztest::logging - fuzztest::meta -) - -fuzztest_cc_test( - NAME - any_test - SRCS - "internal/any_test.cc" - DEPS - fuzztest::any + absl::check + absl::status + absl::strings + fuzztest::temp_dir GTest::gmock_main - absl::strings -) - -# TODO(lszekeres): centipede_adaptor - -fuzztest_cc_library( - NAME - compatibility_mode - HDRS - "internal/compatibility_mode.h" - SRCS - "internal/compatibility_mode.cc" - DEPS - fuzztest::domain_core - fuzztest::fixture_driver - fuzztest::logging - fuzztest::runtime - absl::random_distributions - absl::strings - absl::str_format - absl::time -) - -_link_libfuzzer_in_compatibility_mode(fuzztest_compatibility_mode) - -fuzztest_cc_library( - NAME - configuration - HDRS - "internal/configuration.h" - SRCS - "internal/configuration.cc" - DEPS - absl::absl_check - absl::status - absl::statusor - absl::strings - absl::string_view - absl::time -) - -fuzztest_cc_test( - NAME - configuration_test - SRCS - "internal/configuration_test.cc" - DEPS - fuzztest::configuration - GTest::gmock_main - absl::statusor - absl::time -) - -fuzztest_cc_library( - NAME - corpus_database - HDRS - "internal/corpus_database.h" - SRCS - "internal/corpus_database.cc" - DEPS - fuzztest::configuration - fuzztest::io - absl::strings - absl::string_view - absl::time -) - -fuzztest_cc_library( - NAME - coverage - HDRS - "internal/coverage.h" - SRCS - "internal/coverage.cc" - DEPS - fuzztest::domain_core - fuzztest::flag_name - fuzztest::logging - fuzztest::table_of_recent_compares - absl::core_headers - absl::str_format - absl::span -) - -fuzztest_cc_library( - NAME - domain - HDRS - "domain.h" - "internal/domains/in_grammar_impl.h" - "internal/domains/in_regexp_impl.h" - "internal/domains/protobuf_domain_impl.h" - SRCS - "internal/domains/in_grammar_impl.cc" - "internal/domains/in_regexp_impl.cc" - DEPS - fuzztest::any - fuzztest::domain_core - fuzztest::logging - fuzztest::meta - fuzztest::regexp_dfa - fuzztest::serialization - fuzztest::status - fuzztest::type_support - absl::core_headers - absl::no_destructor - absl::flat_hash_map - absl::flat_hash_set - absl::random_random - absl::random_bit_gen_ref - absl::random_distributions - absl::status - absl::statusor - absl::strings - absl::str_format - absl::synchronization - absl::span -) - -fuzztest_cc_library( - NAME - utf - HDRS - "internal/domains/utf.h" - SRCS - "internal/domains/rune.cc" - "internal/domains/rune.h" - "internal/domains/utf.cc" - DEPS - absl::string_view -) - -fuzztest_cc_library( - NAME - domain_core - HDRS - "domain_core.h" - "internal/domains/aggregate_of_impl.h" - "internal/domains/arbitrary_impl.h" - "internal/domains/bit_flag_combination_of_impl.h" - "internal/domains/bit_gen_ref.h" - "internal/domains/container_mutation_helpers.h" - "internal/domains/container_of_impl.h" - "internal/domains/domain.h" - "internal/domains/domain_base.h" - "internal/domains/domain_type_erasure.h" - "internal/domains/element_of_impl.h" - "internal/domains/filter_impl.h" - "internal/domains/flat_map_impl.h" - "internal/domains/in_range_impl.h" - "internal/domains/map_impl.h" - "internal/domains/mutation_metadata.h" - "internal/domains/one_of_impl.h" - "internal/domains/optional_of_impl.h" - "internal/domains/overlap_of_impl.h" - "internal/domains/serialization_helpers.h" - "internal/domains/smart_pointer_of_impl.h" - "internal/domains/special_values.h" - "internal/domains/unique_elements_container_of_impl.h" - "internal/domains/value_mutation_helpers.h" - "internal/domains/variant_of_impl.h" - DEPS - fuzztest::absl_helpers - fuzztest::any - fuzztest::fuzzing_bit_gen - fuzztest::logging - fuzztest::meta - fuzztest::printer - fuzztest::serialization - fuzztest::status - fuzztest::table_of_recent_compares - fuzztest::type_support - fuzztest::utf - absl::flat_hash_map - absl::flat_hash_set - absl::function_ref - absl::absl_check - absl::absl_log - absl::bits - absl::int128 - absl::random_random - absl::random_bit_gen_ref - absl::random_distributions - absl::status - absl::strings - absl::str_format - absl::time - absl::span -) - -fuzztest_cc_library( - NAME - escaping - HDRS - "internal/escaping.h" - SRCS - "internal/escaping.cc" - DEPS - absl::strings -) - -fuzztest_cc_library( - NAME - fixture_driver - HDRS - "internal/fixture_driver.h" - SRCS - "internal/fixture_driver.cc" - DEPS - fuzztest::any - fuzztest::domain_core - fuzztest::logging - fuzztest::meta - fuzztest::printer - fuzztest::registration - fuzztest::type_support - absl::any_invocable - absl::status - absl::str_format - absl::span -) - -fuzztest_cc_test( - NAME - fixture_driver_test - SRCS - "internal/fixture_driver_test.cc" - DEPS - fuzztest::any - fuzztest::domain_core - fuzztest::fixture_driver - fuzztest::logging - fuzztest::registration - GTest::gmock_main - absl::any_invocable - absl::span -) - -fuzztest_cc_library( - NAME - flag_name - HDRS - "internal/flag_name.h" -) - -fuzztest_cc_library( - NAME - fuzzing_bit_gen - HDRS - "fuzzing_bit_gen.h" - SRCS - "fuzzing_bit_gen.cc" - DEPS - fuzztest::register_fuzzing_mocks - absl::fast_type_id - absl::no_destructor - absl::flat_hash_map - absl::bits - absl::int128 - absl::random_bit_gen_ref - absl::span -) - -fuzztest_cc_library( - NAME - googletest_adaptor - HDRS - "internal/googletest_adaptor.h" - SRCS - "internal/googletest_adaptor.cc" - DEPS - fuzztest::configuration - fuzztest::corpus_database - fuzztest::flag_name - fuzztest::io - fuzztest::registry - fuzztest::runtime - GTest::gtest - absl::strings - absl::str_format - absl::string_view ) fuzztest_cc_library( @@ -489,385 +145,59 @@ fuzztest_cc_library( NAME - io + init_fuzztest HDRS - "internal/io.h" + "init_fuzztest.h" SRCS - "internal/io.cc" + "init_fuzztest.cc" DEPS - fuzztest::logging - absl::function_ref - absl::hash - absl::status - absl::str_format - absl::string_view - absl::time - absl::span - fuzztest::blob_file - fuzztest::defs - fuzztest::remote_file -) - -fuzztest_cc_test( - NAME - io_test - SRCS - "internal/io_test.cc" - DEPS - fuzztest::fuzztest_core - fuzztest::io - GTest::gmock_main - absl::check - absl::status - absl::strings - absl::time - fuzztest::blob_file - fuzztest::defs - fuzztest::temp_dir -) - -fuzztest_cc_library( - NAME - logging - HDRS - "internal/logging.h" - SRCS - "internal/logging.cc" - DEPS - absl::core_headers - absl::strings - absl::synchronization -) - -fuzztest_cc_library( - NAME - meta - HDRS - "internal/meta.h" - DEPS - absl::int128 -) - -fuzztest_cc_library( - NAME - printer - HDRS - "internal/printer.h" - DEPS - fuzztest::meta - absl::str_format -) - -fuzztest_cc_library( - NAME - regexp_dfa - HDRS - "internal/domains/regexp_dfa.h" - SRCS - "internal/domains/regexp_dfa.cc" - DEPS - fuzztest::logging - absl::flat_hash_map - absl::random_bit_gen_ref - absl::random_distributions - absl::status - absl::statusor - absl::strings - absl::string_view - re2::re2 -) - -fuzztest_cc_library( - NAME - register_fuzzing_mocks - HDRS - "internal/register_fuzzing_mocks.h" - SRCS - "internal/register_fuzzing_mocks.cc" - DEPS - absl::fast_type_id - absl::function_ref - absl::absl_check - absl::random_distributions - absl::span -) - -fuzztest_cc_library( - NAME - registration - HDRS - "internal/registration.h" - DEPS - fuzztest::domain_core - fuzztest::meta - fuzztest::printer - fuzztest::type_support - absl::any_invocable - absl::status - absl::str_format - absl::span -) - -fuzztest_cc_library( - NAME - registry - HDRS - "internal/registry.h" - SRCS - "internal/registry.cc" - DEPS - fuzztest::compatibility_mode - fuzztest::fixture_driver - fuzztest::registration - fuzztest::runtime - absl::flat_hash_map - absl::function_ref - absl::string_view -) - -fuzztest_cc_library( - NAME - runtime - HDRS - "internal/runtime.h" - SRCS - "internal/runtime.cc" - DEPS - fuzztest::configuration - fuzztest::corpus_database - fuzztest::coverage - fuzztest::domain_core - fuzztest::fixture_driver - fuzztest::flag_name - fuzztest::io - fuzztest::logging - fuzztest::printer - fuzztest::registration - fuzztest::seed_seq - fuzztest::serialization - fuzztest::status - absl::core_headers - absl::any_invocable - absl::bind_front - absl::function_ref - absl::absl_check - absl::random_random - absl::random_bit_gen_ref - absl::random_distributions - absl::status - absl::statusor - absl::strings - absl::str_format - absl::time - absl::span - fuzztest::bazel -) - -fuzztest_cc_test( - NAME - runtime_test - SRCS - "internal/runtime_test.cc" - DEPS - fuzztest::configuration - fuzztest::domain_core - fuzztest::flag_name - fuzztest::runtime - test_protobuf - GTest::gmock_main - absl::flags - absl::strings - absl::time -) - -fuzztest_cc_library( - NAME - seed_seq - HDRS - "internal/seed_seq.h" - SRCS - "internal/seed_seq.cc" - DEPS - fuzztest::logging - absl::random_random - absl::strings - absl::span -) - -fuzztest_cc_test( - NAME - seed_seq_test - SRCS - "internal/seed_seq_test.cc" - DEPS - fuzztest::seed_seq - GTest::gmock_main - absl::strings - absl::span -) - -fuzztest_cc_library( - NAME - serialization - HDRS - "internal/serialization.h" - SRCS - "internal/serialization.cc" - DEPS - fuzztest::meta - absl::int128 - absl::strings - absl::str_format - absl::span -) - -fuzztest_cc_test( - NAME - serialization_test - SRCS - "internal/serialization_test.cc" - DEPS - fuzztest::serialization - test_protobuf - GTest::gmock_main - protobuf::libprotobuf -) - -fuzztest_cc_library( - NAME - status - HDRS - "internal/status.h" - SRCS - "internal/status.cc" - DEPS - absl::status - absl::strings - absl::cord -) - -fuzztest_cc_library( - NAME - subprocess - HDRS - "internal/subprocess.h" - SRCS - "internal/subprocess.cc" - DEPS - fuzztest::logging - absl::flat_hash_map - absl::function_ref - absl::span - absl::strings - absl::string_view - absl::time -) - -fuzztest_cc_test( - NAME - subprocess_test - SRCS - "internal/subprocess_test.cc" - DEPS - fuzztest::subprocess - GTest::gmock_main - absl::strings - absl::time -) - -fuzztest_cc_library( - NAME - table_of_recent_compares - HDRS - "internal/table_of_recent_compares.h" - DEPS - fuzztest::type_support + absl::algorithm_container + absl::no_destructor absl::flat_hash_set - absl::random_bit_gen_ref - absl::random_distributions + absl::flags + absl::flags_parse + absl::flags_reflection + absl::strings + absl::str_format + absl::time + fuzztest::configuration + fuzztest::flag_name + fuzztest::googletest_adaptor + fuzztest::io + fuzztest::logging + fuzztest::registry + fuzztest::runtime + GTest::gtest ) -fuzztest_cc_test( - NAME - table_of_recent_compares_test - SRCS - "internal/table_of_recent_compares_test.cc" - DEPS - fuzztest::table_of_recent_compares - GTest::gmock_main - absl::random_random -) - -# TODO(lszekeres): Support fuzztest_cc_proto_library. - -if (FUZZTEST_BUILD_TESTING) - - include_directories(${PROTOBUF_INCLUDE_DIR}) - - add_library( - test_protobuf - OBJECT - "${CMAKE_CURRENT_LIST_DIR}/internal/test_protobuf.proto" - ) - target_link_libraries( - test_protobuf - PUBLIC - protobuf::libprotobuf - ) - - # The output dir of `test_protobuf` might not be created by `protobuf_generate`. - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/internal) - - protobuf_generate( - TARGET - test_protobuf - IMPORT_DIRS - ${CMAKE_CURRENT_LIST_DIR}/internal - PROTOC_OUT_DIR - ${CMAKE_CURRENT_BINARY_DIR}/internal - ) - - target_include_directories( - test_protobuf - PUBLIC - "${CMAKE_CURRENT_BINARY_DIR}/.." - ) - -endif () - fuzztest_cc_library( NAME - type_support - HDRS - "internal/type_support.h" + llvm_fuzzer_main SRCS - "internal/type_support.cc" + "llvm_fuzzer_main.cc" DEPS - fuzztest::absl_helpers - fuzztest::meta - fuzztest::printer - absl::symbolize - absl::function_ref - absl::int128 - absl::strings - absl::str_format - absl::time + fuzztest::init_fuzztest + absl::flags + absl::flags_parse + GTest::gtest ) -fuzztest_cc_test( +fuzztest_cc_library( NAME - type_support_test + llvm_fuzzer_wrapper SRCS - "internal/type_support_test.cc" + "llvm_fuzzer_wrapper.cc" DEPS - fuzztest::domain - fuzztest::meta - fuzztest::printer - test_protobuf - fuzztest::type_support - GTest::gmock_main - absl::int128 - absl::strings - absl::str_format - absl::time + fuzztest::fuzztest + fuzztest::fuzztest_macros + absl::core_headers + absl::no_destructor + absl::flags + absl::absl_check + absl::random_random + absl::random_bit_gen_ref + absl::synchronization + fuzztest::io + fuzztest::logging + fuzztest::core_domains_impl )
diff --git a/fuzztest/internal/BUILD b/fuzztest/internal/BUILD new file mode 100644 index 0000000..1b2fcb7 --- /dev/null +++ b/fuzztest/internal/BUILD
@@ -0,0 +1,540 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@rules_proto//proto:defs.bzl", "proto_library") + +package(default_visibility = ["@com_google_fuzztest//:__subpackages__"]) + +licenses(["notice"]) + +cc_library( + name = "any", + hdrs = ["any.h"], + deps = [ + ":logging", + ":meta", + ], +) + +cc_test( + name = "any_test", + srcs = ["any_test.cc"], + deps = [ + ":any", + "@abseil-cpp//absl/strings", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "centipede_adaptor", + srcs = ["centipede_adaptor.cc"], + hdrs = ["centipede_adaptor.h"], + defines = ["FUZZTEST_USE_CENTIPEDE"], + deps = [ + ":any", + ":configuration", + ":escaping", + ":fixture_driver", + ":flag_name", + ":io", + ":logging", + ":runtime", + ":subprocess", + ":table_of_recent_compares", + "@abseil-cpp//absl/algorithm:container", + "@abseil-cpp//absl/base:no_destructor", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/memory", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/time", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//centipede:centipede_callbacks", + "@com_google_fuzztest//centipede:centipede_default_callbacks", + "@com_google_fuzztest//centipede:centipede_interface", + "@com_google_fuzztest//centipede:centipede_runner_no_main", + "@com_google_fuzztest//centipede:environment", + "@com_google_fuzztest//centipede:execution_metadata", + "@com_google_fuzztest//centipede:mutation_input", + "@com_google_fuzztest//centipede:runner_result", + "@com_google_fuzztest//centipede:workdir", + "@com_google_fuzztest//common:defs", + "@com_google_fuzztest//common:remote_file", + "@com_google_fuzztest//common:temp_dir", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", + ], +) + +cc_library( + name = "compatibility_mode", + srcs = ["compatibility_mode.cc"], + hdrs = ["compatibility_mode.h"], + deps = [ + ":fixture_driver", + ":logging", + ":runtime", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/time", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", + ] + select({ + "//conditions:default": [], + }), +) + +cc_library( + name = "configuration", + srcs = ["configuration.cc"], + hdrs = ["configuration.h"], + deps = [ + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/time", + ], +) + +cc_test( + name = "configuration_test", + srcs = ["configuration_test.cc"], + deps = [ + ":configuration", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/time", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "corpus_database", + srcs = ["corpus_database.cc"], + hdrs = ["corpus_database.h"], + deps = [ + ":configuration", + ":io", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/time", + ], +) + +cc_library( + name = "coverage", + srcs = ["coverage.cc"], + hdrs = ["coverage.h"], + defines = select({ + "@com_google_fuzztest//fuzztest:use_centipede": ["FUZZTEST_USE_CENTIPEDE"], + "//conditions:default": [], + }), + deps = [ + ":flag_name", + ":logging", + ":table_of_recent_compares", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", + ], +) + +cc_library( + name = "escaping", + srcs = ["escaping.cc"], + hdrs = ["escaping.h"], + deps = ["@abseil-cpp//absl/strings"], +) + +cc_library( + name = "fixture_driver", + srcs = ["fixture_driver.cc"], + hdrs = ["fixture_driver.h"], + deps = [ + ":any", + ":logging", + ":meta", + ":printer", + ":registration", + ":type_support", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", + ], +) + +cc_test( + name = "fixture_driver_test", + size = "small", + srcs = ["fixture_driver_test.cc"], + deps = [ + ":any", + ":fixture_driver", + ":logging", + ":registration", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest:domain_core", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "flag_name", + hdrs = ["flag_name.h"], +) + +cc_library( + name = "googletest_adaptor", + testonly = True, + srcs = ["googletest_adaptor.cc"], + hdrs = ["googletest_adaptor.h"], + deps = [ + ":configuration", + ":corpus_database", + ":flag_name", + ":io", + ":registry", + ":runtime", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/strings:string_view", + "@googletest//:gtest", + ] + select({ + "@com_google_fuzztest//fuzztest:use_centipede": [":centipede_adaptor"], + "//conditions:default": [], + }), +) + +cc_library( + name = "io", + srcs = ["io.cc"], + hdrs = ["io.h"], + deps = [ + ":logging", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/hash", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/time", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//common:blob_file", + "@com_google_fuzztest//common:defs", + "@com_google_fuzztest//common:remote_file", + ] + select({ + "//conditions:default": [], + }), +) + +cc_test( + name = "io_test", + srcs = ["io_test.cc"], + deps = [ + ":io", + "@abseil-cpp//absl/log:check", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/time", + "@com_google_fuzztest//common:blob_file", + "@com_google_fuzztest//common:defs", + "@com_google_fuzztest//common:temp_dir", + "@com_google_fuzztest//fuzztest:fuzztest_core", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "logging", + srcs = ["logging.cc"], + hdrs = ["logging.h"], + deps = [ + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/synchronization", + ], +) + +cc_library( + name = "meta", + hdrs = ["meta.h"], + deps = ["@abseil-cpp//absl/numeric:int128"], +) + +cc_library( + name = "printer", + hdrs = ["printer.h"], + deps = [ + ":meta", + "@abseil-cpp//absl/strings:str_format", + ], +) + +cc_library( + name = "register_fuzzing_mocks", + srcs = ["register_fuzzing_mocks.cc"], + hdrs = ["register_fuzzing_mocks.h"], + deps = [ + "@abseil-cpp//absl/base:fast_type_id", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/types:span", + ], +) + +cc_library( + name = "registration", + hdrs = ["registration.h"], + deps = [ + ":meta", + ":printer", + ":type_support", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest:domain_core", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", + ], +) + +cc_library( + name = "registry", + srcs = ["registry.cc"], + hdrs = ["registry.h"], + deps = [ + ":compatibility_mode", + ":fixture_driver", + ":registration", + ":runtime", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/strings:string_view", + ] + select({ + "@com_google_fuzztest//fuzztest:use_centipede": [":centipede_adaptor"], + "//conditions:default": [], + }), +) + +cc_library( + name = "runtime", + srcs = ["runtime.cc"], + hdrs = ["runtime.h"], + deps = [ + ":configuration", + ":corpus_database", + ":coverage", + ":fixture_driver", + ":flag_name", + ":io", + ":logging", + ":printer", + ":registration", + ":seed_seq", + ":serialization", + ":status", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/functional:any_invocable", + "@abseil-cpp//absl/functional:bind_front", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/time", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//common:bazel", + "@com_google_fuzztest//fuzztest/internal/domains:core_domains_impl", + ], +) + +cc_test( + name = "runtime_test", + srcs = ["runtime_test.cc"], + deps = [ + ":configuration", + ":flag_name", + ":runtime", + ":test_protobuf_cc_proto", + "@abseil-cpp//absl/flags:flag", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/time", + "@com_google_fuzztest//fuzztest:domain_core", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "seed_seq", + srcs = ["seed_seq.cc"], + hdrs = ["seed_seq.h"], + deps = [ + ":logging", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:span", + ], +) + +cc_test( + name = "seed_seq_test", + srcs = ["seed_seq_test.cc"], + deps = [ + ":seed_seq", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:span", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "serialization", + srcs = ["serialization.cc"], + hdrs = ["serialization.h"], + deps = [ + ":meta", + "@abseil-cpp//absl/numeric:int128", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/types:span", + ], +) + +cc_test( + name = "serialization_test", + srcs = ["serialization_test.cc"], + deps = [ + ":serialization", + ":test_protobuf_cc_proto", + "@googletest//:gtest_main", + "@protobuf", + ], +) + +cc_library( + name = "status", + srcs = ["status.cc"], + hdrs = ["status.h"], + deps = [ + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:cord", + ], +) + +cc_library( + name = "subprocess", + srcs = ["subprocess.cc"], + hdrs = ["subprocess.h"], + deps = [ + ":logging", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/time", + "@abseil-cpp//absl/types:span", + ], +) + +cc_test( + name = "subprocess_test", + srcs = ["subprocess_test.cc"], + deps = [ + ":subprocess", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/time", + "@googletest//:gtest_main", + ], +) + +cc_library( + name = "table_of_recent_compares", + hdrs = ["table_of_recent_compares.h"], + deps = [ + ":type_support", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/random:distributions", + ], +) + +cc_test( + name = "table_of_recent_compares_test", + srcs = ["table_of_recent_compares_test.cc"], + deps = [ + ":table_of_recent_compares", + "@abseil-cpp//absl/random", + "@googletest//:gtest_main", + ], +) + +proto_library( + name = "test_protobuf", + srcs = ["test_protobuf.proto"], +) + +cc_proto_library( + name = "test_protobuf_cc_proto", + deps = [":test_protobuf"], +) + +cc_library( + name = "type_support", + srcs = ["type_support.cc"], + hdrs = ["type_support.h"], + deps = [ + ":meta", + ":printer", + "@abseil-cpp//absl/debugging:symbolize", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/numeric:int128", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/time", + "@com_google_fuzztest//fuzztest/internal/domains:absl_helpers", + ], +) + +cc_test( + name = "type_support_test", + srcs = ["type_support_test.cc"], + deps = [ + ":meta", + ":printer", + ":test_protobuf_cc_proto", + ":type_support", + "@abseil-cpp//absl/numeric:int128", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/time", + "@com_google_fuzztest//fuzztest:domain", + "@googletest//:gtest_main", + "@protobuf", + ], +)
diff --git a/fuzztest/internal/CMakeLists.txt b/fuzztest/internal/CMakeLists.txt new file mode 100644 index 0000000..57360ff --- /dev/null +++ b/fuzztest/internal/CMakeLists.txt
@@ -0,0 +1,563 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if (NOT COMPILER_GCC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-coverage=0") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-coverage=0") +endif() + +fuzztest_cc_library( + NAME + any + HDRS + "any.h" + DEPS + fuzztest::logging + fuzztest::meta +) + +fuzztest_cc_test( + NAME + any_test + SRCS + "any_test.cc" + DEPS + fuzztest::any + absl::strings + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + compatibility_mode + HDRS + "compatibility_mode.h" + SRCS + "compatibility_mode.cc" + DEPS + fuzztest::fixture_driver + fuzztest::logging + fuzztest::runtime + absl::random_distributions + absl::strings + absl::str_format + absl::time + fuzztest::core_domains_impl +) + +_link_libfuzzer_in_compatibility_mode(fuzztest_compatibility_mode) + +fuzztest_cc_library( + NAME + configuration + HDRS + "configuration.h" + SRCS + "configuration.cc" + DEPS + absl::absl_check + absl::status + absl::statusor + absl::strings + absl::string_view + absl::time +) + +fuzztest_cc_test( + NAME + configuration_test + SRCS + "configuration_test.cc" + DEPS + fuzztest::configuration + absl::statusor + absl::time + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + corpus_database + HDRS + "corpus_database.h" + SRCS + "corpus_database.cc" + DEPS + fuzztest::configuration + fuzztest::io + absl::strings + absl::string_view + absl::time +) + +fuzztest_cc_library( + NAME + coverage + HDRS + "coverage.h" + SRCS + "coverage.cc" + DEPS + fuzztest::flag_name + fuzztest::logging + fuzztest::table_of_recent_compares + absl::core_headers + absl::str_format + absl::span + fuzztest::core_domains_impl +) + +fuzztest_cc_library( + NAME + escaping + HDRS + "escaping.h" + SRCS + "escaping.cc" + DEPS + absl::strings +) + +fuzztest_cc_library( + NAME + fixture_driver + HDRS + "fixture_driver.h" + SRCS + "fixture_driver.cc" + DEPS + fuzztest::any + fuzztest::logging + fuzztest::meta + fuzztest::printer + fuzztest::registration + fuzztest::type_support + absl::any_invocable + absl::status + absl::str_format + absl::span + fuzztest::core_domains_impl +) + +fuzztest_cc_test( + NAME + fixture_driver_test + SRCS + "fixture_driver_test.cc" + DEPS + fuzztest::any + fuzztest::fixture_driver + fuzztest::logging + fuzztest::registration + absl::any_invocable + absl::span + fuzztest::domain_core + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + flag_name + HDRS + "flag_name.h" +) + +fuzztest_cc_library( + NAME + googletest_adaptor + HDRS + "googletest_adaptor.h" + SRCS + "googletest_adaptor.cc" + DEPS + fuzztest::configuration + fuzztest::corpus_database + fuzztest::flag_name + fuzztest::io + fuzztest::registry + fuzztest::runtime + absl::strings + absl::str_format + absl::string_view + GTest::gtest +) + +fuzztest_cc_library( + NAME + io + HDRS + "io.h" + SRCS + "io.cc" + DEPS + fuzztest::logging + absl::function_ref + absl::hash + absl::status + absl::str_format + absl::string_view + absl::time + absl::span + fuzztest::blob_file + fuzztest::defs + fuzztest::remote_file +) + +fuzztest_cc_test( + NAME + io_test + SRCS + "io_test.cc" + DEPS + fuzztest::io + absl::check + absl::status + absl::strings + absl::time + fuzztest::blob_file + fuzztest::defs + fuzztest::temp_dir + fuzztest::fuzztest_core + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + logging + HDRS + "logging.h" + SRCS + "logging.cc" + DEPS + absl::core_headers + absl::strings + absl::synchronization +) + +fuzztest_cc_library( + NAME + meta + HDRS + "meta.h" + DEPS + absl::int128 +) + +fuzztest_cc_library( + NAME + printer + HDRS + "printer.h" + DEPS + fuzztest::meta + absl::str_format +) + +fuzztest_cc_library( + NAME + register_fuzzing_mocks + HDRS + "register_fuzzing_mocks.h" + SRCS + "register_fuzzing_mocks.cc" + DEPS + absl::fast_type_id + absl::function_ref + absl::absl_check + absl::random_distributions + absl::span +) + +fuzztest_cc_library( + NAME + registration + HDRS + "registration.h" + DEPS + fuzztest::meta + fuzztest::printer + fuzztest::type_support + absl::any_invocable + absl::status + absl::str_format + absl::span + fuzztest::domain_core + fuzztest::core_domains_impl +) + +fuzztest_cc_library( + NAME + registry + HDRS + "registry.h" + SRCS + "registry.cc" + DEPS + fuzztest::compatibility_mode + fuzztest::fixture_driver + fuzztest::registration + fuzztest::runtime + absl::flat_hash_map + absl::function_ref + absl::string_view +) + +fuzztest_cc_library( + NAME + runtime + HDRS + "runtime.h" + SRCS + "runtime.cc" + DEPS + fuzztest::configuration + fuzztest::corpus_database + fuzztest::coverage + fuzztest::fixture_driver + fuzztest::flag_name + fuzztest::io + fuzztest::logging + fuzztest::printer + fuzztest::registration + fuzztest::seed_seq + fuzztest::serialization + fuzztest::status + absl::core_headers + absl::any_invocable + absl::bind_front + absl::function_ref + absl::absl_check + absl::random_random + absl::random_bit_gen_ref + absl::random_distributions + absl::status + absl::statusor + absl::strings + absl::str_format + absl::time + absl::span + fuzztest::bazel + fuzztest::core_domains_impl +) + +fuzztest_cc_test( + NAME + runtime_test + SRCS + "runtime_test.cc" + DEPS + fuzztest::configuration + fuzztest::flag_name + fuzztest::runtime + fuzztest::test_protobuf_cc_proto + absl::flags + absl::strings + absl::time + fuzztest::domain_core + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + seed_seq + HDRS + "seed_seq.h" + SRCS + "seed_seq.cc" + DEPS + fuzztest::logging + absl::random_random + absl::strings + absl::span +) + +fuzztest_cc_test( + NAME + seed_seq_test + SRCS + "seed_seq_test.cc" + DEPS + fuzztest::seed_seq + absl::strings + absl::span + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + serialization + HDRS + "serialization.h" + SRCS + "serialization.cc" + DEPS + fuzztest::meta + absl::int128 + absl::strings + absl::str_format + absl::span +) + +fuzztest_cc_test( + NAME + serialization_test + SRCS + "serialization_test.cc" + DEPS + fuzztest::serialization + fuzztest::test_protobuf_cc_proto + GTest::gmock_main + protobuf::libprotobuf +) + +fuzztest_cc_library( + NAME + status + HDRS + "status.h" + SRCS + "status.cc" + DEPS + absl::status + absl::strings + absl::cord +) + +fuzztest_cc_library( + NAME + subprocess + HDRS + "subprocess.h" + SRCS + "subprocess.cc" + DEPS + fuzztest::logging + absl::flat_hash_map + absl::function_ref + absl::span + absl::strings + absl::string_view + absl::time +) + +fuzztest_cc_test( + NAME + subprocess_test + SRCS + "subprocess_test.cc" + DEPS + fuzztest::subprocess + absl::strings + absl::time + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + table_of_recent_compares + HDRS + "table_of_recent_compares.h" + DEPS + fuzztest::type_support + absl::flat_hash_set + absl::random_bit_gen_ref + absl::random_distributions +) + +fuzztest_cc_test( + NAME + table_of_recent_compares_test + SRCS + "table_of_recent_compares_test.cc" + DEPS + fuzztest::table_of_recent_compares + absl::random_random + GTest::gmock_main +) + +fuzztest_cc_library( + NAME + type_support + HDRS + "type_support.h" + SRCS + "type_support.cc" + DEPS + fuzztest::meta + fuzztest::printer + absl::symbolize + absl::function_ref + absl::int128 + absl::strings + absl::str_format + absl::time + fuzztest::absl_helpers +) + +fuzztest_cc_test( + NAME + type_support_test + SRCS + "type_support_test.cc" + DEPS + fuzztest::meta + fuzztest::printer + fuzztest::test_protobuf_cc_proto + fuzztest::type_support + absl::int128 + absl::strings + absl::str_format + absl::time + fuzztest::domain + GTest::gmock_main + protobuf::libprotobuf +) + +if (FUZZTEST_BUILD_TESTING) + + include_directories(${PROTOBUF_INCLUDE_DIR}) + + add_library( + test_protobuf + OBJECT + "${CMAKE_CURRENT_LIST_DIR}/test_protobuf.proto" + ) + + target_link_libraries( + test_protobuf + PUBLIC + protobuf::libprotobuf + ) + + # The output dir might not be created by `protobuf_generate`. + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + protobuf_generate( + TARGET + test_protobuf + IMPORT_DIRS + ${CMAKE_CURRENT_LIST_DIR} + PROTOC_OUT_DIR + ${CMAKE_CURRENT_BINARY_DIR} + ) + + target_include_directories( + test_protobuf + PUBLIC + "${CMAKE_CURRENT_BINARY_DIR}/../.." + ) + + add_library(fuzztest::test_protobuf_cc_proto ALIAS test_protobuf) + +endif ()
diff --git a/fuzztest/internal/domains/BUILD b/fuzztest/internal/domains/BUILD new file mode 100644 index 0000000..5a1d738 --- /dev/null +++ b/fuzztest/internal/domains/BUILD
@@ -0,0 +1,216 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +package(default_visibility = ["@com_google_fuzztest//:__subpackages__"]) + +licenses(["notice"]) + +cc_library( + name = "absl_helpers", + hdrs = ["absl_helpers.h"], + deps = [ + "@abseil-cpp//absl/time", + "@com_google_fuzztest//fuzztest/internal:logging", + ], +) + +cc_library( + name = "core_domains_impl", + hdrs = [ + "aggregate_of_impl.h", + "arbitrary_impl.h", + "bit_flag_combination_of_impl.h", + "bit_gen_ref.h", + "container_mutation_helpers.h", + "container_of_impl.h", + "domain.h", + "domain_base.h", + "domain_type_erasure.h", + "element_of_impl.h", + "filter_impl.h", + "flat_map_impl.h", + "in_range_impl.h", + "map_impl.h", + "mutation_metadata.h", + "one_of_impl.h", + "optional_of_impl.h", + "overlap_of_impl.h", + "serialization_helpers.h", + "smart_pointer_of_impl.h", + "special_values.h", + "unique_elements_container_of_impl.h", + "value_mutation_helpers.h", + "variant_of_impl.h", + ], + deps = [ + ":absl_helpers", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/log:absl_log", + "@abseil-cpp//absl/numeric:bits", + "@abseil-cpp//absl/numeric:int128", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/time", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest:fuzzing_bit_gen", + "@com_google_fuzztest//fuzztest/internal:any", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:meta", + "@com_google_fuzztest//fuzztest/internal:printer", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:status", + "@com_google_fuzztest//fuzztest/internal:table_of_recent_compares", + "@com_google_fuzztest//fuzztest/internal:type_support", + ], +) + +cc_library( + name = "domains_impl", + hdrs = [ + "domain_base.h", + "domain_type_erasure.h", + ], + deps = [ + ":core_domains_impl", + ":in_grammar_impl", + ":in_regexp_impl", + ":protobuf_domain_impl", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:no_destructor", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/functional:function_ref", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest:domain_core", + "@com_google_fuzztest//fuzztest/internal:any", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:meta", + "@com_google_fuzztest//fuzztest/internal:printer", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:status", + "@com_google_fuzztest//fuzztest/internal:type_support", + ], +) + +cc_library( + name = "in_grammar_impl", + srcs = ["in_grammar_impl.cc"], + hdrs = ["in_grammar_impl.h"], + # Public for users of the `cc_fuzztest_grammar_library`. + visibility = ["//visibility:public"], + deps = [ + ":core_domains_impl", + ":in_regexp_impl", + ":regexp_dfa", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:meta", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:type_support", + ], +) + +cc_library( + name = "in_regexp_impl", + srcs = ["in_regexp_impl.cc"], + hdrs = ["in_regexp_impl.h"], + deps = [ + ":core_domains_impl", + ":regexp_dfa", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:status", + "@com_google_fuzztest//fuzztest/internal:type_support", + ], +) + +cc_library( + name = "protobuf_domain_impl", + hdrs = ["protobuf_domain_impl.h"], + deps = [ + ":core_domains_impl", + "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/base:no_destructor", + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/container:flat_hash_set", + "@abseil-cpp//absl/random", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/strings:str_format", + "@abseil-cpp//absl/strings:string_view", + "@abseil-cpp//absl/synchronization", + "@abseil-cpp//absl/types:span", + "@com_google_fuzztest//fuzztest:domain_core", + "@com_google_fuzztest//fuzztest/internal:any", + "@com_google_fuzztest//fuzztest/internal:logging", + "@com_google_fuzztest//fuzztest/internal:meta", + "@com_google_fuzztest//fuzztest/internal:serialization", + "@com_google_fuzztest//fuzztest/internal:status", + "@com_google_fuzztest//fuzztest/internal:type_support", + ], +) + +cc_library( + name = "regexp_dfa", + srcs = ["regexp_dfa.cc"], + hdrs = ["regexp_dfa.h"], + deps = [ + "@abseil-cpp//absl/container:flat_hash_map", + "@abseil-cpp//absl/random:bit_gen_ref", + "@abseil-cpp//absl/random:distributions", + "@abseil-cpp//absl/status", + "@abseil-cpp//absl/status:statusor", + "@abseil-cpp//absl/strings", + "@abseil-cpp//absl/strings:string_view", + "@com_google_fuzztest//fuzztest/internal:logging", + "@re2", + ], +) + +cc_library( + name = "utf", + srcs = [ + "rune.cc", + "rune.h", + "utf.cc", + ], + hdrs = ["utf.h"], + deps = ["@abseil-cpp//absl/strings:string_view"], +)
diff --git a/fuzztest/internal/domains/CMakeLists.txt b/fuzztest/internal/domains/CMakeLists.txt new file mode 100644 index 0000000..f75ee12 --- /dev/null +++ b/fuzztest/internal/domains/CMakeLists.txt
@@ -0,0 +1,223 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if (NOT COMPILER_GCC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-coverage=0") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-coverage=0") +endif() + +fuzztest_cc_library( + NAME + absl_helpers + HDRS + "absl_helpers.h" + DEPS + absl::time + fuzztest::logging +) + +fuzztest_cc_library( + NAME + core_domains_impl + HDRS + "aggregate_of_impl.h" + "arbitrary_impl.h" + "bit_flag_combination_of_impl.h" + "bit_gen_ref.h" + "container_mutation_helpers.h" + "container_of_impl.h" + "domain.h" + "domain_base.h" + "domain_type_erasure.h" + "element_of_impl.h" + "filter_impl.h" + "flat_map_impl.h" + "in_range_impl.h" + "map_impl.h" + "mutation_metadata.h" + "one_of_impl.h" + "optional_of_impl.h" + "overlap_of_impl.h" + "serialization_helpers.h" + "smart_pointer_of_impl.h" + "special_values.h" + "unique_elements_container_of_impl.h" + "value_mutation_helpers.h" + "variant_of_impl.h" + DEPS + fuzztest::absl_helpers + absl::flat_hash_set + absl::function_ref + absl::absl_check + absl::absl_log + absl::bits + absl::int128 + absl::random_random + absl::random_bit_gen_ref + absl::random_distributions + absl::status + absl::strings + absl::str_format + absl::time + absl::span + fuzztest::fuzzing_bit_gen + fuzztest::any + fuzztest::logging + fuzztest::meta + fuzztest::printer + fuzztest::serialization + fuzztest::status + fuzztest::table_of_recent_compares + fuzztest::type_support +) + +fuzztest_cc_library( + NAME + domains_impl + HDRS + "domain_base.h" + "domain_type_erasure.h" + DEPS + fuzztest::core_domains_impl + fuzztest::in_grammar_impl + fuzztest::in_regexp_impl + fuzztest::protobuf_domain_impl + absl::core_headers + absl::no_destructor + absl::flat_hash_map + absl::flat_hash_set + absl::function_ref + absl::random_random + absl::random_bit_gen_ref + absl::random_distributions + absl::status + absl::statusor + absl::strings + absl::str_format + absl::synchronization + absl::span + fuzztest::domain_core + fuzztest::any + fuzztest::logging + fuzztest::meta + fuzztest::printer + fuzztest::serialization + fuzztest::status + fuzztest::type_support +) + +fuzztest_cc_library( + NAME + in_grammar_impl + HDRS + "in_grammar_impl.h" + SRCS + "in_grammar_impl.cc" + DEPS + fuzztest::core_domains_impl + fuzztest::in_regexp_impl + fuzztest::regexp_dfa + absl::flat_hash_map + absl::random_bit_gen_ref + absl::random_distributions + absl::status + absl::strings + absl::string_view + absl::span + fuzztest::logging + fuzztest::meta + fuzztest::serialization + fuzztest::type_support +) + +fuzztest_cc_library( + NAME + in_regexp_impl + HDRS + "in_regexp_impl.h" + SRCS + "in_regexp_impl.cc" + DEPS + fuzztest::core_domains_impl + fuzztest::regexp_dfa + absl::random_bit_gen_ref + absl::random_distributions + absl::status + absl::statusor + absl::strings + absl::span + fuzztest::logging + fuzztest::serialization + fuzztest::status + fuzztest::type_support +) + +fuzztest_cc_library( + NAME + protobuf_domain_impl + HDRS + "protobuf_domain_impl.h" + DEPS + fuzztest::core_domains_impl + absl::core_headers + absl::no_destructor + absl::flat_hash_map + absl::flat_hash_set + absl::random_random + absl::random_bit_gen_ref + absl::status + absl::str_format + absl::string_view + absl::synchronization + absl::span + fuzztest::domain_core + fuzztest::any + fuzztest::logging + fuzztest::meta + fuzztest::serialization + fuzztest::status + fuzztest::type_support +) + +fuzztest_cc_library( + NAME + regexp_dfa + HDRS + "regexp_dfa.h" + SRCS + "regexp_dfa.cc" + DEPS + absl::flat_hash_map + absl::random_bit_gen_ref + absl::random_distributions + absl::status + absl::statusor + absl::strings + absl::string_view + fuzztest::logging + re2::re2 +) + +fuzztest_cc_library( + NAME + utf + HDRS + "utf.h" + SRCS + "rune.cc" + "rune.h" + "utf.cc" + DEPS + absl::string_view +)
diff --git a/grammar_codegen/BUILD b/grammar_codegen/BUILD index 32009d4..8b6b140 100644 --- a/grammar_codegen/BUILD +++ b/grammar_codegen/BUILD
@@ -31,7 +31,7 @@ ":grammar_info", "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:str_format", - "@com_google_fuzztest//fuzztest:logging", + "@com_google_fuzztest//fuzztest/internal:logging", "@com_google_fuzztest//grammar_codegen/generated_antlr_parser", ], ) @@ -46,7 +46,7 @@ "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/strings", "@abseil-cpp//absl/strings:str_format", - "@com_google_fuzztest//fuzztest:logging", + "@com_google_fuzztest//fuzztest/internal:logging", ], )
diff --git a/grammar_codegen/CMakeLists.txt b/grammar_codegen/CMakeLists.txt index 2337fcb..bf430bb 100644 --- a/grammar_codegen/CMakeLists.txt +++ b/grammar_codegen/CMakeLists.txt
@@ -1,8 +1,6 @@ get_filename_component(PARENT_DIR ../ ABSOLUTE) include_directories(${PARENT_DIR}) -add_subdirectory(generated_antlr_parser) - add_library( grammar_info INTERFACE
diff --git a/tools/BUILD b/tools/BUILD index ca2226b..4587e7a 100644 --- a/tools/BUILD +++ b/tools/BUILD
@@ -29,7 +29,7 @@ deps = [ "@abseil-cpp//absl/flags:flag", "@abseil-cpp//absl/flags:parse", - "@com_google_fuzztest//fuzztest:logging", + "@com_google_fuzztest//fuzztest/internal:logging", "@com_google_fuzztest//grammar_codegen:code_generation", ], )