Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add fuzz test targets to ci #7949

Merged
merged 8 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ The `./ci/run_envoy_docker.sh './ci/do_ci.sh <TARGET>'` targets are:
* `bazel.coverity` &mdash; build Envoy static binary and run Coverity Scan static analysis.
* `bazel.tsan` &mdash; build and run tests under `-c dbg --config=clang-tsan` with clang.
* `bazel.tsan <test>` &mdash; build and run a specified test or test dir under `-c dbg --config=clang-tsan` with clang.
* `bazel.fuzz` &mdash; build and run fuzz tests under `-c dbg --config=asan-fuzzer` with clang.
* `bazel.fuzz <test>` &mdash; build and run a specified fuzz test or test dir under `-c dbg --config=asan-fuzzer` with clang.
* `bazel.compile_time_options` &mdash; build Envoy and run tests with various compile-time options toggled to their non-default state, to ensure they still build.
* `bazel.compile_time_options <test>` &mdash; build Envoy and run a specified test or test dir with various compile-time options toggled to their non-default state, to ensure they still build.
* `bazel.clang_tidy` &mdash; build and run clang-tidy over all source files.
Expand Down
15 changes: 15 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,20 @@ CI_TARGET=$1

if [[ $# -gt 1 ]]; then
shift
# If this is a fuzz test, add _with_libfuzzer
if [[ "$CI_TARGET" == "bazel.fuzz" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this two ifs here? Move them to below in elif [[ "$CI_TARGET" == "bazel.fuzz" ]]; then and ingest from $TEST_TARGETS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ingested from $TEST_TARGET, the only awkward thing about it is that the user has to specify the "_with_libfuzzer" name for this to work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's fine, at least wildcards like //test/server/... works, (which didn't work with previous one), it is hard to make this perfect anyway.

FUZZ_TEST_TARGETS=$*"_with_libfuzzer"
fi
TEST_TARGETS=$*
else
TEST_TARGETS=//test/...
if [[ "$CI_TARGET" == "bazel.fuzz" ]]; then
htuch marked this conversation as resolved.
Show resolved Hide resolved
FUZZER_TARGETS_CC=$(find . -name *_fuzz_test.cc)
FUZZ_TEST_TARGETS="$(for t in ${FUZZER_TARGETS_CC}; do echo "${t:2:-3}_with_libfuzzer"; done;)"
fi
fi


if [[ "$CI_TARGET" == "bazel.release" ]]; then
# When testing memory consumption, we want to test against exact byte-counts
# where possible. As these differ between platforms and compile options, we
Expand Down Expand Up @@ -252,6 +261,12 @@ elif [[ "$CI_TARGET" == "bazel.coverity" ]]; then
"${ENVOY_BUILD_DIR}"/envoy-coverity-output.tgz \
"${ENVOY_DELIVERY_DIR}"/envoy-coverity-output.tgz
exit 0
elif [[ "$CI_TARGET" == "bazel.fuzz" ]]; then
htuch marked this conversation as resolved.
Show resolved Hide resolved
setup_clang_toolchain
echo "bazel ASAN libFuzzer build with fuzz tests ${FUZZ_TEST_TARGETS}"
echo "Building envoy fuzzers and running against corpora"
bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c dbg --config=asan-fuzzer ${FUZZ_TEST_TARGETS}
exit 0
elif [[ "$CI_TARGET" == "fix_format" ]]; then
echo "fix_format..."
./tools/check_format.py fix
Expand Down