From 6e60401ae897b38a764cbb0a31abd07e618b27d0 Mon Sep 17 00:00:00 2001 From: Optio Agent Date: Sat, 28 Mar 2026 03:06:51 +0000 Subject: [PATCH] chore(test): add urlx-curlinfo wrapper to unskip test 777 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The curl test harness uses the curlinfo binary to detect compile-time features. Since curlinfo comes from curl's build, it reports curl's configuration — not urlx's capabilities. This caused test 777 (--ssl-sessions with weird sessions in file) to be skipped because curl wasn't built with USE_SSLS_EXPORT, even though urlx fully supports ssl-sessions (closed in #73). Add scripts/urlx-curlinfo that: - When the original curlinfo exists, wraps it and overrides ssl-sessions from OFF to ON - When no original curlinfo exists, outputs a standalone feature list reflecting urlx's actual capabilities Modify scripts/run-curl-tests.sh to install the urlx-curlinfo wrapper at the expected path before running the test suite, following the same pattern used for the libtests shim. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/run-curl-tests.sh | 20 +++++++++++++++ scripts/urlx-curlinfo | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100755 scripts/urlx-curlinfo diff --git a/scripts/run-curl-tests.sh b/scripts/run-curl-tests.sh index 89aa9b1..ee20d0b 100755 --- a/scripts/run-curl-tests.sh +++ b/scripts/run-curl-tests.sh @@ -52,6 +52,9 @@ FFI_LIB="$PROJECT_ROOT/target/release/libliburlx_ffi.so" LIBTESTS="$CURL_BUILD/tests/libtest/libtests" LIBTESTS_REAL="$CURL_BUILD/tests/libtest/libtests.real" LIBTESTS_SHIM="$SCRIPT_DIR/libtests-shim" +URLX_CURLINFO="$SCRIPT_DIR/urlx-curlinfo" +CURLINFO_BIN="$CURL_BUILD/src/curlinfo" +CURLINFO_REAL="$CURL_BUILD/src/curlinfo.real" if [ -f "$FFI_LIB" ] && [ -x "$LIBTESTS" ] && [ ! -f "$LIBTESTS_REAL" ]; then # LD_PRELOAD approach: override curl_easy_* symbols with our FFI @@ -70,6 +73,23 @@ elif [ ! -x "$LIBTESTS" ] && [ ! -f "$LIBTESTS_REAL" ]; then echo "Installed libtests-shim for C API tests (e.g., test 678)" fi +# Replace curlinfo with urlx-aware version. +# curl's curlinfo binary reports curl's compile-time features, not urlx's. +# Our wrapper overrides features that urlx supports (e.g., ssl-sessions). +if [ -x "$CURLINFO_BIN" ] && [ ! -f "$CURLINFO_REAL" ]; then + # Preserve the original curlinfo so the wrapper can delegate to it + mv "$CURLINFO_BIN" "$CURLINFO_REAL" + cp "$URLX_CURLINFO" "$CURLINFO_BIN" + chmod +x "$CURLINFO_BIN" + echo "Installed urlx-curlinfo wrapper (original saved as curlinfo.real)" +elif [ ! -x "$CURLINFO_BIN" ] && [ ! -f "$CURLINFO_REAL" ]; then + # curlinfo was never built; install our standalone version + mkdir -p "$CURL_BUILD/src" + cp "$URLX_CURLINFO" "$CURLINFO_BIN" + chmod +x "$CURLINFO_BIN" + echo "Installed urlx-curlinfo (no original curlinfo found)" +fi + # Ensure symlinks are in place cd "$TESTS_DIR" [ ! -e data ] && ln -sf "$CURL_SRC/tests/data" data diff --git a/scripts/urlx-curlinfo b/scripts/urlx-curlinfo new file mode 100755 index 0000000..5addb0a --- /dev/null +++ b/scripts/urlx-curlinfo @@ -0,0 +1,54 @@ +#!/bin/bash +# Wrapper around curl's curlinfo binary that overrides feature detection +# to reflect urlx's actual capabilities. +# +# The curl test harness uses curlinfo to detect compile-time features. +# Since curlinfo comes from curl's build (not urlx), it reflects curl's +# configuration. This wrapper runs the real curlinfo and overrides +# features that urlx supports but curl may not be built with. +# +# Currently overridden: +# ssl-sessions: ON (urlx implements ssl-sessions, see issue #73) + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +REAL_CURLINFO="$PROJECT_ROOT/vendor/curl-build/src/curlinfo.real" + +# If the real curlinfo exists, run it and override specific features +if [ -x "$REAL_CURLINFO" ]; then + "$REAL_CURLINFO" | sed 's/^ssl-sessions: OFF$/ssl-sessions: ON/' +else + # Fallback: output a complete feature list based on urlx's capabilities. + # This matches the format expected by runtests.pl (see curlinfo.c). + cat <<'EOF' +bindlocal: ON +cookies: ON +basic-auth: ON +bearer-auth: ON +digest: ON +negotiate-auth: OFF +aws: ON +DoH: ON +HTTP-auth: ON +Mime: ON +netrc: ON +parsedate: ON +proxy: ON +shuffle-dns: ON +typecheck: OFF +verbose-strings: ON +wakeup: ON +headers-api: ON +xattr: OFF +form-api: ON +large-time: ON +large-size: ON +sha512-256: OFF +win32-ca-searchpath: OFF +win32-ca-search-safe: OFF +--libcurl: OFF +override-dns: OFF +ssl-sessions: ON +cert-status: OFF +EOF +fi