diff --git a/codebuild/spec/buildspec.yml b/codebuild/spec/buildspec.yml new file mode 100644 index 0000000000..5899971bb9 --- /dev/null +++ b/codebuild/spec/buildspec.yml @@ -0,0 +1,26 @@ +# +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 +# +version: 0.2 + +env: + shell: bash + variables: + # ultraman requires $SHELL be set + SHELL: "/bin/bash" + +phases: + install: + commands: + - echo "Installing Rust ..." + - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + - source $HOME/.cargo/env + - echo "Installing cmake ..." + - apt-get update -y + - apt-get install -y cmake + build: + commands: + - printenv + - echo "Running quic-attack for $RUNTIME seconds" + - ./scripts/quic-attack/run $RUNTIME diff --git a/scripts/quic-attack/run b/scripts/quic-attack/run index 48ea5e555e..7a01a5af0e 100755 --- a/scripts/quic-attack/run +++ b/scripts/quic-attack/run @@ -8,11 +8,14 @@ set -e # ensure s2n-quic-qns is built -RUSTFLAGS="-C debug_assertions --cfg s2n_internal_dev -g" cargo +stable build --release --bin s2n-quic-qns +# -C debug_assertions turns on debug assertions and overflow checks in the release build +# -g include debug information +# -C panic=abort will cause spawned tasks that panic to exit the process +RUSTFLAGS="-C debug_assertions --cfg s2n_internal_dev -g -C panic=abort" cargo +stable build --release --bin s2n-quic-qns # ensure ultraman is installed if ! command -v ultraman &> /dev/null; then - cargo install ultraman + cargo +stable install ultraman fi # The different types of fuzzing supported by quic-attack @@ -55,7 +58,17 @@ fi COMMON_ARGS="--max-throughput 10000 --max-handshake-duration 10 --max-idle-timeout 10" PERF_APP="./target/release/s2n-quic-qns perf" +# disable exiting on errors to capture the timeout status +set +e RUST_BACKTRACE=1 \ SERVER="$PERF_APP server $COMMON_ARGS" \ CLIENT="$PERF_APP client $COMMON_ARGS --ip 127.0.0.1 --local-ip 127.0.0.1 --connections 100000000000000000 --send 100000 --receive 100000 --streams 10000 --concurrency 1000" \ $TIMEOUT ultraman start --no-timestamp true -f ./scripts/quic-attack/Procfile -m $PROCESSES +EXIT_CODE="$?" +# cleanup any zombie processes +pkill -f "$PERF_APP" +# re-enable exiting on errors +set -e +# `timeout` exits with `124` if the time limit was reached +# only exit with a success code if the time limit was reached +[[ "$EXIT_CODE" == "124" ]] || exit 1