]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Picked up a small PERL pods regression - fixed trunk trunk
authorJim Jagielski <jim@apache.org>
Fri, 5 Jun 2026 20:08:05 +0000 (20:08 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 5 Jun 2026 20:08:05 +0000 (20:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935051 13f79535-47bb-0310-9956-ffa450edef68

test/pytest_suite/apache_pytest/config.py
test/pytest_suite/tests/t/filter/test_case.py

index 16b4a0de7beb98e0c9dd3b9babe0a619f2cbb7db..07939d3d235ea3495ed8851d3dbb74d52d1f5c12 100644 (file)
@@ -30,6 +30,28 @@ from .probe import HttpdInfo
 
 DEFAULT_PORT = 8529
 
+
+def _find_perl_pods(perl: str) -> str:
+    """Locate perl's 'pods' directory, like Apache::TestConfig's
+    find_in_inc('pods') (TestConfig.pm:297): the first 'pods' dir under @INC.
+
+    Returns the absolute path, or "" if perl is unavailable or has no pods dir
+    (e.g. a perl without perl-doc installed). Used for the /getfiles-perl-pod
+    alias that t/filter/case.t downloads from.
+    """
+    if not perl:
+        return ""
+    import subprocess
+
+    code = "for (@INC){ if (-d qq($_/pods)){ print qq($_/pods); last } }"
+    try:
+        out = subprocess.run(
+            [perl, "-e", code], capture_output=True, text=True, timeout=10
+        ).stdout.strip()
+    except (OSError, subprocess.SubprocessError):
+        return ""
+    return out if out and Path(out).is_dir() else ""
+
 # @CGI_MODULE@ etc. -> first candidate that is actually loaded, else first candidate.
 # Mirrors the default_module() calls in TestConfig.pm:435-440.
 MODULE_NAME_CANDIDATES: dict[str, list[str]] = {
@@ -284,13 +306,16 @@ class TestConfig:
         v["serveradmin"] = f"unknown@{servername}"
         v["inherit_documentroot"] = v["documentroot"]
         # getfiles-* download aliases (see generate_httpd_conf %aliases). httpd
-        # is the probed binary; perl is whatever runs the helper scripts. perlpod
-        # is left empty (its alias is only emitted when the var is set).
+        # is the probed binary; perl is whatever runs the helper scripts.
         v["httpd"] = str(self.info.httpd)
         from shutil import which
 
         v["perl"] = which("perl") or ""
-        v["perlpod"] = ""
+        # perlpod: a 'pods' dir under @INC, like Perl's find_in_inc('pods')
+        # (TestConfig.pm:297). Drives the /getfiles-perl-pod alias that
+        # t/filter/case.t (mod_alias case) downloads from. Left "" if not found,
+        # in which case the alias is not emitted and that subtest skips.
+        v["perlpod"] = _find_perl_pods(v["perl"])
 
         # MPM tuning math (TestConfig.pm:331-373) with proxy off (no bump).
         tpc = 10
index a68de8ea85327e7a1802af93ce6625db0a9875ba..4b58aeb06afc1185a86214ced5994299fb178542 100644 (file)
@@ -46,4 +46,8 @@ def test_case_filter_root(http):
 def test_case_filter_module(http, module):
     if not http.have_module(module):
         pytest.skip(f"{module} not available")
+    # The mod_alias URL downloads from the /getfiles-perl-pod alias, which is
+    # only generated when perl's 'pods' dir was found (perl-doc installed).
+    if module == "mod_alias" and not http.vars("perlpod"):
+        pytest.skip("no perl 'pods' dir (perl-doc) for the getfiles-perl-pod alias")
     _verify(http.GET(URLS[module], headers=FILTER))