Do not hardcode fuzzers
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
parent
2b60770c4b
commit
f7de1c8f90
@ -16,14 +16,16 @@
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
set -x
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
||||||
compile_fuzzers() {
|
compile_fuzzers() {
|
||||||
local regex=$1
|
local regex=$1
|
||||||
local compile_fuzzer=$2
|
local compile_fuzzer=$2
|
||||||
|
local blocklist=$3
|
||||||
|
|
||||||
for line in $(git grep "$regex" | grep -v vendor)
|
for line in $(git grep --full-name "$regex" | grep -v -E "$blocklist")
|
||||||
do
|
do
|
||||||
if [[ "$line" =~ (.*)/.*:.*(Fuzz[A-Za-z0-9]+) ]]; then
|
if [[ "$line" =~ (.*)/.*:.*(Fuzz[A-Za-z0-9]+) ]]; then
|
||||||
local pkg=${BASH_REMATCH[1]}
|
local pkg=${BASH_REMATCH[1]}
|
||||||
@ -58,12 +60,10 @@ rm -r vendor
|
|||||||
# Change path of socket since OSS-fuzz does not grant access to /run
|
# Change path of socket since OSS-fuzz does not grant access to /run
|
||||||
sed -i 's/\/run\/containerd/\/tmp\/containerd/g' $SRC/containerd/defaults/defaults_unix.go
|
sed -i 's/\/run\/containerd/\/tmp\/containerd/g' $SRC/containerd/defaults/defaults_unix.go
|
||||||
|
|
||||||
# Compile more fuzzers
|
|
||||||
mv $SRC/containerd/filters/filter_test.go $SRC/containerd/filters/filter_test_fuzz.go
|
|
||||||
go get github.com/AdamKorcz/go-118-fuzz-build/utils
|
go get github.com/AdamKorcz/go-118-fuzz-build/utils
|
||||||
|
|
||||||
compile_fuzzers '^func Fuzz.*testing\.F' compile_native_go_fuzzer
|
compile_fuzzers '^func Fuzz.*testing\.F' compile_native_go_fuzzer vendor
|
||||||
compile_fuzzers '^func Fuzz.*data' compile_go_fuzzer
|
compile_fuzzers '^func Fuzz.*data' compile_go_fuzzer '(vendor|Integ)'
|
||||||
|
|
||||||
# The below fuzzers require more setup than the fuzzers above.
|
# The below fuzzers require more setup than the fuzzers above.
|
||||||
# We need the binaries from "make".
|
# We need the binaries from "make".
|
||||||
@ -98,6 +98,5 @@ for i in $( ls *_test.go ); do mv $i ./${i%.*}_fuzz.go; done
|
|||||||
# Remove windows test to avoid double declarations:
|
# Remove windows test to avoid double declarations:
|
||||||
rm ./client_windows_test_fuzz.go
|
rm ./client_windows_test_fuzz.go
|
||||||
rm ./helpers_windows_test_fuzz.go
|
rm ./helpers_windows_test_fuzz.go
|
||||||
compile_go_fuzzer github.com/containerd/containerd/integration/client FuzzCreateContainerNoTearDown fuzz_create_container_no_teardown
|
|
||||||
compile_go_fuzzer github.com/containerd/containerd/integration/client FuzzCreateContainerWithTearDown fuzz_create_container_with_teardown
|
compile_fuzzers '^func FuzzInteg.*data' compile_go_fuzzer vendor
|
||||||
compile_go_fuzzer github.com/containerd/containerd/integration/client FuzzNoTearDownWithDownload fuzz_no_teardown_with_download
|
|
||||||
|
@ -407,7 +407,7 @@ func doFuzz(data []byte, shouldTearDown bool) int {
|
|||||||
// This fuzzer is experimental for now and is being run
|
// This fuzzer is experimental for now and is being run
|
||||||
// continuously by OSS-fuzz to collect feedback on
|
// continuously by OSS-fuzz to collect feedback on
|
||||||
// its sustainability.
|
// its sustainability.
|
||||||
func FuzzNoTearDownWithDownload(data []byte) int {
|
func FuzzIntegNoTearDownWithDownload(data []byte) int {
|
||||||
if !haveInitialized {
|
if !haveInitialized {
|
||||||
shouldRestart := initInSteps()
|
shouldRestart := initInSteps()
|
||||||
if shouldRestart {
|
if shouldRestart {
|
||||||
@ -423,7 +423,7 @@ func FuzzNoTearDownWithDownload(data []byte) int {
|
|||||||
// with one minor distinction: One tears down the
|
// with one minor distinction: One tears down the
|
||||||
// daemon after each iteration whereas the other doesn't.
|
// daemon after each iteration whereas the other doesn't.
|
||||||
// The two fuzzers' performance will be compared over time.
|
// The two fuzzers' performance will be compared over time.
|
||||||
func FuzzCreateContainerNoTearDown(data []byte) int {
|
func FuzzIntegCreateContainerNoTearDown(data []byte) int {
|
||||||
if !haveInitialized {
|
if !haveInitialized {
|
||||||
err := updatePathEnv()
|
err := updatePathEnv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -438,7 +438,7 @@ func FuzzCreateContainerNoTearDown(data []byte) int {
|
|||||||
// FuzzCreateContainerNoTearDown() except that
|
// FuzzCreateContainerNoTearDown() except that
|
||||||
// FuzzCreateContainerWithTearDown tears down the daemon
|
// FuzzCreateContainerWithTearDown tears down the daemon
|
||||||
// after each iteration.
|
// after each iteration.
|
||||||
func FuzzCreateContainerWithTearDown(data []byte) int {
|
func FuzzIntegCreateContainerWithTearDown(data []byte) int {
|
||||||
if !haveInitialized {
|
if !haveInitialized {
|
||||||
err := updatePathEnv()
|
err := updatePathEnv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user