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 4673fa0
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ concurrency:
env:
CC: gcc
jobs:
libssh2:
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
steps:
- name: Install OS Dependencies
run: |
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang make
- uses: actions/checkout@v4
- name: Run libssh2 integration tests
run: |
./tests/ci/integration/run_libssh2_integration.sh
python-main:
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
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 4673fa0

Please sign in to comment.