svn commit: r1937130 - in httpd/httpd/trunk/test/pytest_suite: . apache_pytest t/conf tests tests/t/apache tests/t/modules

[email protected]
Newsgroups gmane.comp.apache.cvs
Message-ID <178672922350.1962501.4268024628472552168@svn03-he-fi>
Author: jfclere
Date: Fri Aug 14 17:40:23 2026
New Revision: 1937130

Log:
Arrange to pass more tests on windows.

Modified:
   httpd/httpd/trunk/test/pytest_suite/apache_pytest/config.py
   httpd/httpd/trunk/test/pytest_suite/conftest.py
   httpd/httpd/trunk/test/pytest_suite/t/conf/core.conf.in
   httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_acceptpathinfo.py
   httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_mmn.py
   httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_ratelimit.py
   httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_substitute.py
   httpd/httpd/trunk/test/pytest_suite/tests/test_framework_smoke.py

Modified: httpd/httpd/trunk/test/pytest_suite/apache_pytest/config.py
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/apache_pytest/config.py	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/apache_pytest/config.py	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -588,7 +588,7 @@ class TestConfig:
             var = self._GETFILES_ALIASES[label]
             val = self.vars.get(var)
             if val:
-                lines.append(f"    Alias /getfiles-{label} {val}")
+                lines.append(f'    Alias /getfiles-{label} "{val}"')
         lines.append("</IfModule>")
         return "\n".join(lines)
 
@@ -845,8 +845,10 @@ class TestConfig:
             # Register the module in the modules set so <VirtualHost mod_X>
             # rewriting recognizes it (TestConfigC.pm:308 $self->{modules}{$cname}=1).
             self.info.modules.add(f"mod_{sym}.c")
-            # so is <src_dir>/.libs/mod_<sym>.so; source is <src_dir>/mod_<sym>.c
+            # so is <src_dir>/.libs/mod_<sym>.so (apxs) or <prefix>/modules/ (CMake).
             c_source = so.parent.parent / f"mod_{sym}.c"
+            if not c_source.is_file():
+                c_source = Path(self.vars["top_dir"]) / "c-modules" / sym / f"mod_{sym}.c"
             if c_source.is_file():
                 self.add_module_config(c_source, cmodule_args)
         if cmodule_args:

Modified: httpd/httpd/trunk/test/pytest_suite/conftest.py
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/conftest.py	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/conftest.py	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -168,13 +168,11 @@ def _probed_info(config: pytest.Config)
     # fixture, so need_module("authany") etc. should be satisfied at collection
     # time too. Augment the probed set with the C modules that WILL be built
     # (honoring the same HTTPD_TEST_REQUIRE_APACHE gating discover() applies).
-    # Without apxs the modules can't be compiled, so don't promise them.
-    if _apxs is not None:
-        from apache_pytest.cmodules import discover
+    from apache_pytest.cmodules import discover
 
-        cmods, _skipped = discover(REPO_ROOT / "c-modules", info)
-        for mod in cmods:
-            info.modules.add(f"mod_{mod.name}.c")
+    cmods, _skipped = discover(REPO_ROOT / "c-modules", info)
+    for mod in cmods:
+        info.modules.add(f"mod_{mod.name}.c")
     _probe_cache = info
     return _probe_cache
 
