From e20ca5cef56d8a6d5368c0f35a70b33badedfcab Mon Sep 17 00:00:00 2001 From: Justin W Smith <103147162+justsmth@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:23:29 -0500 Subject: [PATCH] Add integ test for tcpdump --- .github/workflows/integrations.yml | 12 +++- .../ci/integration/run_tcpdump_integration.sh | 57 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100755 tests/ci/integration/run_tcpdump_integration.sh diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml index 83a54d92c2c..9735258d6d5 100644 --- a/.github/workflows/integrations.yml +++ b/.github/workflows/integrations.yml @@ -19,4 +19,14 @@ jobs: - uses: actions/checkout@v3 - name: Run integration build run: | - ./tests/ci/integration/run_haproxy_integration.sh \ No newline at end of file + ./tests/ci/integration/run_haproxy_integration.sh + tcpdump: + runs-on: ubuntu-latest + steps: + - name: Install OS Dependencies + run: | + sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang make libpcap-dev binutils-dev + - uses: actions/checkout@v3 + - name: Run integration build + run: | + ./tests/ci/integration/run_tcpdump_integration.sh diff --git a/tests/ci/integration/run_tcpdump_integration.sh b/tests/ci/integration/run_tcpdump_integration.sh new file mode 100755 index 00000000000..04b8c22fcbc --- /dev/null +++ b/tests/ci/integration/run_tcpdump_integration.sh @@ -0,0 +1,57 @@ +#!/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 +# | +# - tcpdump +# - tcpdump-install +# - AWS_LC_BUILD_FOLDER +# - AWS_LC_INSTALL_FOLDER + +# Assumes script is executed from the root of aws-lc directory +SCRATCH_FOLDER=${SYS_ROOT}/"TCPDUMP_SCRATCH" +TCPDUMP_SRC_FOLDER="${SCRATCH_FOLDER}/tcpdump" +TCPDUMP_INSTALL_FOLDER="${SCRATCH_FOLDER}/tcpdump-install" +AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build" +AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install" + +mkdir -p "${SCRATCH_FOLDER}" +rm -rf "${SCRATCH_FOLDER:?}"/* + +pushd "${SCRATCH_FOLDER}" + +function tcpdump_build() { + autoreconf -fi + ./configure --prefix="${TCPDUMP_INSTALL_FOLDER}" --with-openssl="${AWS_LC_INSTALL_FOLDER}" + make -j "${NUM_CPU_THREADS}" +} + +function tcpdump_run_tests() { + make check + make releasecheck +} + +# Get latest tcpdump version. +git clone https://github.com/the-tcpdump-group/tcpdump.git "${TCPDUMP_SRC_FOLDER}" +mkdir -p "${AWS_LC_BUILD_FOLDER}" "${AWS_LC_INSTALL_FOLDER}" "${TCPDUMP_INSTALL_FOLDER}" +ls + +aws_lc_build "${SRC_ROOT}" "${AWS_LC_BUILD_FOLDER}" "${AWS_LC_INSTALL_FOLDER}" + +pushd "${TCPDUMP_SRC_FOLDER}" +tcpdump_build +tcpdump_run_tests +popd + +popd