Skip to content

Commit

Permalink
Integration test for libssh2
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Feb 26, 2025
1 parent ae03966 commit 667ece7
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/ci/cdk/cdk/codebuild/github_ci_integration_omnibus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ batch:
variables:
AWS_LC_CI_TARGET: "tests/ci/integration/run_crt_integration.sh"

- identifier: libssh2_integration
buildspec: tests/ci/codebuild/common/run_simple_target.yml
env:
type: LINUX_CONTAINER
privileged-mode: true
compute-type: BUILD_GENERAL1_LARGE
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_libssh2_integration.sh"

- identifier: openssh_integration_master_x86_64
buildspec: tests/ci/codebuild/common/run_simple_target.yml
env:
Expand Down
63 changes: 63 additions & 0 deletions tests/ci/integration/run_libssh2_integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC

set -exu

source tests/ci/common_posix_setup.sh

# Set up environment.

# SYS_ROOT
# |
# - SRC_ROOT(aws-lc)
# |
# - SCRATCH_FOLDER
# |
# - libssh2
# - LIBSSH2_BUILD_FOLDER
# - LIBSSH2_INSTALL_FOLDER
# - AWS_LC_BUILD_FOLDER
# - AWS_LC_INSTALL_FOLDER

# Assumes script is executed from the root of aws-lc directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
SCRATCH_FOLDER=${SYS_ROOT}/"LIBSSH2_SCRATCH"
LIBSSH2_SRC_FOLDER="${SCRATCH_FOLDER}/libssh2"
LIBSSH2_PATCH_FOLDER="${SCRIPT_DIR}"/libssh2_patch
LIBSSH2_BUILD_FOLDER="${SCRATCH_FOLDER}/libssh2-build"
LIBSSH2_INSTALL_FOLDER="${SCRATCH_FOLDER}/libssh2-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:?}"/*

function libssh2_build() {
cmake "${LIBSSH2_SRC_FOLDER}" -B "${LIBSSH2_BUILD_FOLDER}" -DCRYPTO_BACKEND=OpenSSL -DBUILD_TESTS=1 -DCMAKE_INSTALL_PREFIX="${LIBSSH2_INSTALL_FOLDER}" -DOPENSSL_ROOT_DIR="${AWS_LC_INSTALL_FOLDER}" -DENABLE_WERROR=ON -DENABLE_DEBUG_LOGGING=ON
cmake --build "${LIBSSH2_BUILD_FOLDER}" --target install
ldd "${LIBSSH2_INSTALL_FOLDER}/lib/libssh2.so" | grep "${AWS_LC_INSTALL_FOLDER}" | grep "libcrypto.so" || exit 1
}

function libssh2_run_tests() {
pushd "${LIBSSH2_BUILD_FOLDER}"
ctest -VV --output-on-failure
popd
}

pushd "${SCRATCH_FOLDER}"

# Get latest libssh2 version.
git clone /~https://github.com/libssh2/libssh2.git "${LIBSSH2_SRC_FOLDER}"
mkdir -p "${AWS_LC_BUILD_FOLDER}" "${AWS_LC_INSTALL_FOLDER}" "${LIBSSH2_BUILD_FOLDER}" "${LIBSSH2_INSTALL_FOLDER}"
ls

aws_lc_build "$SRC_ROOT" "$AWS_LC_BUILD_FOLDER" "$AWS_LC_INSTALL_FOLDER" -DBUILD_TESTING=OFF -DBUILD_TOOL=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=1
aws_lc_build "$SRC_ROOT" "$AWS_LC_BUILD_FOLDER" "$AWS_LC_INSTALL_FOLDER" -DBUILD_TESTING=OFF -DBUILD_TOOL=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=0
export LD_LIBRARY_PATH="${AWS_LC_INSTALL_FOLDER}/lib/:${AWS_LC_INSTALL_FOLDER}/lib64/:${LD_LIBRARY_PATH:-}"

libssh2_build
libssh2_run_tests

popd

0 comments on commit 667ece7

Please sign in to comment.