fork of go-git with some jj specific features

build: Remove legacy fuzzing code The previous fuzzing code was static and required each target to be defined within oss-fuzz.sh. In addition, the Makefile target fuzz would statically call each one of the targets.

The changes remove the no longer needed oss-fuzz.sh. Please refer to the linked
upstream for more information.

The Makefile target is mostly for convenience when smoke testing all Go native
fuzzing are working. The changes now enumerate all packages which contains at
least one fuzzing test, and then execute them for the period set in FUZZ_TIME.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>

Paulo Gomes 4022160f 96332667

Changed files
+7 -41
+7 -7
Makefile
··· 14 14 COVERAGE_REPORT = coverage.out 15 15 COVERAGE_MODE = count 16 16 17 + # Defines the maximum time each fuzz target will be executed for. 18 + FUZZ_TIME ?= 10s 19 + FUZZ_PKGS = $(shell grep -r --include='**_test.go' --files-with-matches 'func Fuzz' . | xargs -I{} dirname {}) 20 + 17 21 build-git: 18 22 @if [ -f $(GIT_DIST_PATH)/git ]; then \ 19 23 echo "nothing to do, using cache $(GIT_DIST_PATH)"; \ ··· 45 49 rm -rf $(GIT_DIST_PATH) 46 50 47 51 fuzz: 48 - @go test -fuzz=FuzzParser $(PWD)/internal/revision 49 - @go test -fuzz=FuzzDecoder $(PWD)/plumbing/format/config 50 - @go test -fuzz=FuzzPatchDelta $(PWD)/plumbing/format/packfile 51 - @go test -fuzz=FuzzParseSignedBytes $(PWD)/plumbing/object 52 - @go test -fuzz=FuzzDecode $(PWD)/plumbing/object 53 - @go test -fuzz=FuzzDecoder $(PWD)/plumbing/protocol/packp 54 - @go test -fuzz=FuzzNewEndpoint $(PWD)/plumbing/transport 52 + @for path in $(FUZZ_PKGS); do \ 53 + go test -fuzz=Fuzz -fuzztime=$(FUZZ_TIME) $$path; \ 54 + done
-34
oss-fuzz.sh
··· 1 - #!/bin/bash -eu 2 - # Copyright 2023 Google LLC 3 - # 4 - # Licensed under the Apache License, Version 2.0 (the "License"); 5 - # you may not use this file except in compliance with the License. 6 - # You may obtain a copy of the License at 7 - # 8 - # http://www.apache.org/licenses/LICENSE-2.0 9 - # 10 - # Unless required by applicable law or agreed to in writing, software 11 - # distributed under the License is distributed on an "AS IS" BASIS, 12 - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 - # See the License for the specific language governing permissions and 14 - # limitations under the License. 15 - # 16 - ################################################################################ 17 - 18 - 19 - go mod download 20 - go get github.com/AdamKorcz/go-118-fuzz-build/testing 21 - 22 - if [ "$SANITIZER" != "coverage" ]; then 23 - sed -i '/func (s \*DecoderSuite) TestDecode(/,/^}/ s/^/\/\//' plumbing/format/config/decoder_test.go 24 - sed -n '29,$p' plumbing/format/packfile/common_test.go >> plumbing/format/packfile/delta_test.go 25 - sed -n '20,53p' plumbing/object/object_test.go >> plumbing/object/tree_test.go 26 - fi 27 - 28 - compile_native_go_fuzzer $(pwd)/internal/revision FuzzParser fuzz_parser 29 - compile_native_go_fuzzer $(pwd)/plumbing/format/config FuzzDecoder fuzz_decoder_config 30 - compile_native_go_fuzzer $(pwd)/plumbing/format/packfile FuzzPatchDelta fuzz_patch_delta 31 - compile_native_go_fuzzer $(pwd)/plumbing/object FuzzParseSignedBytes fuzz_parse_signed_bytes 32 - compile_native_go_fuzzer $(pwd)/plumbing/object FuzzDecode fuzz_decode 33 - compile_native_go_fuzzer $(pwd)/plumbing/protocol/packp FuzzDecoder fuzz_decoder_packp 34 - compile_native_go_fuzzer $(pwd)/plumbing/transport FuzzNewEndpoint fuzz_new_endpoint