From: Jim Jagielski Date: Fri, 5 Jun 2026 20:08:05 +0000 (+0000) Subject: Picked up a small PERL pods regression - fixed X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=5ff0da1961ce4dc2f7b2c296892641ad5a73c44c;p=thirdparty%2Fapache%2Fhttpd.git Picked up a small PERL pods regression - fixed git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935051 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/pytest_suite/apache_pytest/config.py b/test/pytest_suite/apache_pytest/config.py index 16b4a0de7b..07939d3d23 100644 --- a/test/pytest_suite/apache_pytest/config.py +++ b/test/pytest_suite/apache_pytest/config.py @@ -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 diff --git a/test/pytest_suite/tests/t/filter/test_case.py b/test/pytest_suite/tests/t/filter/test_case.py index a68de8ea85..4b58aeb06a 100644 --- a/test/pytest_suite/tests/t/filter/test_case.py +++ b/test/pytest_suite/tests/t/filter/test_case.py @@ -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))