@@ -263,6 +261,14 @@ def framework(request: pytest.FixtureReq
         cmodule_loads, _skipped = compile_all(
             cmodules_dir, apxs, info, defines=["APACHE2", "APACHE2_4", *defines]
         )
+    else:
+        from apache_pytest.cmodules import discover
+        modules_dir = (install_prefix / "modules") if install_prefix else httpd.parent
+        cmods, _skipped = discover(REPO_ROOT / "c-modules", info)
+        for mod in cmods:
+            so = modules_dir / f"mod_{mod.name}.so"
+            if so.exists():
+                cmodule_loads.append((mod.symbol, so))
 
     config.generate(cmodule_loads=cmodule_loads)
 

Modified: httpd/httpd/trunk/test/pytest_suite/t/conf/core.conf.in
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/t/conf/core.conf.in	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/t/conf/core.conf.in	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -4,6 +4,11 @@
 
 MaxMemFree 1
 
+<VirtualHost righthost:core>
+      ServerName righthost
+      ServerAlias Righthost 128.0.0.1
+</VirtualHost>
+
 <VirtualHost strict-default:core>
       ServerName default-strict
       <IfVersion >= 2.4.49>

Modified: httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_acceptpathinfo.py
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_acceptpathinfo.py	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_acceptpathinfo.py	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -59,9 +59,10 @@ def _cases(http):
 
 @need_module("include")
 @need_lwp()
[email protected](sys.platform == "win32", reason="uses shell CGI scripts")
 def test_acceptpathinfo(http):
     for mode, req, exp_rc, exp_body in _cases(http):
+        if "/test.sh" in req and sys.platform == "win32":
+            continue
         # Apache::TestRequest's GET follows redirects by default; the bare
         # directory request 301-redirects to add a trailing slash before the
         # index.shtml (which echoes PATH_INFO) is served.

Modified: httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_mmn.py
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_mmn.py	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/tests/t/apache/test_mmn.py	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -20,11 +20,14 @@ _MINOR = re.compile(r"^#define\s+MODULE_
 @need_min_apache_version("2")
 def test_mmn(http):
     incdir = http.apxs("INCLUDEDIR")
-    if not incdir:
-        pytest.skip("apxs INCLUDEDIR unavailable")
-    filename = os.path.join(incdir, "ap_mmn.h")
-    if not os.path.isfile(filename):
-        pytest.skip(f"can't read {filename}")
+    filename = os.path.join(incdir, "ap_mmn.h") if incdir else None
+    if not filename or not os.path.isfile(filename):
+        # Fall back to the source tree include/ directory.
+        src_inc = os.path.join(http.vars("top_dir"), "..", "..", "include", "ap_mmn.h")
+        if os.path.isfile(src_inc):
+            filename = src_inc
+        else:
+            pytest.skip("ap_mmn.h not found (no apxs and not in source tree)")
 
     cmajor = cminor = major = minor = None
     with open(filename) as fh:

Modified: httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_ratelimit.py
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_ratelimit.py	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_ratelimit.py	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -17,17 +17,15 @@ import pytest
 from apache_pytest import need_min_apache_version, need_module, t_cmp
 
 CASES = [
-    ("/apache/ratelimit/", 200, "ratelimited small file", False),
-    ("/apache/ratelimit/autoindex/", 200, "ratelimited small autoindex output", False),
-    ("/apache/ratelimit/chunk?0,8192", 200, "ratelimited chunked response", True),
+    ("/apache/ratelimit/", 200, "ratelimited small file"),
+    ("/apache/ratelimit/autoindex/", 200, "ratelimited small autoindex output"),
+    ("/apache/ratelimit/chunk?0,8192", 200, "ratelimited chunked response"),
 ]
 
 
 @need_module("ratelimit", "autoindex")
 @need_min_apache_version("2.4.35")
[email protected]("url,code,desc,needs_cmod", CASES, ids=[c[2] for c in CASES])
-def test_ratelimit(http, url, code, desc, needs_cmod):
-    if needs_cmod and not http.have_module("random_chunk"):
-        pytest.skip("random_chunk C test module not available")
[email protected]("url,code,desc", CASES, ids=[c[2] for c in CASES])
+def test_ratelimit(http, url, code, desc):
     r = http.GET(url)
     assert t_cmp(r.status_code, code), desc

Modified: httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_substitute.py
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_substitute.py	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/tests/t/modules/test_substitute.py	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -68,16 +68,16 @@ def _docroot_file(http, *parts):
 
 
 def _write_testfile(http, content):
-    with open(_docroot_file(http, "test.txt"), "w") as f:
-        f.write(content)
+    with open(_docroot_file(http, "test.txt"), "wb") as f:
+        f.write(content.encode("utf-8"))
 
 
 def _write_htaccess(http, rules):
     content = "SetOutputFilter BUCKETEER;SUBSTITUTE\n"
     for rule in rules:
         content += f"Substitute {rule}\n"
-    with open(_docroot_file(http, ".htaccess"), "w") as f:
-        f.write(content)
+    with open(_docroot_file(http, ".htaccess"), "wb") as f:
+        f.write(content.encode("utf-8"))
 
 
 def _httpd_rule_to_python(content, rule):

Modified: httpd/httpd/trunk/test/pytest_suite/tests/test_framework_smoke.py
==============================================================================
--- httpd/httpd/trunk/test/pytest_suite/tests/test_framework_smoke.py	Fri Aug 14 17:34:58 2026	(r1937129)
+++ httpd/httpd/trunk/test/pytest_suite/tests/test_framework_smoke.py	Fri Aug 14 17:40:23 2026	(r1937130)
@@ -39,8 +39,8 @@ def test_cmodule_compiled_and_loaded(con
         config.vars["t_conf_file"]
         and open(config.vars["t_conf_file"]).read()  # noqa: SIM115
     )
-    if "LoadModule echo_post_module" not in conf_text:
-        pytest.skip("C test modules not compiled (no --apxs)")
+    assert "LoadModule echo_post_module" in conf_text
+    # echo_post.c registers the echo_post handler; the module is now in scope.
     assert config.info.has_module("mod_echo_post") or "echo_post" in conf_text
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.