From ac5efed3a8a81322518b4896c29724db704a7209 Mon Sep 17 00:00:00 2001 From: native-api Date: Fri, 28 Jul 2023 15:23:39 +0300 Subject: [PATCH] Fix FreeBSD tests in MacOS CI (#2748) Guthub have recently preinstalled x64 Homebrew OpenSSL to stock MacOS runners. This has caused FreeBSD OpenSSL detection logic to erroneously trigger when running FreeBSD tests in MacOS because their paths happened to coincide. Replaced checking a specific path with checking with pkg. --- plugins/python-build/bin/python-build | 2 +- plugins/python-build/test/build.bats | 35 ++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 20b17342..7d0b2a16 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1420,7 +1420,7 @@ use_freebsd_pkg() { # check if FreeBSD if [ "FreeBSD" = "$(uname -s)" ]; then # use openssl if installed from Ports Collection - if [ -f /usr/local/include/openssl/ssl.h ]; then + if pkg info -e openssl; then package_option python configure --with-openssl="/usr/local" fi diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index 76a6b6a5..8a0dee1c 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -259,6 +259,38 @@ make install OUT } +@test "openssl is linked from Ports in FreeBSD if present" { + cached_tarball "Python-3.6.2" + + for i in {1..7}; do stub uname '-s : echo FreeBSD'; done + stub uname '-r : echo 11.0-RELEASE' + for i in {1..2}; do stub uname '-s : echo FreeBSD'; done + stub sysctl '-n hw.ncpu : echo 1' + + stub pkg "info -e openssl : true" + for in in {1..2}; do stub pkg false; done + + stub_make_install + + export -n MAKE_OPTS + run_inline_definition <