mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
Add fuzz tests for storage_fs (#601)
This commit uses native go fuzzing to fuzz test implementations of storage in storage_fs. moved fuzzing testdata for storage_fs in separate repo added make target and script for importing fuzz data and running all fuzz tests Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
fuzzTime=${1:-10}
|
||||
|
||||
files=$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' .)
|
||||
|
||||
for file in ${files}
|
||||
do
|
||||
funcs=$(grep -oP 'func \K(Fuzz\w*)' $file)
|
||||
for func in ${funcs}
|
||||
do
|
||||
echo "Fuzzing $func in $file"
|
||||
parentDir=$(dirname $file)
|
||||
go test $parentDir -run=$func -fuzz=$func$ -fuzztime=${fuzzTime}s -tags sync,metrics,search,scrub,ui_base,containers_image_openpgp | grep -oP -x '^(?:(?!\blevel\b).)*$'
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user