No public description PiperOrigin-RevId: 978031484
diff --git a/.github/workflows/bazel_test.yml b/.github/workflows/bazel_test.yml index 3a09c85..f328db5 100644 --- a/.github/workflows/bazel_test.yml +++ b/.github/workflows/bazel_test.yml
@@ -95,16 +95,15 @@ if: matrix.config == 'fuzztest' run: | bazel test --build_tests_only --test_output=errors \ - -c opt --config=fuzztest //e2e_tests:all + -c opt --config=fuzztest-legacy //e2e_tests:all - name: Run end-to-end tests with --config=fuzztest-experimental if: matrix.config == 'fuzztest-experimental' - # TODO: Add other e2e tests and resolve any issues. run: | bazel test --build_tests_only --test_output=errors \ -c opt \ - --config=fuzztest-experimental --config=asan \ + --config=fuzztest \ --platform_suffix=fuzztest-experimental-asan \ - //e2e_tests:corpus_database_test + //e2e_tests:all - name: Run end-to-end tests with --config=libfuzzer if: matrix.config == 'libfuzzer' run: |
diff --git a/bazel/setup_configs.sh b/bazel/setup_configs.sh index 8a6524b..8a68aad 100755 --- a/bazel/setup_configs.sh +++ b/bazel/setup_configs.sh
@@ -52,15 +52,27 @@ cat <<EOF ### FuzzTest build configuration. # -# Use with: --config=fuzztest -# -# Note that this configuration includes the ASan configuration. +# Use with: --config=fuzztest (with asan) +# or --config=fuzztest-nosan (without asan) -build:fuzztest --config=asan -build:fuzztest --config=fuzztest-common +build:fuzztest-nosan --config=fuzztest-common +build:fuzztest-nosan --@com_google_fuzztest//fuzztest:centipede_integration + +# Generate line tables for debugging. +build:fuzztest-nosan --copt=-gline-tables-only +build:fuzztest-nosan --strip=never + +# Prevent memcmp & co from being inlined. +build:fuzztest-nosan --copt=-fno-builtin + +# Disable heap checking. +build:fuzztest-nosan --copt=-DHEAPCHECK_DISABLE # Link statically. -build:fuzztest --dynamic_mode=off +build:fuzztest-nosan --dynamic_mode=off + +build:fuzztest --config=fuzztest-nosan +build:fuzztest --config=asan EOF @@ -79,43 +91,31 @@ cat <<EOF # We apply coverage tracking instrumentation to everything but Centipede and the # FuzzTest framework itself (including GoogleTest and GoogleMock). -build:fuzztest --copt=-fsanitize-coverage=inline-8bit-counters,trace-cmp,pc-table +# TODO(b/374840534): Add -fsanitize-coverage=control-flow once we start building +# with clang 16+. +build:fuzztest --copt=-fsanitize-coverage=trace-pc-guard,pc-table,trace-loads,trace-cmp build:fuzztest --per_file_copt=${COMMON_FILTER},${FUZZTEST_FILTER},${CENTIPEDE_FILTER},googletest/.*,googlemock/.*@-fsanitize-coverage=0 EOF cat <<EOF -### Experimental FuzzTest build configuration. +### Legacy FuzzTest build configuration. # -# Use with: --config=fuzztest-experimental +# Use with: --config=fuzztest-legacy # # Use this instead of --config=fuzztest when building test binaries to run with -# Centipede. Eventually, this will be consolidated with --config=fuzztest. -# Note that this configuration doesn't include the ASan configuration. If you -# want to use both, you can use --config=fuzztest-experimental --config=asan. +# the legacy fuzz engine. -build:fuzztest-experimental --config=fuzztest-common -build:fuzztest-experimental --@com_google_fuzztest//fuzztest:centipede_integration - -# Generate line tables for debugging. -build:fuzztest-experimental --copt=-gline-tables-only -build:fuzztest-experimental --strip=never - -# Prevent memcmp & co from being inlined. -build:fuzztest-experimental --copt=-fno-builtin - -# Disable heap checking. -build:fuzztest-experimental --copt=-DHEAPCHECK_DISABLE +build:fuzztest-legacy --config=asan +build:fuzztest-legacy --config=fuzztest-common # Link statically. -build:fuzztest-experimental --dynamic_mode=off +build:fuzztest-legacy --dynamic_mode=off # We apply coverage tracking instrumentation to everything but Centipede and the # FuzzTest framework itself (including GoogleTest and GoogleMock). -# TODO(b/374840534): Add -fsanitize-coverage=control-flow once we start building -# with clang 16+. -build:fuzztest-experimental --copt=-fsanitize-coverage=trace-pc-guard,pc-table,trace-loads,trace-cmp -build:fuzztest-experimental --per_file_copt=${COMMON_FILTER},${FUZZTEST_FILTER},${CENTIPEDE_FILTER},googletest/.*,googlemock/.*@-fsanitize-coverage=0 +build:fuzztest-legacy --copt=-fsanitize-coverage=inline-8bit-counters,trace-cmp,pc-table +build:fuzztest-legacy --per_file_copt=${COMMON_FILTER},${FUZZTEST_FILTER},${CENTIPEDE_FILTER},googletest/.*,googlemock/.*@-fsanitize-coverage=0 EOF
diff --git a/e2e_tests/functional_test.cc b/e2e_tests/functional_test.cc index 64ecd26..943eb72 100644 --- a/e2e_tests/functional_test.cc +++ b/e2e_tests/functional_test.cc
@@ -741,6 +741,7 @@ const absl::flat_hash_map<std::string, std::string>& non_fuzztest_flags = {}) { flags["print_subprocess_log"] = "true"; + (void)flags.try_emplace("corpus_database", ""); return RunBinary(BinaryPath(binary), RunOptions{/*flags=*/non_fuzztest_flags, /*fuzztest_flags=*/flags, @@ -1422,7 +1423,8 @@ case ExecutionModelParam::kTestBinary: { RunOptions run_options; run_options.fuzztest_flags = {{"fuzz", std::string(test_name)}, - {"print_subprocess_log", "true"}}; + {"print_subprocess_log", "true"}, + {"corpus_database", ""}}; run_options.env = { {"FUZZTEST_MAX_FUZZING_RUNS", absl::StrCat(iterations)}}; run_options.timeout = absl::InfiniteDuration(); @@ -1432,6 +1434,7 @@ RunOptions run_options; run_options.fuzztest_flags = { {"fuzz", std::string(test_name)}, + {"corpus_database", ""}, {"print_subprocess_log", "true"}, {"internal_centipede_command", ShellEscape(CentipedePath())}}; run_options.env = { @@ -1449,7 +1452,8 @@ {"populate_binary_info", "false"}, {"workdir", workdir.path()}, {"binary", absl::StrCat(BinaryPath(kDefaultTargetBinary), " ", - CreateFuzzTestFlag("fuzz", test_name))}, + CreateFuzzTestFlag("fuzz", test_name), " ", + CreateFuzzTestFlag("corpus_database", ""))}, {"num_runs", absl::StrCat(iterations)}}; run_options.timeout = absl::InfiniteDuration(); return RunBinary(CentipedePath(), run_options); @@ -1601,14 +1605,16 @@ {"stop_at", absl::StrCat(absl::Now() + timeout)}, {"workdir", workdir.path()}, {"binary", absl::StrCat(BinaryPath(target_binary), " ", - CreateFuzzTestFlag("fuzz", test_name))}}; + CreateFuzzTestFlag("fuzz", test_name), " ", + CreateFuzzTestFlag("corpus_database", ""))}}; run_options.env = std::move(env); run_options.timeout = timeout + absl::Seconds(10); return RunBinary(CentipedePath(), run_options); } RunOptions run_options; run_options.fuzztest_flags = {{"fuzz", std::string(test_name)}, - {"fuzz_for", absl::StrCat(timeout)}}; + {"fuzz_for", absl::StrCat(timeout)}, + {"corpus_database", ""}}; run_options.env = std::move(env); run_options.timeout = timeout + absl::Seconds(10); if (GetParam() == ExecutionModelParam::kTestBinaryInvokingCentipedeBinary) {
diff --git a/e2e_tests/test_binary_util.cc b/e2e_tests/test_binary_util.cc index f20885c..4e0e095 100644 --- a/e2e_tests/test_binary_util.cc +++ b/e2e_tests/test_binary_util.cc
@@ -48,8 +48,7 @@ std::string CreateFuzzTestFlag(absl::string_view flag_name, absl::string_view flag_value) { - return absl::StrCat("--", FUZZTEST_FLAG_PREFIX, flag_name, - (flag_value.empty() ? "" : "="), flag_value); + return absl::StrCat("--", FUZZTEST_FLAG_PREFIX, flag_name, "=", flag_value); } std::string BinaryPath(const absl::string_view relative_path) {