Validate local Guile fix on FreeBSD
This commit is contained in:
@@ -10,15 +10,32 @@ if [ ! -d "$guix_source_dir/guix" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v guile3 >/dev/null 2>&1; then
|
||||
if [ -n "${GUILE_BIN:-}" ]; then
|
||||
guile_bin=$GUILE_BIN
|
||||
elif command -v guile3 >/dev/null 2>&1; then
|
||||
guile_bin=$(command -v guile3)
|
||||
elif command -v guile-3.0 >/dev/null 2>&1; then
|
||||
guile_bin=$(command -v guile-3.0)
|
||||
else
|
||||
echo "Unable to find guile3 or guile-3.0 in PATH" >&2
|
||||
echo "Unable to find GUILE_BIN, guile3, or guile-3.0 in PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$guile_bin" ]; then
|
||||
echo "Guile binary is not executable: $guile_bin" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
guile_prefix=$(CDPATH= cd -- "$(dirname "$guile_bin")/.." && pwd)
|
||||
guile_lib_dir=$guile_prefix/lib
|
||||
if [ -e "$guile_lib_dir/libguile-3.0.so.1" ]; then
|
||||
if [ -n "${LD_LIBRARY_PATH:-}" ]; then
|
||||
export LD_LIBRARY_PATH="$guile_lib_dir:$LD_LIBRARY_PATH"
|
||||
else
|
||||
export LD_LIBRARY_PATH="$guile_lib_dir"
|
||||
fi
|
||||
fi
|
||||
|
||||
export GUIX_SOURCE_DIR="$guix_source_dir"
|
||||
export GUILE_AUTO_COMPILE=${GUILE_AUTO_COMPILE:-0}
|
||||
if [ -n "${GUILE_LOAD_PATH:-}" ]; then
|
||||
@@ -27,4 +44,6 @@ else
|
||||
export GUILE_LOAD_PATH="$repo_root/tests/guile/modules:$guix_source_dir"
|
||||
fi
|
||||
|
||||
echo "Using Guile: $guile_bin" >&2
|
||||
echo "Using LD_LIBRARY_PATH: ${LD_LIBRARY_PATH:-<unset>}" >&2
|
||||
exec "$guile_bin" -s "$repo_root/tests/guile/verify-phase1.scm" "$@"
|
||||
|
||||
@@ -6,23 +6,44 @@ repo_root=$(CDPATH= cd -- "$script_dir/../.." && pwd)
|
||||
workdir=$(mktemp -d /tmp/fruix-guile-subprocess.XXXXXX)
|
||||
trap 'rm -rf "$workdir"' EXIT INT TERM
|
||||
|
||||
if command -v guile3 >/dev/null 2>&1; then
|
||||
if [ -n "${GUILE_BIN:-}" ]; then
|
||||
guile_bin=$GUILE_BIN
|
||||
elif command -v guile3 >/dev/null 2>&1; then
|
||||
guile_bin=$(command -v guile3)
|
||||
elif command -v guile-3.0 >/dev/null 2>&1; then
|
||||
guile_bin=$(command -v guile-3.0)
|
||||
else
|
||||
echo "Unable to find guile3 or guile-3.0 in PATH" >&2
|
||||
echo "Unable to find GUILE_BIN, guile3, or guile-3.0 in PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x "$guile_bin" ]; then
|
||||
echo "Guile binary is not executable: $guile_bin" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
guile_prefix=$(CDPATH= cd -- "$(dirname "$guile_bin")/.." && pwd)
|
||||
guile_lib_dir=$guile_prefix/lib
|
||||
if [ -e "$guile_lib_dir/libguile-3.0.so.1" ]; then
|
||||
if [ -n "${LD_LIBRARY_PATH:-}" ]; then
|
||||
export LD_LIBRARY_PATH="$guile_lib_dir:$LD_LIBRARY_PATH"
|
||||
else
|
||||
export LD_LIBRARY_PATH="$guile_lib_dir"
|
||||
fi
|
||||
fi
|
||||
|
||||
ulimit -c 0 || true
|
||||
|
||||
cc -Wall -Wextra -O2 "$repo_root/tests/guile/posix-spawn-freebsd-diagnostics.c" \
|
||||
-o "$workdir/posix-spawn-freebsd-diagnostics"
|
||||
|
||||
printf 'Using Guile: %s\n' "$guile_bin"
|
||||
printf 'Using LD_LIBRARY_PATH: %s\n' "${LD_LIBRARY_PATH:-<unset>}"
|
||||
printf '== Native posix_spawn diagnostics ==\n'
|
||||
"$workdir/posix-spawn-freebsd-diagnostics"
|
||||
|
||||
expect_crash=${EXPECT_GUILE_SUBPROCESS_CRASH:-1}
|
||||
|
||||
run_guile_case() {
|
||||
name=$1
|
||||
code=$2
|
||||
@@ -31,12 +52,24 @@ run_guile_case() {
|
||||
rc=$?
|
||||
set -e
|
||||
printf '%s exit=%s\n' "$name" "$rc"
|
||||
[ "$rc" -eq 139 ]
|
||||
if [ "$expect_crash" -eq 1 ]; then
|
||||
[ "$rc" -eq 139 ]
|
||||
else
|
||||
[ "$rc" -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
printf '== Guile subprocess crash repro ==\n'
|
||||
if [ "$expect_crash" -eq 1 ]; then
|
||||
printf '== Guile subprocess crash repro ==\n'
|
||||
else
|
||||
printf '== Guile subprocess validation (expect success) ==\n'
|
||||
fi
|
||||
run_guile_case system-star '(system* "/usr/bin/true")'
|
||||
run_guile_case spawn '(spawn "/usr/bin/true" (list "/usr/bin/true"))'
|
||||
run_guile_case open-pipe-star '(use-modules (ice-9 popen)) (open-pipe* OPEN_READ "/usr/bin/true")'
|
||||
|
||||
printf 'known FreeBSD Guile subprocess crash profile reproduced\n'
|
||||
if [ "$expect_crash" -eq 1 ]; then
|
||||
printf 'known FreeBSD Guile subprocess crash profile reproduced\n'
|
||||
else
|
||||
printf 'Guile subprocess helpers succeeded as expected\n'
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user