Skip to content

Commit

Permalink
Added script changes to run fuzz tests dynamically (#4506)
Browse files Browse the repository at this point in the history
* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

* Added script changes to run tests dynamically

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>

---------

Signed-off-by: Jonsy13 <vedant.shrotria@harness.io>
  • Loading branch information
Jonsy13 authored Mar 12, 2024
1 parent 7226819 commit 916d3d3
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions chaoscenter/fuzz_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,24 @@
# limitations under the License.
#
################################################################################
cd chaoscenter/graphql/server && go mod download
go install github.com/AdamKorcz/go-118-fuzz-build@latest
go get github.com/AdamKorcz/go-118-fuzz-build/testing
export GO_MOD_PATHS_MAPPING=( "graphql/server" "authentication" "subscriber" )

compile_native_go_fuzzer $(pwd)/pkg/environment/handler/fuzz_tests FuzzTestGetEnvironment test-fuzz
cd chaoscenter
export rootDir=$(pwd)

for dir in "${GO_MOD_PATHS_MAPPING[@]}"; do
cd ${dir} && go mod download
go install github.com/AdamKorcz/go-118-fuzz-build@latest
go get github.com/AdamKorcz/go-118-fuzz-build/testing
fuzz_files=($(find "$(pwd)" -type f -name '*_fuzz_test.go'))
for file in "${fuzz_files[@]}"; do
pkg=$(grep -m 1 '^package' "$file" | awk '{print $2}')
package_path=$(dirname "${file%$pkg}")
functionList=($(grep -o 'func Fuzz[A-Za-z0-9_]*' ${file} | awk '{print $2}'))
for i in "${functionList[@]}"
do
compile_native_go_fuzzer ${package_path} ${i} ${i}
done
done
cd ${rootDir}
done

0 comments on commit 916d3d3

Please sign in to comment.