Skip to content

Commit

Permalink
ci: add AWS CodeBuild buildspec for quic-attack (#2003)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
WesleyRosenblum authored Oct 13, 2023
1 parent 14d5703 commit 5b0d34b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
26 changes: 26 additions & 0 deletions codebuild/spec/buildspec.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 15 additions & 2 deletions scripts/quic-attack/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 5b0d34b

Please sign in to comment.