]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* test/pyhttpd/env.py (has_h2load): Verify h2load actually resolves,
authorJoe Orton <jorton@apache.org>
Fri, 7 Aug 2026 14:22:39 +0000 (14:22 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 7 Aug 2026 14:22:39 +0000 (14:22 +0000)
  instead of just checking the config string is non-empty.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
GitHub: PR #701

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1936973 13f79535-47bb-0310-9956-ffa450edef68

test/pyhttpd/env.py

index e3cf1e723177764d1c8a61f197c7657f026f4a8f..a3e020dd99475d3ff98c0e2579923fab37f14ea8 100644 (file)
@@ -508,7 +508,15 @@ class HttpdTestEnv:
         return hv >= self._versiontuple(minv)
 
     def has_h2load(self):
-        return self._h2load != ""
+        if self._h2load == "":
+            return False
+        # config.ini/default may just be the bare command name ("h2load"),
+        # not a verified path -- confirm it actually resolves so
+        # h2load_is_at_least() below doesn't crash with FileNotFoundError
+        # (breaking test collection) when the tool isn't installed.
+        if os.path.dirname(self._h2load):
+            return os.path.isfile(self._h2load) and os.access(self._h2load, os.X_OK)
+        return self.has_tool(self._h2load)
 
     def h2load_is_at_least(self, minv):
         if not self.has_h2load():