You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2021/09/23 09:53:01 UTC

svn commit: r1893546 - in /httpd/httpd/branches/2.4.x: ./ test/ test/modules/ test/modules/http2/ test/modules/http2/conf/

Author: icing
Date: Thu Sep 23 09:53:01 2021
New Revision: 1893546

URL: http://svn.apache.org/viewvc?rev=1893546&view=rev
Log:
 * merging test/modules from trunk


Added:
    httpd/httpd/branches/2.4.x/test/modules/
      - copied from r1892476, httpd/httpd/trunk/test/modules/
Removed:
    httpd/httpd/branches/2.4.x/test/modules/http2/conf/modules.conf.template
Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/test/   (props changed)
    httpd/httpd/branches/2.4.x/test/modules/http2/config.ini.in
    httpd/httpd/branches/2.4.x/test/modules/http2/h2_certs.py
    httpd/httpd/branches/2.4.x/test/modules/http2/h2_env.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1892476,1892543,1892545,1892598,1892615,1893306

Propchange: httpd/httpd/branches/2.4.x/test/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Sep 23 09:53:01 2021
@@ -18,4 +18,3 @@ sni
 httpdunit
 httpdunit.cases
 .pytest_cache
-perl-framework

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/config.ini.in
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/config.ini.in?rev=1893546&r1=1892476&r2=1893546&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/config.ini.in (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/config.ini.in Thu Sep 23 09:53:01 2021
@@ -11,10 +11,8 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 
 apr_bindir = @APR_BINDIR@
-apxs = @APR_BINDIR@/apxs
+apxs = @bindir@/apxs
 apachectl = @sbindir@/apachectl
-mpm_modules = @MPM_MODULES@
-enabled_mpm_module = @ENABLED_MPM_MODULE@
 dso_modules = @DSO_MODULES@
 
 [httpd]

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/h2_certs.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/h2_certs.py?rev=1893546&r1=1892476&r2=1893546&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/h2_certs.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/h2_certs.py Thu Sep 23 09:53:01 2021
@@ -15,9 +15,6 @@ from cryptography.x509 import ExtendedKe
 
 EC_SUPPORTED = {}
 EC_SUPPORTED.update([(curve.name.upper(), curve) for curve in [
-    ec.BrainpoolP256R1,
-    ec.BrainpoolP384R1,
-    ec.BrainpoolP512R1,
     ec.SECP192R1,
     ec.SECP224R1,
     ec.SECP256R1,

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/h2_env.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/h2_env.py?rev=1893546&r1=1892476&r2=1893546&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/h2_env.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/h2_env.py Thu Sep 23 09:53:01 2021
@@ -30,6 +30,46 @@ class Dummy:
 
 class H2TestSetup:
 
+    # the modules we want to load
+    MODULES = [
+        "log_config",
+        "logio",
+        "unixd",
+        "version",
+        "watchdog",
+        "authn_core",
+        "authz_host",
+        "authz_groupfile",
+        "authz_user",
+        "authz_core",
+        "access_compat",
+        "auth_basic",
+        "cache",
+        "cache_disk",
+        "cache_socache",
+        "socache_shmcb",
+        "dumpio",
+        "reqtimeout",
+        "filter",
+        "mime",
+        "env",
+        "headers",
+        "setenvif",
+        "slotmem_shm",
+        "ssl",
+        "status",
+        "autoindex",
+        "cgid",
+        "dir",
+        "alias",
+        "rewrite",
+        "deflate",
+        "proxy",
+        "proxy_http",
+        "proxy_balancer",
+        "proxy_hcheck",
+    ]
+
     def __init__(self, env: 'H2TestEnv'):
         self.env = env
 
@@ -38,6 +78,7 @@ class H2TestSetup:
         self._make_conf()
         self._make_htdocs()
         self._make_h2test()
+        self._make_modules_conf()
 
     def _make_dirs(self):
         if os.path.exists(self.env.gen_dir):
@@ -86,6 +127,19 @@ class H2TestSetup:
                        capture_output=True, check=True,
                        cwd=os.path.join(self.env.test_dir, 'mod_h2test'))
 
+    def _make_modules_conf(self):
+        modules_conf = os.path.join(self.env.server_dir, 'conf/modules.conf')
+        with open(modules_conf, 'w') as fd:
+            # issue load directives for all modules we want that are shared
+            for m in self.MODULES:
+                mod_path = os.path.join(self.env.libexec_dir, f"mod_{m}.so")
+                if os.path.isfile(mod_path):
+                    fd.write(f"LoadModule {m}_module   \"{mod_path}\"\n")
+            for m in ["http2", "proxy_http2"]:
+                fd.write(f"LoadModule {m}_module   \"{self.env.libexec_dir}/mod_{m}.so\"\n")
+            # load our test module which is not installed
+            fd.write(f"LoadModule h2test_module   \"{self.env.test_dir}/mod_h2test/.libs/mod_h2test.so\"\n")
+
 
 class H2TestEnv:
 
@@ -110,11 +164,13 @@ class H2TestEnv:
         self._test_dir = self.config.get('test', 'test_dir')
         self._test_src_dir = self.config.get('test', 'test_src_dir')
         self._gen_dir = self.config.get('test', 'gen_dir')
-        self._server_dir = self.config.get('test', 'server_dir')
+        self._server_dir = os.path.join(self._gen_dir, 'apache')
         self._server_conf_dir = os.path.join(self._server_dir, "conf")
         self._server_docs_dir = os.path.join(self._server_dir, "htdocs")
         self._server_logs_dir = os.path.join(self.server_dir, "logs")
         self._server_error_log = os.path.join(self._server_logs_dir, "error_log")
+
+        self._dso_modules = self.config.get('global', 'dso_modules').split(' ')
         self._domains = [
             f"test1.{self._http_tld}",
             f"test2.{self._http_tld}",
@@ -229,6 +285,10 @@ class H2TestEnv:
         return self._libexec_dir
 
     @property
+    def dso_modules(self) -> List[str]:
+        return self._dso_modules
+
+    @property
     def server_conf_dir(self) -> str:
         return self._server_conf_dir
 
@@ -335,16 +395,14 @@ class H2TestEnv:
         while datetime.now() < try_until:
             try:
                 req = requests.Request('HEAD', url).prepare()
-                s.send(req, verify=self._verify_certs, timeout=timeout)
+                s.send(req, verify=self._verify_certs, timeout=int(timeout.total_seconds()))
                 time.sleep(.2)
-            except IOError:
-                return True
-            except:
+            except IOError as ex:
                 return True
         log.debug("Server still responding after %d sec", timeout)
         return False
 
-    def apachectl(self, cmd, check_live=True):
+    def _run_apachectl(self, cmd):
         args = [self._apachectl,
                 "-d", self.server_dir,
                 "-f", os.path.join(self._server_dir, 'conf/httpd.conf'),
@@ -352,25 +410,32 @@ class H2TestEnv:
         log.debug("execute: %s", " ".join(args))
         p = subprocess.run(args, capture_output=True, text=True)
         rv = p.returncode
+        if rv != 0:
+            log.warning(f"exit {rv}, stdout: {p.stdout}, stderr: {p.stderr}")
+        return rv
+
+    def apache_reload(self):
+        rv = self._run_apachectl("graceful")
         if rv == 0:
             timeout = timedelta(seconds=10)
-            if check_live:
-                rv = 0 if self.is_live(self._http_base, timeout=timeout) else -1
-            else:
-                rv = 0 if self.is_dead(self._http_base, timeout=timeout) else -1
-                log.debug("waited for a apache.is_dead, rv=%d", rv)
-        else:
-            log.warning(f"exit {rv}, stdout: {p.stdout}, stderr: {p.stderr}")
+            rv = 0 if self.is_live(self._http_base, timeout=timeout) else -1
         return rv
 
     def apache_restart(self):
-        return self.apachectl("graceful")
+        rv = self.apache_stop()
+        rv = self._run_apachectl("start")
+        if rv == 0:
+            timeout = timedelta(seconds=10)
+            rv = 0 if self.is_live(self._http_base, timeout=timeout) else -1
+        return rv
         
-    def apache_start(self):
-        return self.apachectl("start")
-
     def apache_stop(self):
-        return self.apachectl("stop", check_live=False)
+        rv = self._run_apachectl("stop")
+        if rv == 0:
+            timeout = timedelta(seconds=10)
+            rv = 0 if self.is_dead(self._http_base, timeout=timeout) else -1
+            log.debug("waited for a apache.is_dead, rv=%d", rv)
+        return rv
 
     def apache_error_log_clear(self):
         if os.path.isfile(self._server_error_log):

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py?rev=1893546&r1=1892476&r2=1893546&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_106_shutdown.py Thu Sep 23 09:53:01 2021
@@ -37,7 +37,7 @@ class TestShutdown:
         t = Thread(target=long_request)
         t.start()
         time.sleep(0.5)
-        assert env.apache_restart() == 0
+        assert env.apache_reload() == 0
         t.join()
         # noinspection PyTypeChecker
         r: ExecResult = self.r

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py?rev=1893546&r1=1892476&r2=1893546&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_200_header_invalid.py Thu Sep 23 09:53:01 2021
@@ -60,6 +60,11 @@ class TestStore:
         assert 200 == r.response["status"]
         r = env.curl_get(url, options=["-H", "x: %sx" % (val[:8188])])
         assert 431 == r.response["status"]
+        # same with field name
+        r = env.curl_get(url, options=["-H", "y%s: 1" % (val[:8186])])
+        assert 200 == r.response["status"]
+        r = env.curl_get(url, options=["-H", "y%s: 1" % (val[:8188])])
+        assert 431 == r.response["status"]
 
     # test header field lengths check, LimitRequestFieldSize (default 8190)
     def test_200_11(self, env):