Skip to content

Commit

Permalink
Add socat integration test (#1387)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhop authored Jan 22, 2024
1 parent 72693a7 commit c634160
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ jobs:
- name: Run ntp build
run: |
./tests/ci/integration/run_ntp_integration.sh
socat:
runs-on: ubuntu-latest
steps:
- name: Install OS Dependencies
run: |
sudo apt-get update && sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang make autoconf pkg-config openssl
- uses: actions/checkout@v3
- name: Run integration build
run: |
./tests/ci/integration/run_socat_integration.sh
61 changes: 61 additions & 0 deletions tests/ci/integration/run_socat_integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/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.
# SRC_ROOT(aws-lc)
# - SCRATCH_FOLDER
# - SOCAT_SRC
# - AWS_LC_BUILD_FOLDER
# - AWS_LC_INSTALL_FOLDER

# Assumes script is executed from the root of aws-lc directory
SCRATCH_FOLDER=${SRC_ROOT}/"scratch"
AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build"
AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install"
SOCAT_SRC="${SCRATCH_FOLDER}/socat"

function build_and_test_socat() {
pushd "$SOCAT_SRC"
autoconf
./configure --enable-openssl-base="$AWS_LC_INSTALL_FOLDER"
make -j "$NUM_CPU_THREADS"
# test 146 OPENSSLLISTENDSA: fails because AWS-LC doesn't support FFDH ciphersuites which are needed for DSA
# test 216 UDP6MULTICAST_UNIDIR: known flaky test in socat with newer kernels
# test 309 OPENSSLRENEG1: AWS-LC doesn't support renegotiation by default, it can be enabled by calling SSL_set_renegotiate_mode
# but that has caveats. See PORTING.md 'TLS renegotiation'
# test 310 OPENSSLRENEG2: AWS-LC doesn't support renegotiation by default, it can be enabled by calling SSL_set_renegotiate_mode
# but that has caveats. See PORTING.md 'TLS renegotiation'
# test 399 OPENSSL_DTLS_CLIENT: Unknown issue running openssl s_server
# test 467 EXEC_FDS: Something broken with exec'ing and not inheriting LD_LIBRARY_PATH
# test 468 EXEC_SNIFF: Something broken with exec'ing and not inheriting LD_LIBRARY_PATH
# test 478 SIGUSR1_STATISTICS: GHA does not support tty
# test 492 ACCEPT_FD: uses systemd-socket-activate which doesn't inherit the LD_LIBRARY_PATH so socat can't find libcrypto.so
# test 498 SHELL_SOCKETPAIR: GHA does not specify expected shell environment variables
# test 499 SHELL_PIPES: GHA does not specify expected shell environment variables
# test 500 SHELL_PTY: GHA does not specify expected shell environment variables
# test 501 SHELL_SOCKETPAIR_FLUSH: GHA does not specify expected shell environment variables
# test 502 SHELL_PIPES: GHA does not specify expected shell environment variables
# test 503 SYSTEM_SIGINT: GHA does not specify expected shell environment variables
# test 506 CHDIR_ON_SHELL: GHA does not specify expected shell environment variables
# test 508 UMASK_ON_SYSTEM: GHA does not specify expected shell environment variables
# test 528 PROCAN_CTTY: GHA does not support tty
./test.sh -d -v --expect-fail 146,216,309,310,399,467,468,478,492,498,499,500,501,502,503,506,508,528
popd
}

# Make script execution idempotent.
mkdir -p ${SCRATCH_FOLDER}
rm -rf "${SCRATCH_FOLDER:?}"/*

mkdir -p "$AWS_LC_BUILD_FOLDER" "$AWS_LC_INSTALL_FOLDER"
git clone --depth 1 https://repo.or.cz/socat.git "$SOCAT_SRC"

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

ldd "${SOCAT_SRC}/socat" | grep "${AWS_LC_INSTALL_FOLDER}/lib/libcrypto.so" || exit 1
ldd "${SOCAT_SRC}/socat" | grep "${AWS_LC_INSTALL_FOLDER}/lib/libssl.so" || exit 1

0 comments on commit c634160

Please sign in to comment.