Skip to content

Commit

Permalink
Add OpenSSL build and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Dec 12, 2023
1 parent f1e3a69 commit a75fe4b
Show file tree
Hide file tree
Showing 14 changed files with 264 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/build-openblas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source `dirname $0`/config.sh

echo "::group::Build OpenBLAS"
cd $SOURCE_PATH/OpenBLAS
cd $SOURCE_PATH/$OPENBLAS_VERSION
make BINARY=64 CC=aarch64-w64-mingw32-gcc HOSTCC=gcc NOFORTRAN=1 TARGET=ARMV8 $BUILD_MAKE_OPTIONS
for i in ctest/x*; do
mv $i $i.exe
Expand Down
30 changes: 30 additions & 0 deletions .github/scripts/build-openssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

source `dirname $0`/config.sh

OPENSSL_BUILD_PATH=$BUILD_PATH/openssl

mkdir -p $OPENSSL_BUILD_PATH
cd $OPENSSL_BUILD_PATH

if [ $RUN_CONFIG = 1 ] || [ ! -f "$OPENSSL_BUILD_PATH/Makefile" ] ; then
echo "::group::Configure OpenSSL"
rm -rf $OPENSSL_BUILD_PATH/*
$SOURCE_PATH/$OPENSSL_VERSION/Configure \
--prefix=$OPENSSL_PATH \
--cross-compile-prefix=$TOOLCHAIN_PATH/bin/$TARGET- \
mingw-arm64
echo "::endgroup::"
fi

echo "::group::Build OpenSSL"
make $BUILD_MAKE_OPTIONS
echo "::endgroup::"

if [ $RUN_INSTALL = 1 ] ; then
echo "::group::Install OpenSSL"
make install
echo "::endgroup::"
fi

echo 'Success!'
16 changes: 16 additions & 0 deletions .github/scripts/config.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Set-PSDebug -Trace 2 # echo on

if ( -not $env:OPENBLAS_VERSION ) { $env:OPENBLAS_VERSION = "openblas-develop" }
if ( -not $env:OPENSSL_VERSION ) { $env:OPENSSL_VERSION = "openssl-master" }

if ( -not $env:TARGET ) { $env:TARGET = "aarch64-w64-mingw32" }
if ( -not $env:CRT ) { $env:CRT = "msvcrt" }
if ( -not $env:TOOLCHAIN_NAME ) { $env:TOOLCHAIN_NAME = "$TARGET-$CRT" }

if ( -not $env:SOURCE_PATH ) { $env:SOURCE_PATH= "$PWD\code" }
if ( -not $env:BUILD_PATH ) { $env:BUILD_PATH = "$PWD\build-$env:TOOLCHAIN_NAME" }
if ( -not $env:ARTIFACT_PATH ) { $env:ARTIFACT_PATH = "$PWD\artifact" }
if ( -not $env:PERL_PATH ) { $env:PERL_PATH = "C:\Strawberry\perl\bin" }

if ( -not $env:OPENBLAS_TESTS_PATH ) { $env:OPENBLAS_TESTS_PATH = "$PWD\openblas-tests" }
if ( -not $env:OPENSSL_TESTS_PATH ) { $env:OPENSSL_TESTS_PATH = "$PWD\openssl-tests" }
6 changes: 6 additions & 0 deletions .github/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@ set -x # echo on

GCC_VERSION=${GCC_VERSION:-gcc-master}
BINUTILS_VERSION=${BINUTILS_VERSION:-binutils-master}
OPENBLAS_VERSION=${OPENBLAS_VERSION:-openblas-develop}
OPENSSL_VERSION=${OPENSSL_VERSION:-openssl-master}

TARGET=${TARGET:-aarch64-w64-mingw32}
CRT=${CRT:-msvcrt}
TOOLCHAIN_NAME=${TOOLCHAIN_NAME:-$TARGET-$CRT}

SOURCE_PATH=${SOURCE_PATH:-$PWD/code}
BUILD_PATH=${BUILD_PATH:-$PWD/build-$TOOLCHAIN_NAME}
ARTIFACT_PATH=${ARTIFACT_PATH:-$PWD/artifact}
BUILD_MAKE_OPTIONS=${BUILD_MAKE_OPTIONS:-V=1 -j$(nproc)}
TOOLCHAIN_PATH=${TOOLCHAIN_PATH:-~/cross-$TOOLCHAIN_NAME}
TOOLCHAIN_FILE=${TOOLCHAIN_FILE:-$PWD/.github/cmake/$TARGET.cmake}
TOOLCHAIN_PACKAGE_NAME=${TOOLCHAIN_PACKAGE_NAME:-$TOOLCHAIN_NAME-toolchain.tar.gz}

OPENSSL_PATH=${OPENSSL_PATH:-~/openssl}
OPENSSL_TESTS_PATH=${OPENSSL_PATH:-~/openssl-tests}

RUN_CONFIG=${RUN_CONFIG:-1}
RUN_INSTALL=${RUN_INSTALL:-1}

Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/execute-openssl-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
. $PSScriptRoot\config.ps1

Write-Output '::group::Test OpenSSL'
$excluded_tests = @(
'-test_bio_comp' # binary is missing (needs compression support)
'-test_ec' # missing fipsmodule.cnf
'-test_ecparam' # missing fipsmodule.cnf
'-test_dhparam' # missing fipsmodule.cnf
'-test_tls13certcomp' # extensions count mismatch
'-test_ssl_new' # something about handshake failure
'-test_verify' # bad plan
)

$env:SRCTOP = "$env:SOURCE_PATH\$env:OPENSSL_VERSION"
$env:BLDTOP = "$env:OPENSSL_TESTS_PATH"
$env:LC_ALL = "C"

& $env:PERL_PATH\perl.exe $env:SRCTOP\test\run_tests.pl $excluded_tests
Write-Output "::endgroup::"
10 changes: 10 additions & 0 deletions .github/scripts/install-openssl-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

source `dirname $0`/config.sh

echo "::group::Install OpenSSL Dependencies"
sudo apt update
sudo apt install -y libtext-template-perl
echo "::endgroup::"

echo 'Success!'
9 changes: 6 additions & 3 deletions .github/scripts/pack-openblas-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

source `dirname $0`/config.sh

echo "::group::Pack OpenBLAS"
cd $SOURCE_PATH/OpenBLAS
zip $TOOLCHAIN_NAME-openblas-tests.zip ctest/x* ctest/cin* ctest/din* ctest/sin* ctest/zin*
OPENBLAS_BUILD_PATH=$SOURCE_PATH/$OPENBLAS_VERSION

echo "::group::Pack OpenBLAS tests"
mkdir -p $ARTIFACT_PATH
cd $OPENBLAS_BUILD_PATH
zip $ARTIFACT_PATH/$TOOLCHAIN_NAME-openblas-tests.zip ctest/x* ctest/cin* ctest/din* ctest/sin* ctest/zin*
echo "::endgroup::"

echo 'Success!'
13 changes: 13 additions & 0 deletions .github/scripts/pack-openssl-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

source `dirname $0`/config.sh

OPENSSL_BUILD_PATH=$BUILD_PATH/openssl

echo "::group::Pack OpenSSL tests"
mkdir -p $ARTIFACT_PATH
cd $OPENSSL_BUILD_PATH
zip -r $ARTIFACT_PATH/$TOOLCHAIN_NAME-openssl-tests.zip *
echo "::endgroup::"

echo 'Success!'
11 changes: 11 additions & 0 deletions .github/scripts/pack-openssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

source `dirname $0`/config.sh

echo "::group::Pack OpenSSL"
mkdir -p $ARTIFACT_PATH
cd $OPENSSL_PATH
zip -r $ARTIFACT_PATH/$TOOLCHAIN_NAME-openssl.zip *
echo "::endgroup::"

echo 'Success!'
3 changes: 2 additions & 1 deletion .github/scripts/pack-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
source `dirname $0`/config.sh

echo "::group::Pack toolchain"
tar czf $TOOLCHAIN_PACKAGE_NAME -C $TOOLCHAIN_PATH .
mkdir -p $ARTIFACT_PATH
tar czf $ARTIFACT_PATH/$TOOLCHAIN_PACKAGE_NAME -C $TOOLCHAIN_PATH .
echo "::endgroup::"

echo 'Success!'
4 changes: 3 additions & 1 deletion .github/scripts/unpack-openblas-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
. $PSScriptRoot\config.ps1

Remove-Item $env:OPENBLAS_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Expand-Archive -LiteralPath $env:TOOLCHAIN_NAME-openblas-tests.zip -DestinationPath $env:OPENBLAS_TESTS_PATH
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-openblas-tests.zip -DestinationPath $env:OPENBLAS_TESTS_PATH
4 changes: 4 additions & 0 deletions .github/scripts/unpack-openssl-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
. $PSScriptRoot\config.ps1

Remove-Item $env:OPENSSL_TESTS_PATH -Recurse -Force -ErrorAction Ignore
Expand-Archive -LiteralPath $env:ARTIFACT_PATH\$env:TOOLCHAIN_NAME-openssl-tests.zip -DestinationPath $env:OPENSSL_TESTS_PATH
2 changes: 1 addition & 1 deletion .github/scripts/unpack-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source `dirname $0`/config.sh

echo "::group::Unpack toolchain"
mkdir -p $TOOLCHAIN_PATH
tar xzf $TOOLCHAIN_PACKAGE_NAME -C $TOOLCHAIN_PATH
tar xzf $ARTIFACT_PATH/$TOOLCHAIN_PACKAGE_NAME -C $TOOLCHAIN_PATH
echo "::endgroup::"

echo 'Success!'
Loading

0 comments on commit a75fe4b

Please sign in to comment.