forked from prometheus/prometheus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Continuous Fuzzing via Fuzzit (prometheus#5890)
* add fuzzit.dev continuous fuzzing integration Signed-off-by: Krzysztof Kowalczyk <kkowalczyk@gmail.com> * Migration to Circle Signed-off-by: Yevgeny Pats <yp@fuzzit.dev>
- Loading branch information
1 parent
f0a5f88
commit 0e1767b
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -xe | ||
|
||
# Go-fuzz doesn't support modules yet, so ensure we do everything in the old style GOPATH way | ||
export GO111MODULE="off" | ||
|
||
# Install go-fuzz | ||
go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build | ||
|
||
# Target names on fuzzit.dev | ||
TARGETS=("promql-parse-metric" "promql-parse-open-metric" "promql-parse-metric-selector" "promql-parse-expr") | ||
|
||
# Prometheus fuzz functions | ||
FUZZ_FUNCTIONS=("FuzzParseMetric" "FuzzParseOpenMetric" "FuzzParseMetricSelector" "FuzzParseExpr") | ||
|
||
# Compiling prometheus fuzz targets in fuzz.go with go-fuzz (https://github.com/dvyukov/go-fuzz) and libFuzzer support | ||
for ((i=0;i<${#TARGETS[@]};++i)); | ||
do | ||
go-fuzz-build -libfuzzer -func ${FUZZ_FUNCTIONS[i]} -o ${TARGETS[i]}.a ./promql | ||
clang-9 -fsanitize=fuzzer ${TARGETS[i]}.a -o ${TARGETS[i]} | ||
done | ||
|
||
# Install fuzzit CLI | ||
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64 | ||
chmod a+x fuzzit | ||
|
||
for TARGET in "${TARGETS[@]}" | ||
do | ||
./fuzzit create job --type $1 prometheus/${TARGET} ${TARGET} | ||
done |