From 8b6a553a1281cba5d5fb03dcda438159637ad28a Mon Sep 17 00:00:00 2001 From: Navidem Date: Mon, 7 Mar 2022 18:15:47 -0800 Subject: [PATCH] Pass FuzzIntrospector environment variables to bazel builds (#7367) * Using bazelrc to pass env vars * place bazelrc in /root/.bazelrc * Setting spawn strategy to standalone * undo changes in Dockerfile --- infra/base-images/base-builder/Dockerfile | 1 + infra/base-images/base-builder/bazel.bazelrc | 20 +++++++++++++++++++ .../base-builder/bazel_build_fuzz_tests | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 infra/base-images/base-builder/bazel.bazelrc diff --git a/infra/base-images/base-builder/Dockerfile b/infra/base-images/base-builder/Dockerfile index 1fd65d6c7..c76bd0115 100644 --- a/infra/base-images/base-builder/Dockerfile +++ b/infra/base-images/base-builder/Dockerfile @@ -161,5 +161,6 @@ COPY cargo compile compile_afl compile_dataflow compile_libfuzzer compile_honggf COPY llvmsymbol.diff $SRC COPY detect_repo.py /opt/cifuzz/ +COPY bazel.bazelrc /root/.bazelrc CMD ["compile"] diff --git a/infra/base-images/base-builder/bazel.bazelrc b/infra/base-images/base-builder/bazel.bazelrc new file mode 100644 index 000000000..8c6c98886 --- /dev/null +++ b/infra/base-images/base-builder/bazel.bazelrc @@ -0,0 +1,20 @@ +# Copyright 2022 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. +# +################################################################################ + + +# pass variables from environment +build --action_env=FUZZ_INTROSPECTOR +build --action_env=FUZZINTRO_OUTDIR diff --git a/infra/base-images/base-builder/bazel_build_fuzz_tests b/infra/base-images/base-builder/bazel_build_fuzz_tests index dca79f3f2..91453258e 100755 --- a/infra/base-images/base-builder/bazel_build_fuzz_tests +++ b/infra/base-images/base-builder/bazel_build_fuzz_tests @@ -54,6 +54,8 @@ declare -r BAZEL_BUILD_FLAGS=( "--@rules_fuzzing//fuzzing:cc_engine_sanitizer=none" \ "--cxxopt=-stdlib=libc++" \ "--linkopt=-lc++" \ + "--verbose_failures" \ + "--spawn_strategy=standalone" \ "--action_env=CC=${CC}" "--action_env=CXX=${CXX}" \ ${BAZEL_EXTRA_BUILD_FLAGS[*]} )