diff --git a/e2e_tests/testdata/BUILD b/e2e_tests/testdata/BUILD index 73f32b58a..0ef9e2f83 100644 --- a/e2e_tests/testdata/BUILD +++ b/e2e_tests/testdata/BUILD @@ -81,12 +81,10 @@ cc_binary( "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/time", "@com_google_fuzztest//fuzztest", + "@com_google_fuzztest//fuzztest:fuzztest_gtest_main", "@com_google_fuzztest//fuzztest:googletest_fixture_adapter", - "@com_google_fuzztest//fuzztest:init_fuzztest", - "@com_google_fuzztest//fuzztest:io", "@com_google_fuzztest//fuzztest:logging", "@com_google_fuzztest//fuzztest:test_protobuf_cc_proto", - "@com_google_googletest//:gtest", "@com_google_protobuf//:protobuf", ], ) @@ -98,7 +96,7 @@ cc_binary( testonly = 1, srcs = ["fuzz_tests_with_invalid_seeds.cc"], deps = [ - "@com_google_fuzztest//fuzztest:fuzztest_core", + "@com_google_fuzztest//fuzztest", "@com_google_fuzztest//fuzztest:fuzztest_gtest_main", ], ) @@ -108,7 +106,7 @@ cc_binary( testonly = 1, srcs = ["dynamically_registered_fuzz_tests.cc"], deps = [ - "@com_google_fuzztest//fuzztest:fuzztest_core", + "@com_google_fuzztest//fuzztest", "@com_google_fuzztest//fuzztest:fuzztest_gtest_main", ], ) @@ -119,7 +117,7 @@ cc_binary( srcs = ["domain_tests.cc"], deps = [ "@com_google_absl//absl/strings:str_format", - "@com_google_fuzztest//fuzztest:fuzztest_core", + "@com_google_fuzztest//fuzztest", "@com_google_fuzztest//fuzztest:fuzztest_gtest_main", ], ) @@ -129,7 +127,7 @@ cc_binary( testonly = 1, srcs = ["unit_test_and_fuzz_tests.cc"], deps = [ - "@com_google_fuzztest//fuzztest:fuzztest_core", + "@com_google_fuzztest//fuzztest", "@com_google_fuzztest//fuzztest:fuzztest_gtest_main", ], ) diff --git a/e2e_tests/testdata/CMakeLists.txt b/e2e_tests/testdata/CMakeLists.txt index 36d28cffd..a880d4a98 100644 --- a/e2e_tests/testdata/CMakeLists.txt +++ b/e2e_tests/testdata/CMakeLists.txt @@ -28,12 +28,13 @@ target_link_libraries( PUBLIC protobuf::libprotobuf test_protobuf + absl::algorithm_container absl::function_ref absl::str_format + absl::strings absl::time fuzztest_googletest_fixture_adapter fuzztest_logging - fuzztest_status ) link_fuzztest(fuzz_tests_for_functional_testing.stripped) set_target_properties( diff --git a/e2e_tests/testdata/domain_tests.cc b/e2e_tests/testdata/domain_tests.cc index 221beed69..fa3e539ba 100644 --- a/e2e_tests/testdata/domain_tests.cc +++ b/e2e_tests/testdata/domain_tests.cc @@ -15,8 +15,8 @@ #include #include "gtest/gtest.h" +#include "./fuzztest/fuzztest.h" #include "absl/strings/str_format.h" -#include "./fuzztest/fuzztest_core.h" namespace { diff --git a/e2e_tests/testdata/dynamically_registered_fuzz_tests.cc b/e2e_tests/testdata/dynamically_registered_fuzz_tests.cc index e86aec681..8d4591d9f 100644 --- a/e2e_tests/testdata/dynamically_registered_fuzz_tests.cc +++ b/e2e_tests/testdata/dynamically_registered_fuzz_tests.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "./fuzztest/fuzztest_core.h" +#include "./fuzztest/fuzztest.h" namespace { diff --git a/e2e_tests/testdata/fuzz_tests_for_functional_testing.cc b/e2e_tests/testdata/fuzz_tests_for_functional_testing.cc index e159bd6f8..4df392934 100644 --- a/e2e_tests/testdata/fuzz_tests_for_functional_testing.cc +++ b/e2e_tests/testdata/fuzz_tests_for_functional_testing.cc @@ -30,7 +30,7 @@ #include #include -#include "gtest/gtest.h" +#include "./fuzztest/fuzztest.h" #include "absl/algorithm/container.h" #include "absl/functional/function_ref.h" #include "absl/strings/match.h" @@ -38,9 +38,6 @@ #include "absl/strings/string_view.h" #include "absl/time/clock.h" #include "absl/time/time.h" -#include "./fuzztest/fuzztest.h" -#include "./fuzztest/init_fuzztest.h" -#include "./fuzztest/internal/io.h" #include "./fuzztest/internal/logging.h" #include "./fuzztest/internal/test_protobuf.pb.h" #include "google/protobuf/descriptor.h" @@ -818,9 +815,3 @@ void SkipInputs(uint32_t input) { FUZZ_TEST(MySuite, SkipInputs).WithSeeds({1}); } // namespace - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - fuzztest::InitFuzzTest(&argc, &argv, fuzztest::internal::Basename(argv[0])); - return RUN_ALL_TESTS(); -} diff --git a/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc b/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc index a75faafca..5302c069e 100644 --- a/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc +++ b/e2e_tests/testdata/fuzz_tests_for_microbenchmarking.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -35,9 +34,9 @@ #include #include +#include "./fuzztest/fuzztest.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#include "./fuzztest/fuzztest.h" #include "./fuzztest/internal/test_protobuf.pb.h" volatile int googlefuzz_force_write; @@ -370,7 +369,7 @@ auto SwitchTest(unsigned int x) { FUZZ_TEST(MySuite, SwitchTest); // Enabled by including absolute distance in the CMP coverage score. -// Path-dependends-on-states could be somehow explored by a fair +// Path-dependent-on-states could be somehow explored by a fair // scoring of the state data. With Absolute distance, this test will be // captured. auto PathDependentState(char a, char b, char c, char d) { diff --git a/e2e_tests/testdata/fuzz_tests_using_googletest.cc b/e2e_tests/testdata/fuzz_tests_using_googletest.cc index 9330a0a17..d2d01cafa 100644 --- a/e2e_tests/testdata/fuzz_tests_using_googletest.cc +++ b/e2e_tests/testdata/fuzz_tests_using_googletest.cc @@ -19,11 +19,10 @@ #include #include -#include #include "gtest/gtest.h" -#include "absl/strings/match.h" #include "./fuzztest/fuzztest.h" +#include "absl/strings/match.h" #include "./fuzztest/googletest_fixture_adapter.h" #include "./fuzztest/internal/test_protobuf.pb.h" diff --git a/e2e_tests/testdata/fuzz_tests_with_invalid_seeds.cc b/e2e_tests/testdata/fuzz_tests_with_invalid_seeds.cc index 37b836e98..2596ea150 100644 --- a/e2e_tests/testdata/fuzz_tests_with_invalid_seeds.cc +++ b/e2e_tests/testdata/fuzz_tests_with_invalid_seeds.cc @@ -14,7 +14,7 @@ // Fuzz test examples to be used by `functional_test` only. -#include "./fuzztest/fuzztest_core.h" +#include "./fuzztest/fuzztest.h" namespace { diff --git a/e2e_tests/testdata/fuzz_tests_with_proto_inputs.cc b/e2e_tests/testdata/fuzz_tests_with_proto_inputs.cc index ede492c19..0227f3ddc 100644 --- a/e2e_tests/testdata/fuzz_tests_with_proto_inputs.cc +++ b/e2e_tests/testdata/fuzz_tests_with_proto_inputs.cc @@ -26,6 +26,7 @@ #include #include "gtest/gtest.h" +#include "./fuzztest/fuzztest.h" #include "absl/algorithm/container.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" @@ -34,7 +35,6 @@ #include "absl/time/clock.h" #include "absl/time/time.h" #include "absl/types/span.h" -#include "./fuzztest/fuzztest.h" #include "./fuzztest/internal/test_protobuf.pb.h" #include "google/protobuf/text_format.h" #include "re2/re2.h" @@ -579,7 +579,7 @@ void MathFunctions(const TestProtobuf& input) { if ( // Basic operations. d[0] < 0 // Negative. - && i[0] > 0 // Postive. + && i[0] > 0 // Positive. && std::fabs(d[0]) == i[0] // |x|. // Remainder and qoutient functions. @@ -1045,7 +1045,7 @@ bool CanSupervise(const Person& person1, const Person& person2) { return false; } -// Determine wether `input` has at least two direct or indirect legal +// Determine whether `input` has at least two direct or indirect legal // supervisor (18 <= supervisor.age <= 80), one of which is local. void HasLegalSupervisors(const Person& input) { if (!NeedsValidSupervisor(input)) return; diff --git a/e2e_tests/testdata/unit_test_and_fuzz_tests.cc b/e2e_tests/testdata/unit_test_and_fuzz_tests.cc index dc5d41cc8..4ae15eb96 100644 --- a/e2e_tests/testdata/unit_test_and_fuzz_tests.cc +++ b/e2e_tests/testdata/unit_test_and_fuzz_tests.cc @@ -13,7 +13,7 @@ // limitations under the License. #include "gtest/gtest.h" -#include "./fuzztest/fuzztest_core.h" +#include "./fuzztest/fuzztest.h" namespace { diff --git a/fuzztest/BUILD b/fuzztest/BUILD index 945b8e965..51441101f 100644 --- a/fuzztest/BUILD +++ b/fuzztest/BUILD @@ -117,6 +117,7 @@ cc_library( ":configuration", ":flag_name", ":googletest_adaptor", + ":io", ":logging", ":registry", ":runtime", diff --git a/fuzztest/CMakeLists.txt b/fuzztest/CMakeLists.txt index e335894f0..b385fd9a5 100644 --- a/fuzztest/CMakeLists.txt +++ b/fuzztest/CMakeLists.txt @@ -83,6 +83,7 @@ fuzztest_cc_library( DEPS fuzztest::configuration fuzztest::googletest_adaptor + fuzztest::io fuzztest::logging fuzztest::registry fuzztest::runtime diff --git a/fuzztest/init_fuzztest.cc b/fuzztest/init_fuzztest.cc index 26850faa0..d7e910de0 100644 --- a/fuzztest/init_fuzztest.cc +++ b/fuzztest/init_fuzztest.cc @@ -32,6 +32,7 @@ #include "./fuzztest/internal/configuration.h" #include "./fuzztest/internal/flag_name.h" #include "./fuzztest/internal/googletest_adaptor.h" +#include "./fuzztest/internal/io.h" #include "./fuzztest/internal/logging.h" #include "./fuzztest/internal/registry.h" #include "./fuzztest/internal/runtime.h" diff --git a/fuzztest/init_fuzztest.h b/fuzztest/init_fuzztest.h index 047c7f998..930667e9e 100644 --- a/fuzztest/init_fuzztest.h +++ b/fuzztest/init_fuzztest.h @@ -3,7 +3,6 @@ #include #include -#include #include namespace fuzztest { @@ -36,6 +35,7 @@ void ParseAbslFlags(int argc, char** argv); // REQUIRES: `main()` has started before calling this function. // REQUIRES: Abseil flags have been inited, either using // ParseAbslFlags or some other means +// void InitFuzzTest(int* argc, char*** argv, std::string_view binary_id = {}); // Returns a list of all registered fuzz test names in the form of