Skip to content

Commit

Permalink
Benchmark build testing (#546)
Browse files Browse the repository at this point in the history
Added CI dimension that will run the benchmarking tools to verify that we haven't made any changes that break them
  • Loading branch information
Dominic Dams authored Jul 18, 2022
1 parent 2b38edd commit 726062d
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/ci/cdk/cdk/codebuild/github_ci_linux_x86_omnibus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ batch:
compute-type: BUILD_GENERAL1_SMALL
image: ECR_REPO_PLACEHOLDER:ubuntu-20.04_clang-9x_latest

- identifier: ubuntu2004_clang7x_x86_64_benchmark
buildspec: ./tests/ci/codebuild/linux-x86/run_bm_build_test.yml
env:
type: LINUX_CONTAINER
privileged-mode: true
compute-type: BUILD_GENERAL1_SMALL
image: ECR_REPO_PLACEHOLDER:ubuntu-20.04_clang-7x-bm-framework_latest

- identifier: ubuntu710_gcc4_1x_x86_64_build
buildspec: ./tests/ci/codebuild/linux-x86/run_legacy_build.yml
env:
Expand Down
14 changes: 14 additions & 0 deletions tests/ci/codebuild/linux-x86/run_bm_build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

version: 0.2

phases:
pre_build:
commands:
# To use this build spec file, CMake environment variable CC and CXX compiler should be defined before build.
- if [[ -z "${CC+x}" || -z "${CC}" ]]; then echo "CC is not defined." && exit 1; else ${CC} --version && echo "Found correct CC."; fi
- if [[ -z "${CXX+x}" || -z "${CXX}" ]]; then echo "CXX is not defined." && exit 1; else ${CXX} --version && echo "Found correct CXX."; fi
build:
commands:
- ./tests/ci/run_benchmark_build_tests.sh
52 changes: 52 additions & 0 deletions tests/ci/run_benchmark_build_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash -ex
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

source tests/ci/common_posix_setup.sh

install_dir="$(pwd)/../librypto_install_dir"
openssl_url='https://github.com/openssl/openssl.git'
openssl_1_1_branch='OpenSSL_1_1_1-stable'
openssl_3_0_branch='openssl-3.0'

function build_openssl_1_1 {
echo "building OpenSSL 1.1"
git clone --branch "${openssl_1_1_branch}" "${openssl_url}" "../openssl-1.1"
pushd "../openssl-1.1"
mkdir -p "${install_dir}/openssl-1.1"
./config --prefix="${install_dir}/openssl-1.1" --openssldir="${install_dir}/openssl-1.1"
make "-j${NUM_CPU_THREADS}"
make install
popd
rm -rf "../openssl-1.1"
}

function build_openssl_3_0 {
echo "building OpenSSL 3.0"
git clone --branch "${openssl_3_0_branch}" "${openssl_url}" "../openssl-3.0"
pushd "../openssl-3.0"
mkdir -p "${install_dir}/openssl-3.0"
./Configure --prefix="${install_dir}/openssl-3.0" --openssldir="${install_dir}/openssl-3.0"
make "-j${NUM_CPU_THREADS}"
make install
popd
rm -rf "../openssl-1.1"
}

# We build each tool individually so we can have more insight into what is failing

mkdir -p "${install_dir}"
echo "Testing awslc_bm"
mkdir "${install_dir}/aws_lc"
run_build -DAWSLC_INSTALL_DIR="${install_dir}/aws_lc"
"${BUILD_ROOT}/tool/awslc_bm"

build_openssl_1_1
echo "Testing ossl_bm with OpenSSL 1.1"
run_build -DOPENSSL_INSTALL_DIR="${install_dir}/openssl-1.1"
"${BUILD_ROOT}/tool/ossl_bm"

build_openssl_3_0
echo "Testing ossl_bm with OpenSSL 3.0"
run_build -DOPENSSL3_INSTALL_DIR="${install_dir}/openssl-3.0"
"${BUILD_ROOT}/tool/ossl3_bm"

0 comments on commit 726062d

Please sign in to comment.