Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/hooks-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Test Plugin

on:
workflow_dispatch:
pull_request:
push:
branches: [main]
Expand All @@ -25,3 +26,5 @@ jobs:
run: go run github.com/yuin/gopher-lua/cmd/glua@v1.1.1 tests/windows_test.lua
- name: Test macOS OpenSSL selection
run: bash tests/openssl_test.sh
- name: Test optional dependency diagnostics
run: bash tests/configure_options_test.sh
4 changes: 2 additions & 2 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ os_based_configure_options() {
if [ -n "$gmp_path" ]; then
configure_options="--with-gmp=$gmp_path"
else
echo "gmp not found, not including in installation"
echo "gmp not found, not including in installation" >&2
fi

if [ -n "$sodium_path" ]; then
configure_options="$configure_options --with-sodium=$sodium_path"
else
echo "sodium not found, not including in installation"
echo "sodium not found, not including in installation" >&2
fi

if [ -n "$freetype_path" ]; then
Expand Down
42 changes: 42 additions & 0 deletions tests/configure_options_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
source bin/install

# Optional dependency diagnostics must not become ./configure arguments.
uname() { echo Darwin; }
exit_if_homebrew_not_installed() { :; }
homebrew_package_path() {
case "$1" in
gmp) [[ "$with_gmp" == yes ]] && echo /fake/gmp ;;
libsodium) [[ "$with_sodium" == yes ]] && echo /fake/libsodium ;;
*) echo "/fake/$1" ;;
esac
return 0
}
PHP_VERSION=8.4.10
PHP_CONFIGURE_OPTIONS=
diagnostics=$(mktemp)
trap 'rm -f "$diagnostics"' EXIT
for with_gmp in yes no; do
for with_sodium in yes no; do
options=$(construct_configure_options /fake/php 2>"$diagnostics")
[[ "$options" != *'not found'* ]] || {
echo 'Dependency diagnostics leaked into configure arguments' >&2
exit 1
}
[[ "$options" == *'--prefix=/fake/php'* ]]
if [[ "$with_gmp" == yes ]]; then
[[ "$options" == *'--with-gmp=/fake/gmp'* ]]
else
[[ "$options" != *'--with-gmp='* ]]
grep -q 'gmp not found' "$diagnostics"
fi
if [[ "$with_sodium" == yes ]]; then
[[ "$options" == *'--with-sodium=/fake/libsodium'* ]]
else
[[ "$options" != *'--with-sodium='* ]]
grep -q 'sodium not found' "$diagnostics"
fi
done
done
echo 'Optional dependency diagnostics and configure arguments passed'
Loading