Skip to content

Commit

Permalink
address PR feedbacks
Browse files Browse the repository at this point in the history
- remove unset LD_PRELOADS
- fix script name in the usage
- use cmake to configure compiler
- remove unused options
  • Loading branch information
jouho committed Dec 13, 2024
1 parent be23009 commit a2e4156
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 23 deletions.
5 changes: 0 additions & 5 deletions codebuild/bin/fuzz_corpus_download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
# 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")
Expand Down
7 changes: 1 addition & 6 deletions codebuild/bin/fuzz_corpus_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@
# 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.
# Upload generated corpus files to the S3 bucket.
zip -r ./tests/fuzz/corpus/${TEST_NAME}.zip ./tests/fuzz/corpus/${TEST_NAME}/ > /dev/null 2>&1
aws s3 cp ./tests/fuzz/corpus/${TEST_NAME}.zip s3://s2n-tls-fuzz-corpus/${TEST_NAME}/corpus.zip
done
Expand Down
2 changes: 1 addition & 1 deletion codebuild/bin/fuzz_coverage_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
set -e

usage() {
echo "Usage: calcTotalCov.sh"
echo "Usage: fuzz_coverage_report.sh"
exit 1
}

Expand Down
4 changes: 2 additions & 2 deletions codebuild/spec/buildspec_fuzz_scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ version: 0.2

env:
variables:
CC: "/usr/bin/clang"
CXX: "/usr/bin/clang++"
S2N_LIBCRYPTO: "awslc"
COMPILER: clang

phases:
pre_build:
Expand All @@ -32,6 +31,7 @@ phases:
- |
cmake . -Bbuild \
-DCMAKE_PREFIX_PATH=/usr/local/$S2N_LIBCRYPTO \
-DCMAKE_C_COMPILER=/usr/bin/$COMPILER \
-DS2N_FUZZ_TEST=on \
-DCOVERAGE=on \
-DBUILD_SHARED_LIBS=on
Expand Down
6 changes: 0 additions & 6 deletions tests/fuzz/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ cmake . -Bbuild \
cmake --build ./build -- -j $(nproc)
```

If you see an error that says `This project requires clang for coverage support. You are currently using X`, set the C compiler environment variable to use Clang:
```
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
```

Next, run fuzz tests. This generates `.info` files for each fuzz test containing coverage information.
```
cmake --build build/ --target test -- ARGS="-L fuzz --output-on-failure"
Expand Down
3 changes: 0 additions & 3 deletions tests/fuzz/runFuzzTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ else
EXPECTED_TEST_FAILURE=0
fi

ASAN_OPTIONS+="symbolize=1"
LSAN_OPTIONS+="log_threads=1"
UBSAN_OPTIONS+="print_stacktrace=1"
LIBFUZZER_ARGS+="-timeout=5 -max_len=4096 -print_final_stats=1 -max_total_time=${FUZZ_TIMEOUT_SEC}"

TEST_SPECIFIC_OVERRIDES="${S2N_ROOT}/build/lib/lib${TEST_NAME}_overrides.so"
Expand Down

0 comments on commit a2e4156

Please sign in to comment.