From 5b0d34b1990d9aa417e6b2caa287f25802f8c08e Mon Sep 17 00:00:00 2001 From: Wesley Rosenblum <55108558+WesleyRosenblum@users.noreply.github.com> Date: Fri, 13 Oct 2023 13:05:18 -0700 Subject: [PATCH] ci: add AWS CodeBuild buildspec for quic-attack (#2003) * add buildspec.yml * add -y command to run rustup accepting defaults * install cmake * use stable for installing ultraman * use debug build while testing * set SHELL env variable * trying without eval * change to debug * put eval back * exit with 0 only if the time limit was reached * add new line to buildspec.yml * add new line to run * use environment variable for runtime * Add message * change pkill input * try out a panic * remove panic * add quotes to pkill * try panic again * remove panic --- codebuild/spec/buildspec.yml | 26 ++++++++++++++++++++++++++ scripts/quic-attack/run | 17 +++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 codebuild/spec/buildspec.yml 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