Skip to content
Closed
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
20 changes: 20 additions & 0 deletions scripts/run-curl-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
54 changes: 54 additions & 0 deletions scripts/urlx-curlinfo
Original file line number Diff line number Diff line change
@@ -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
Loading