From 50d1ed4b056185c6722c5ee41b33e70c62bb786b Mon Sep 17 00:00:00 2001 From: Optio Agent Date: Sat, 28 Mar 2026 03:25:58 +0000 Subject: [PATCH] chore(test): override curlinfo to report urlx capabilities (unskip test 777) curl's curlinfo binary reflects curl's build configuration, not urlx's. When curl is built without ssl-sessions support, the test harness skips test 777 even though urlx supports ssl-sessions. Add a curlinfo-urlx wrapper script that: - When a real curlinfo exists, runs it and patches ssl-sessions to ON - When no curlinfo exists, outputs a complete feature list matching urlx's capabilities Update run-curl-tests.sh to install the wrapper in place of curl's curlinfo binary, following the same pattern used for libtests-shim. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/curlinfo-urlx | 68 +++++++++++++++++++++++++++++++++++++++ scripts/run-curl-tests.sh | 29 +++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100755 scripts/curlinfo-urlx diff --git a/scripts/curlinfo-urlx b/scripts/curlinfo-urlx new file mode 100755 index 0000000..96ca3dd --- /dev/null +++ b/scripts/curlinfo-urlx @@ -0,0 +1,68 @@ +#!/bin/bash +# Wrapper around curl's curlinfo binary that overrides feature flags +# to reflect urlx's actual capabilities. +# +# curl's test harness (runtests.pl) runs curlinfo to detect which features +# are available. Since curlinfo comes from curl's own build, it reflects +# curl's build configuration — not urlx's capabilities. This wrapper runs +# the real curlinfo and patches the output so that features urlx supports +# (but curl wasn't built with) are reported as ON. +# +# Installed by run-curl-tests.sh in place of vendor/curl-build/src/curlinfo. + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# The real curlinfo binary (moved aside by run-curl-tests.sh) +REAL_CURLINFO="${CURLINFO_REAL:-}" + +# Features that urlx supports regardless of curl's build configuration. +# Add entries here as urlx gains features that curl may not be built with. +URLX_FEATURES_ON=( + "ssl-sessions" +) + +# Run the real curlinfo and patch the output +if [ -n "$REAL_CURLINFO" ] && [ -x "$REAL_CURLINFO" ]; then + # Build a sed expression that overrides each feature to ON + sed_args=() + for feat in "${URLX_FEATURES_ON[@]}"; do + sed_args+=(-e "s/^${feat}: OFF$/${feat}: ON/") + done + "$REAL_CURLINFO" | sed "${sed_args[@]}" +else + # No real curlinfo available — output a complete feature list based on + # urlx's known capabilities. This matches the format of curlinfo.c output. + cat <<'EOF' +bindlocal: ON +cookies: ON +basic-auth: ON +bearer-auth: ON +digest: ON +negotiate-auth: ON +aws: ON +DoH: ON +HTTP-auth: ON +Mime: ON +netrc: ON +parsedate: ON +proxy: ON +shuffle-dns: ON +typecheck: ON +verbose-strings: ON +wakeup: ON +headers-api: ON +xattr: OFF +form-api: ON +large-time: ON +large-size: ON +sha512-256: ON +win32-ca-searchpath: OFF +win32-ca-search-safe: OFF +--libcurl: ON +override-dns: OFF +ssl-sessions: ON +cert-status: OFF +EOF +fi diff --git a/scripts/run-curl-tests.sh b/scripts/run-curl-tests.sh index 89aa9b1..b8e5496 100755 --- a/scripts/run-curl-tests.sh +++ b/scripts/run-curl-tests.sh @@ -70,6 +70,35 @@ elif [ ! -x "$LIBTESTS" ] && [ ! -f "$LIBTESTS_REAL" ]; then echo "Installed libtests-shim for C API tests (e.g., test 678)" fi +# Override curlinfo to report urlx's actual capabilities. +# +# curl's curlinfo binary reflects curl's build configuration, not urlx's. +# For example, curl may be built without ssl-sessions support, causing the +# test harness to skip test 777 even though urlx supports ssl-sessions. +# We replace curlinfo with a wrapper that patches the output. +CURLINFO_BIN="$CURL_BUILD/src/curlinfo" +CURLINFO_REAL="$CURL_BUILD/src/curlinfo.real" +CURLINFO_WRAPPER="$SCRIPT_DIR/curlinfo-urlx" + +if [ -x "$CURLINFO_BIN" ] && [ ! -f "$CURLINFO_REAL" ]; then + # Move the real binary aside and install our wrapper + mv "$CURLINFO_BIN" "$CURLINFO_REAL" + cat > "$CURLINFO_BIN" < "$CURLINFO_BIN" <