-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# A copy of the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0 | ||
# | ||
# or in the "license" file accompanying this file. This file is distributed | ||
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
# express or implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
# | ||
|
||
# Clean the environment before copying corpuses from the S3 bucket. | ||
# The LD variables may interfere with certificate validation when communicating with AWS S3. | ||
unset LD_PRELOAD | ||
unset LD_LIBRARY_PATH | ||
|
||
for FUZZ_TEST in tests/fuzz/*.c; do | ||
# extract file name without extension | ||
TEST_NAME=$(basename "$FUZZ_TEST") | ||
TEST_NAME="${TEST_NAME%.*}" | ||
|
||
# temp corpus folder to store downloaded corpus files | ||
TEMP_CORPUS_DIR="./tests/fuzz/temp_corpus_${TEST_NAME}" | ||
|
||
printf "Downloading corpus files from S3 bucket...\n" | ||
|
||
# Check if corpus.zip exists in the specified S3 location. | ||
# `> /dev/null 2>&1` redirects output to /dev/null. | ||
# If the file is not found, `aws s3 ls` returns a non-zero exit code. | ||
if aws s3 ls "s3://s2n-tls-fuzz-corpus/${TEST_NAME}/corpus.zip" > /dev/null 2>&1; then | ||
aws s3 cp "s3://s2n-tls-fuzz-corpus/${TEST_NAME}/corpus.zip" "${TEMP_CORPUS_DIR}/corpus.zip" | ||
unzip -o "${TEMP_CORPUS_DIR}/corpus.zip" -d "${TEMP_CORPUS_DIR}" | ||
else | ||
printf "corpus.zip not found for ${TEST_NAME}" | ||
fi | ||
printf "Finished downloading corpus files from S3 bucket." | ||
done |
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,41 @@ | ||
#!/bin/bash | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# A copy of the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0 | ||
# | ||
# or in the "license" file accompanying this file. This file is distributed | ||
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
# express or implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
# | ||
|
||
# Clean the environment before copying corpuses to the S3 bucket. | ||
# The LD variables may interfere with certificate validation when communicating with AWS S3. | ||
unset LD_PRELOAD | ||
unset LD_LIBRARY_PATH | ||
|
||
for FUZZ_TEST in tests/fuzz/*.c; do | ||
# extract file name without extension | ||
TEST_NAME=$(basename "$FUZZ_TEST") | ||
TEST_NAME="${TEST_NAME%.*}" | ||
|
||
# Store generated corpus files in the S3 bucket. | ||
printf "Zipping corpus files...\n" | ||
zip -r ./tests/fuzz/corpus/${TEST_NAME}.zip ./tests/fuzz/corpus/${TEST_NAME}/ | ||
|
||
printf "Uploading zipped corpus file to S3 bucket...\n" | ||
aws s3 cp ./tests/fuzz/corpus/${TEST_NAME}.zip s3://s2n-tls-fuzz-corpus/${TEST_NAME}/corpus.zip | ||
|
||
printf "Finished downloading corpus files from S3 bucket.\n" | ||
printf "Uploading test log output...\n" | ||
|
||
# Store generated output files in the S3 bucket. | ||
printf "Uploading output files to S3 bucket...\n" | ||
aws s3 cp ./tests/fuzz/${TEST_NAME}_output.txt ${ARTIFACT_UPLOAD_LOC}/${TEST_NAME}/output_$(date +%Y-%m-%d-%T).txt | ||
aws s3 cp ./tests/fuzz/${TEST_NAME}_results.txt ${ARTIFACT_UPLOAD_LOC}/${TEST_NAME}/results_$(date +%Y-%m-%d-%T).txt | ||
done | ||
|
File renamed without changes.
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