Skip to content

Commit

Permalink
Add test for building openssl on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jan 15, 2025
1 parent c7a51ea commit 8693c40
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion test/build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ make install
OUT
}

@test "install bundled OpenSSL" {
@test "install bundled OpenSSL on Linux" {
cached_tarball "openssl-1.1.1w" config
cached_tarball "ruby-3.2.0" configure

Expand Down Expand Up @@ -406,6 +406,46 @@ make install
OUT
}

@test "install bundled OpenSSL on macOS" {
cached_tarball "openssl-1.1.1w" config
cached_tarball "ruby-3.2.0" configure

mkdir -p "${TMP}/ssl/certs"
touch "${TMP}/ssl/cert.pem"

stub_repeated uname '-s : echo Darwin'
stub_repeated security echo
stub_repeated brew false
stub cc '-xc -E - : echo "OpenSSL 1.0.1a 1 Aug 2023"'
stub openssl "version -d : echo 'OPENSSLDIR: \"${TMP}/ssl\"'"
stub_make_install "install_sw"
stub_make_install

mkdir -p "$INSTALL_ROOT"/openssl/ssl # OPENSSLDIR
run_inline_definition <<DEF
install_package "openssl-1.1.1w" "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" openssl --if needs_openssl_102_300
install_package "ruby-3.2.0" "http://ruby-lang.org/ruby/2.0/ruby-3.2.0.tar.gz"
DEF
assert_success

unstub uname
unstub security
unstub brew
unstub cc
# unstub openssl
unstub make

# No rpath on macOS, OpenSSL sets it itself: https://wiki.openssl.org/index.php/Compilation_and_Installation#Using_RPATHs
assert_build_log <<OUT
openssl-1.1.1w: [--prefix=${INSTALL_ROOT}/openssl,--openssldir=${INSTALL_ROOT}/openssl/ssl,--libdir=lib,zlib-dynamic,no-ssl3,shared]
make -j 2
make install_sw install_ssldirs
ruby-3.2.0: [--prefix=$INSTALL_ROOT,--with-openssl-dir=$INSTALL_ROOT/openssl,--with-ext=openssl,psych,+] PKG_CONFIG_PATH=${TMP}/install/openssl/lib/pkgconfig
PKG_CONFIG_PATH=${TMP}/install/openssl/lib/pkgconfig make -j 2
make install
OUT
}

@test "skip bundling OpenSSL if custom openssl dir was specified" {
cached_tarball "ruby-3.2.0" configure

Expand Down

0 comments on commit 8693c40

Please sign in to comment.