From 4ea64fc7356b0351f7a3a15e28f4611bca8e025a Mon Sep 17 00:00:00 2001 From: Ali Zhang Date: Tue, 2 Feb 2021 22:24:27 -0800 Subject: [PATCH] pigweed: Restore fuzzing (#5099) Fuzzing was broken due to toolchain refactoring. This change brings things back. Test: Locally built and run the example toy_fuzzer per https://google.github.io/oss-fuzz/getting-started/new-project-guide/#testing-locally --- projects/pigweed/build.sh | 13 ++++++------- projects/pigweed/extract_pw_fuzzers.py | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/projects/pigweed/build.sh b/projects/pigweed/build.sh index 08f59b1a8..c3e272807 100644 --- a/projects/pigweed/build.sh +++ b/projects/pigweed/build.sh @@ -50,9 +50,9 @@ python $SRC/filter_cipd.py \ pigweed/third_party/kythe # Pigweed checks that it can find these as part of a "sanity check". -mkdir -p "$PW_ROOT/.cipd/pigweed/bin" +mkdir -p "$PW_ROOT/.environment/cipd/pigweed/bin" for b in arm-none-eabi-gcc bazel bloaty ; do - x="$PW_ROOT/.cipd/pigweed/bin/$b" + x="$PW_ROOT/.environment/cipd/pigweed/bin/$b" if [[ ! -x $x ]] ; then ln -s "$(which false)" "$x" fi @@ -70,13 +70,12 @@ EXTRA_CXXFLAGS="-Wno-unused-command-line-argument" EXTRA_CXXFLAGS+=" -fno-sanitize=vptr" # Build! -CXXFLAGS="$CXXFLAGS $EXTRA_CXXFLAGS" \ +CXXFLAGS="$CXXFLAGS $EXTRA_CXXFLAGS" LDFLAGS="$CXXFLAGS" \ gn gen "$BUILDROOT" \ --root="$PW_ROOT" \ - --args="oss_fuzz_enabled=true - pw_target_toolchain=\"//pw_toolchain:host_clang_og\" - pw_sanitizer=\"$SANITIZER\"" -ninja -C "$BUILDROOT" + --args="pw_toolchain_OSS_FUZZ_ENABLED=true + pw_toolchain_SANITIZERS=[\"$SANITIZER\"]" +ninja -C "$BUILDROOT" fuzzers # Use build-generated metadata to identify available fuzzers python "$SRC/extract_pw_fuzzers.py" --buildroot "$BUILDROOT" --out "$OUT/" diff --git a/projects/pigweed/extract_pw_fuzzers.py b/projects/pigweed/extract_pw_fuzzers.py index 83e4fcca4..dc70bc300 100644 --- a/projects/pigweed/extract_pw_fuzzers.py +++ b/projects/pigweed/extract_pw_fuzzers.py @@ -33,7 +33,8 @@ def main(): print(' buildroot: ' + args.buildroot) print(' out: ' + args.out) - testinfo = os.path.join(args.buildroot, 'obj', + testinfo = os.path.join(args.buildroot, 'host_clang_fuzz', + 'obj', 'pw_module_tests.testinfo.json') tests = [] with open(testinfo) as json_file: