svn commit: r1934955 - in httpd/httpd/trunk/test: . pyhttpd

[email protected]
Newsgroups gmane.comp.apache.cvs
Message-ID <178053932580.2574297.7788023615780378499@svn03-he-fi>
Author: jim
Date: Thu Jun  4 02:15:25 2026
New Revision: 1934955

Log:
test: move runtests-pyhttpd.sh into pyhttpd/ as runtests.sh

  Move runtests-pyhttpd.sh from test/ to test/pyhttpd/runtests.sh
  to match the pytest_suite/runtests.sh naming convention.

  - Update internal paths: $here/pyhttpd/... -> $here/... since $here
    now resolves to test/pyhttpd/ itself.
  - Update run-all-tests.sh to call ./pyhttpd/runtests.sh.
  - Update README.pytest and .claude/settings.local.json references.

Added:
   httpd/httpd/trunk/test/pyhttpd/runtests.sh   (contents, props changed)
Deleted:
   httpd/httpd/trunk/test/runtests-pyhttpd.sh
Modified:
   httpd/httpd/trunk/test/README.pytest
   httpd/httpd/trunk/test/run-all-tests.sh

Modified: httpd/httpd/trunk/test/README.pytest
==============================================================================
--- httpd/httpd/trunk/test/README.pytest	Thu Jun  4 00:45:04 2026	(r1934954)
+++ httpd/httpd/trunk/test/README.pytest	Thu Jun  4 02:15:25 2026	(r1934955)
@@ -127,9 +127,9 @@ processes (an ACME test server).
 
 Infrastructure
 --------------
-The test cases rely on the classes provided in 'test/pyhttpd'
-for common code in managing a httpd test instance and do
-provide some base setups:
+The test cases rely on the classes provided in `test/pyhttpd/` (where
+`test/pyhttpd/runtests.sh` runs the suite) for common code in managing
+a httpd test instance and do provide some base setups:
 - a small set of virtual hosts with some files
 - access to paths and definitions (env fixture)
 - start/stop httpd and inspect the error log

Added: httpd/httpd/trunk/test/pyhttpd/runtests.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ httpd/httpd/trunk/test/pyhttpd/runtests.sh	Thu Jun  4 02:15:25 2026	(r1934955)
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# runtests.sh -- run the pyhttpd modules/ test suite.
+#
+# Manages a local .venv under pyhttpd/ so that pytest and the CGI helper scripts
+# (which httpd forks) both use the same Python with all required packages
+# (cryptography, python-multipart, websockets, etc.) available.
+#
+# Usage:
+#    ./runtests.sh                    # run all modules/ tests
+#    ./runtests.sh modules/http1      # run a specific suite
+#    ./runtests.sh -k post -v         # any pytest args pass through
+#
+# Environment:
+#   PYHTTPD_TARGETS  space-separated list of test paths (default: modules)
+#
+set -eu
+
+here="$(cd "$(dirname "$0")" && pwd)"
+
+PYTEST="$here/.venv/bin/pytest"
+if [ ! -x "$PYTEST" ]; then
+    if command -v uv >/dev/null 2>&1; then
+        echo "runtests.sh: .venv not found; running 'uv sync' to create it..." >&2
+        uv sync --project "$here"
+    elif command -v python3 >/dev/null 2>&1; then
+        echo "runtests.sh: .venv not found; creating with python3 + pip..." >&2
+        python3 -m venv "$here/.venv"
+         # Keep this list in sync with pyproject.toml [project].dependencies
+         "$here/.venv/bin/pip" install --quiet \
+             "pytest>=7.0" cryptography filelock "python-multipart" pyopenssl packaging websockets
+    else
+        echo "runtests.sh: ERROR: $PYTEST not found and neither 'uv' nor 'python3' is on PATH." >&2
+        exit 1
+    fi
+fi
+
+# Prepend the venv's bin dir so that CGI scripts forked by httpd also resolve
+# python3 to the venv's interpreter (which has all packages installed), and so
+# that any shim wrappers earlier on PATH are shadowed.
+export PATH="$here/.venv/bin:$PATH"
+
+targets="${PYHTTPD_TARGETS:-modules}"
+
+# shellcheck disable=SC2086
+echo "runtests.sh: $PYTEST $targets $*" >&2
+exec "$PYTEST" $targets "$@"

Modified: httpd/httpd/trunk/test/run-all-tests.sh
==============================================================================
--- httpd/httpd/trunk/test/run-all-tests.sh	Thu Jun  4 00:45:04 2026	(r1934954)
+++ httpd/httpd/trunk/test/run-all-tests.sh	Thu Jun  4 02:15:25 2026	(r1934955)
@@ -136,11 +136,11 @@ run_pyhttpd() {
         echo "  build httpd with its test config (configure) to run these." >&2
         return 0
     fi
-    # runtests-pyhttpd.sh manages the venv, prepends its bin/ to PATH (so CGI
+    # runtests.sh manages the venv, prepends its bin/ to PATH (so CGI
     # scripts forked by httpd also use the venv's Python), and runs pytest.
     # PYHTTPD_TARGETS can override which modules/ subdirs are run.
     # shellcheck disable=SC2086
-    ( cd "$here" && ./runtests-pyhttpd.sh $flags ) || return $?
+    ( cd "$here/pyhttpd" && ./runtests.sh $flags ) || return $?
 }
 
 case "$only" in
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.