|
14 | 14 | # limitations under the License. |
15 | 15 | # |
16 | 16 | ################################################################################ |
17 | | -# Wrong naming in this fuzzer breaks the coverage build |
18 | | -rm promql/fuzz_test.go |
19 | 17 |
|
20 | | -compile_go_fuzzer github.com/prometheus/prometheus/promql FuzzParseMetric fuzzParseMetric |
21 | | -compile_go_fuzzer github.com/prometheus/prometheus/promql FuzzParseOpenMetric fuzzParseOpenMetric |
22 | | -compile_go_fuzzer github.com/prometheus/prometheus/promql FuzzParseMetricSelector fuzzParseMetricSelector |
23 | | -compile_go_fuzzer github.com/prometheus/prometheus/promql FuzzParseExpr fuzzParseExpr |
| 18 | +# go-118-fuzz-build_v2 overlays $GOROOT/src/testing/fuzz.go. When Go |
| 19 | +# downloads a newer toolchain to satisfy a go.work/go.mod requirement, |
| 20 | +# GOROOT falls under GOMODCACHE whose files Go refuses to overlay. To |
| 21 | +# work around this, copy the downloaded toolchain to a writable temp |
| 22 | +# dir, prepend it to PATH, and pin GOTOOLCHAIN=local so the copied |
| 23 | +# go binary (which IS the required version) is used directly. |
| 24 | +goroot=$(go env GOROOT) |
| 25 | +gomodcache=$(go env GOMODCACHE) |
| 26 | +if [[ "$goroot" == "$gomodcache"* ]]; then |
| 27 | + tmp_go=$(mktemp -d) |
| 28 | + cp -r "$goroot/." "$tmp_go" |
| 29 | + export GOROOT="$tmp_go" |
| 30 | + export PATH="$tmp_go/bin:$PATH" |
| 31 | + export GOTOOLCHAIN=local |
| 32 | +fi |
| 33 | + |
| 34 | +compile_native_go_fuzzer_v2 github.com/prometheus/prometheus/util/fuzzing FuzzParseMetricText fuzzParseMetricText |
| 35 | +compile_native_go_fuzzer_v2 github.com/prometheus/prometheus/util/fuzzing FuzzParseOpenMetric fuzzParseOpenMetric |
| 36 | +compile_native_go_fuzzer_v2 github.com/prometheus/prometheus/util/fuzzing FuzzParseMetricSelector fuzzParseMetricSelector |
| 37 | +compile_native_go_fuzzer_v2 github.com/prometheus/prometheus/util/fuzzing FuzzParseExpr fuzzParseExpr |
| 38 | + |
| 39 | +go generate -tags fuzzing ./util/fuzzing/corpus_gen |
| 40 | +mv util/fuzzing/fuzzParseExpr_seed_corpus.zip $OUT/ |
| 41 | +mv util/fuzzing/fuzzParseMetricSelector_seed_corpus.zip $OUT/ |
| 42 | +mv util/fuzzing/fuzzParseMetricText_seed_corpus.zip $OUT/ |
| 43 | +mv util/fuzzing/fuzzParseOpenMetric_seed_corpus.zip $OUT/ |
0 commit comments