From 0b0c6b12f76c2e2633cc32b1a6b557c37fdd5457 Mon Sep 17 00:00:00 2001 From: Samuel Chiang Date: Wed, 15 Nov 2023 11:43:33 -0800 Subject: [PATCH] Add integration ci for Monit (#1286) Adding an integration CI for our recent support for Monit. Time tests will fail on a non-CET timezone machine, so I removed the test. It's non-relevant to AWS-LC functionality. --- .../github_ci_integration_omnibus.yaml | 10 ++++ .../linux-x86/ubuntu-22.04_base/Dockerfile | 1 + tests/ci/integration/run_monit_integration.sh | 56 +++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100755 tests/ci/integration/run_monit_integration.sh diff --git a/tests/ci/cdk/cdk/codebuild/github_ci_integration_omnibus.yaml b/tests/ci/cdk/cdk/codebuild/github_ci_integration_omnibus.yaml index 08d884dc42..3279a8b141 100644 --- a/tests/ci/cdk/cdk/codebuild/github_ci_integration_omnibus.yaml +++ b/tests/ci/cdk/cdk/codebuild/github_ci_integration_omnibus.yaml @@ -176,3 +176,13 @@ batch: image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-aarch:ubuntu-22.04_gcc-12x_latest variables: AWS_LC_CI_TARGET: "tests/ci/integration/run_sslproxy_integration.sh" + + - identifier: monit_integration_x86_64 + buildspec: tests/ci/codebuild/common/run_simple_target.yml + env: + type: LINUX_CONTAINER + privileged-mode: false + compute-type: BUILD_GENERAL1_SMALL + image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-22.04_gcc-12x_latest + variables: + AWS_LC_CI_TARGET: "tests/ci/integration/run_monit_integration.sh" diff --git a/tests/ci/docker_images/linux-x86/ubuntu-22.04_base/Dockerfile b/tests/ci/docker_images/linux-x86/ubuntu-22.04_base/Dockerfile index 0a66285bc4..4d3bdf2c87 100644 --- a/tests/ci/docker_images/linux-x86/ubuntu-22.04_base/Dockerfile +++ b/tests/ci/docker_images/linux-x86/ubuntu-22.04_base/Dockerfile @@ -48,6 +48,7 @@ RUN set -ex && \ liblua5.4-dev \ libnet-dev \ libnet-ssleay-perl \ + libpam0g-dev \ libpcap-dev \ libperl-dev \ libpcre2-dev \ diff --git a/tests/ci/integration/run_monit_integration.sh b/tests/ci/integration/run_monit_integration.sh new file mode 100755 index 0000000000..69c611ae19 --- /dev/null +++ b/tests/ci/integration/run_monit_integration.sh @@ -0,0 +1,56 @@ +#!/bin/bash -exu +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 OR ISC + +source tests/ci/common_posix_setup.sh + +# Set up environment. + +# SYS_ROOT +# - SRC_ROOT(aws-lc) +# - SCRATCH_FOLDER +# - monit +# - AWS_LC_BUILD_FOLDER +# - AWS_LC_INSTALL_FOLDER +# - MONIT_BUILD_FOLDER + +# Assumes script is executed from the root of aws-lc directory +SCRATCH_FOLDER="${SRC_ROOT}/MONIT_BUILD_ROOT" +MONIT_SRC_FOLDER="${SCRATCH_FOLDER}/monit" +MONIT_BUILD_FOLDER="${SCRATCH_FOLDER}/monit-aws-lc" +AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build" +AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install" + +function monit_build() { + ./bootstrap + ./configure --with-ssl-static="${AWS_LC_INSTALL_FOLDER}" + make -j ${NUM_CPU_THREADS} +} + +# Monit doesn't run any tests verifying ssl behavior, but it shouldn't hurt to run the brief tests. +function monit_run_tests() { + pushd libmonit + # TimeTest will fail on a machine not in CET timezone. + # https://bitbucket.org/tildeslash/monit/src/def6b462259586358be3c86d76a299c80744df39/libmonit/test/TimeTest.c#lines-24 + sed -i 's/TimeTest && //g' test/test.sh + make verify + popd +} + +mkdir -p ${SCRATCH_FOLDER} +rm -rf ${SCRATCH_FOLDER}/* +cd ${SCRATCH_FOLDER} + +git clone https://bitbucket.org/tildeslash/monit.git ${MONIT_SRC_FOLDER} --depth 1 +mkdir -p ${AWS_LC_BUILD_FOLDER} ${AWS_LC_INSTALL_FOLDER} ${MONIT_BUILD_FOLDER} +ls + +aws_lc_build ${SRC_ROOT} ${AWS_LC_BUILD_FOLDER} ${AWS_LC_INSTALL_FOLDER} -DBUILD_TESTING=OFF + +# Build monit from source. +pushd ${MONIT_SRC_FOLDER} + +monit_build +monit_run_tests +popd +