Skip to content

Commit

Permalink
fix: upload fuzz output to s3 when test fails (#4694)
Browse files Browse the repository at this point in the history
  • Loading branch information
jouho committed Aug 8, 2024
1 parent f6abd5d commit b356b86
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/fuzz/runFuzzTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,6 @@ then
if [ $EXPECTED_TEST_FAILURE == 1 ];
then
# Store corpus to S3 to be used for debugging if the test is negative
unset LD_PRELOAD
unset LD_LIBRARY_PATH
if [ "$CORPUS_UPLOAD_LOC" != "none" ]; then
printf "Zipping corpus files...\n"
zip -r ./corpus/${TEST_NAME}.zip ./corpus/${TEST_NAME}/
printf "Uploading zipped corpus file to S3 bucket...\n"
aws s3 cp ./corpus/${TEST_NAME}.zip $CORPUS_UPLOAD_LOC/${TEST_NAME}/corpus_$(date +%Y-%m-%d-%T).zip
fi
# Store generated output files in the S3 bucket.
if [ "$ARTIFACT_UPLOAD_LOC" != "none" ]; then
printf "Uploading output files to S3 bucket...\n"
aws s3 cp ./${TEST_NAME}_output.txt ${ARTIFACT_UPLOAD_LOC}/${TEST_NAME}/output_$(date +%Y-%m-%d-%T).txt
aws s3 cp ./${TEST_NAME}_results.txt ${ARTIFACT_UPLOAD_LOC}/${TEST_NAME}/results_$(date +%Y-%m-%d-%T).txt
fi
# Clean up LibFuzzer corpus files if the test is negative.
printf "\n"
rm -f leak-* crash-*
Expand Down Expand Up @@ -262,5 +244,23 @@ then
else
cat ${TEST_NAME}_output.txt
printf "\033[31;1mFAILED\033[0m %s, %6d features covered\n" "$TEST_INFO" $FEATURE_COVERAGE
# Store corpus to S3 to be used for debugging if the test fails
unset LD_PRELOAD
unset LD_LIBRARY_PATH
if [ "$CORPUS_UPLOAD_LOC" != "none" ]; then
printf "Zipping corpus files...\n"
zip -r ./corpus/${TEST_NAME}.zip ./corpus/${TEST_NAME}/
printf "Uploading zipped corpus file to S3 bucket...\n"
aws s3 cp ./corpus/${TEST_NAME}.zip $CORPUS_UPLOAD_LOC/${TEST_NAME}/corpus_$(date +%Y-%m-%d-%T).zip
fi
# Store generated output files in the S3 bucket.
if [ "$ARTIFACT_UPLOAD_LOC" != "none" ]; then
printf "Uploading output files to S3 bucket...\n"
aws s3 cp ./${TEST_NAME}_output.txt ${ARTIFACT_UPLOAD_LOC}/${TEST_NAME}/output_$(date +%Y-%m-%d-%T).txt
aws s3 cp ./${TEST_NAME}_results.txt ${ARTIFACT_UPLOAD_LOC}/${TEST_NAME}/results_$(date +%Y-%m-%d-%T).txt
fi
exit -1
fi

0 comments on commit b356b86

Please sign in to comment.