Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add buildspec file for scheduled fuzzing #4763

Merged
merged 17 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -602,19 +602,27 @@ if (BUILD_TESTING)
target_link_libraries(fuzztest PUBLIC ${PROJECT_NAME})

# Set default values for fuzzing if not defined
if(NOT DEFINED FUZZ_TIMEOUT_SEC)
if(DEFINED ENV{FUZZ_TIMEOUT_SEC})
lrstewart marked this conversation as resolved.
Show resolved Hide resolved
set(FUZZ_TIMEOUT_SEC $ENV{FUZZ_TIMEOUT_SEC})
else()
set(FUZZ_TIMEOUT_SEC 60)
endif()

if(NOT DEFINED CORPUS_UPLOAD_LOC)
if(DEFINED ENV{CORPUS_UPLOAD_LOC})
set(CORPUS_UPLOAD_LOC $ENV{CORPUS_UPLOAD_LOC})
else()
set(CORPUS_UPLOAD_LOC "none")
endif()

if(NOT DEFINED ARTIFACT_UPLOAD_LOC)
if(DEFINED ENV{ARTIFACT_UPLOAD_LOC})
set(ARTIFACT_UPLOAD_LOC $ENV{ARTIFACT_UPLOAD_LOC})
jouho marked this conversation as resolved.
Show resolved Hide resolved
else()
set(ARTIFACT_UPLOAD_LOC "none")
endif()

if(NOT DEFINED FUZZ_TESTS)
if(DEFINED ENV{FUZZ_TESTS})
maddeleine marked this conversation as resolved.
Show resolved Hide resolved
set(FUZZ_TESTS $ENV{FUZZ_TESTS})
else()
set(FUZZ_TESTS "${TESTS}")
endif()
lrstewart marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
2 changes: 1 addition & 1 deletion codebuild/spec/buildspec_fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ phases:
commands:
- |
cmake . -Bbuild \
-DCMAKE_PREFIX_PATH=$LIBCRYPTO_ROOT \
-DCMAKE_PREFIX_PATH=/usr/local/$S2N_LIBCRYPTO \
maddeleine marked this conversation as resolved.
Show resolved Hide resolved
-DS2N_FUZZ_TEST=on
- cmake --build ./build -- -j $(nproc)
post_build:
Expand Down
87 changes: 87 additions & 0 deletions codebuild/spec/buildspec_fuzz_scheduled.yml
lrstewart marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
# 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.
version: 0.2

batch:
build-matrix:
jouho marked this conversation as resolved.
Show resolved Hide resolved
static:
env:
privileged-mode: true
dynamic:
env:
compute-type:
- BUILD_GENERAL1_LARGE
image:
- 024603541914.dkr.ecr.us-west-2.amazonaws.com/docker:ubuntu22codebuild
privileged-mode: true
variables:
S2N_LIBCRYPTO:
- awslc
lrstewart marked this conversation as resolved.
Show resolved Hide resolved
FUZZ_TESTS:
- "s2n_cert_req_recv_test"
- "s2n_certificate_extensions_parse_test"
lrstewart marked this conversation as resolved.
Show resolved Hide resolved
- "s2n_client_ccs_recv_test"
- "s2n_client_cert_recv_test"
- "s2n_client_cert_verify_recv_test"
- "s2n_client_finished_recv_test"
- "s2n_client_fuzz_test"
- "s2n_client_hello_recv_fuzz_test"
- "s2n_client_key_recv_fuzz_test"
- "s2n_deserialize_resumption_state_test"
- "s2n_encrypted_extensions_recv_test"
- "s2n_extensions_client_key_share_recv_test"
- "s2n_extensions_client_supported_versions_recv_test"
- "s2n_extensions_server_key_share_recv_test"
- "s2n_extensions_server_supported_versions_recv_test"
- "s2n_hybrid_ecdhe_kyber_r3_fuzz_test"
- "s2n_kyber_r3_recv_ciphertext_fuzz_test"
- "s2n_kyber_r3_recv_public_key_fuzz_test"
- "s2n_memory_leak_negative_test"
- "s2n_openssl_diff_pem_parsing_test"
- "s2n_recv_client_supported_groups_test"
- "s2n_select_server_cert_test"
- "s2n_server_ccs_recv_test"
- "s2n_server_cert_recv_test"
- "s2n_server_extensions_recv_test"
- "s2n_server_finished_recv_test"
- "s2n_server_fuzz_test"
- "s2n_server_hello_recv_test"
- "s2n_stuffer_pem_fuzz_test"
- "s2n_tls13_cert_req_recv_test"
- "s2n_tls13_cert_verify_recv_test"
- "s2n_tls13_client_finished_recv_test"
- "s2n_tls13_server_finished_recv_test"

phases:
pre_build:
commands:
- |
if [ -d "third-party-src" ]; then
cd third-party-src;
fi
build:
on-failure: ABORT
commands:
- |
cmake . -Bbuild \
-DCMAKE_PREFIX_PATH=/usr/local/$S2N_LIBCRYPTO \
-DS2N_FUZZ_TEST=on
- cmake --build ./build -- -j $(nproc)
post_build:
on-failure: ABORT
commands:
# -L: Restrict tests to labels matching the pattern 'fuzz'
maddeleine marked this conversation as resolved.
Show resolved Hide resolved
# -R: Run the single fuzz test defined in ${FUZZ_TESTS}
# --timeout: override ctest's default timeout of 1500
- cmake --build build/ --target test -- ARGS="-L fuzz -R ${FUZZ_TESTS} --output-on-failure --timeout 28800"
Loading