+1 with patch
Linux gentoo 2.6.12-gentoo-r6
apache 2.0.54 (mpm-prefork)
python 2.4.2
gcc 3.3.6
There are 2 issues with the unit tests in Gentoo that are fixed by the
attached patch. (Just to be clear, I mean the problems are with the unit
test code, not with mod_python).
First, test_global_lock uses ab in the test. In Gentoo, ab is named ab2,
so this test fails. The attached patch just skips the test if ab doesn't
exist. We can improve on this later.
The second issue is with test_req_headers_out, first reported by Dominic
Wong a couple of weeks ago. The fix is simple, but I want to understand
why it was failing under Gentoo and not other platforms.
The culprit seems to be the use of DirectoryIndex directive in the
test.conf. The existence of "DirectoryIndex /tests.py" causes apache to
segfault. Removing DirectoryIndex and giving the full url in the
putrequest allows the test to complete successfully.
So my questions are:
1. Why would DirectoryIndex cause a segfault on gentoo but not other
platforms?
2. This test is the only one that uses DirectoryIndex. Is there any
special reason for this?
3. This test is the only one that uses AddHandler instead of SetHandler.
Is there a reason for this?
4. This test is the only one that sets a PythonAccessHandler directive
in test.conf. Is there a reason for this?
Can anyone offer any insights?
Regards,
Jim
Index: test/test.py
===================================================================
--- test/test.py (revision 344202)
+++ test/test.py (working copy)
@@ -136,7 +136,6 @@
MOD_PYTHON_SO = testconf.MOD_PYTHON_SO
LIBEXECDIR = testconf.LIBEXECDIR
AB = os.path.join(os.path.split(HTTPD)[0], "ab")
-
SERVER_ROOT = TESTHOME
CONFIG = os.path.join(TESTHOME, "conf", "test.conf")
DOCUMENT_ROOT = os.path.join(TESTHOME, "htdocs")
@@ -379,7 +378,6 @@
return rsp
### Tests begin here
-
def test_req_document_root_conf(self):
c = VirtualHost("*",
@@ -668,8 +666,7 @@
ServerName("test_req_headers_out"),
DocumentRoot(DOCUMENT_ROOT),
Directory(DOCUMENT_ROOT,
- AddHandler("mod_python .py"),
- DirectoryIndex("/tests.py"),
+ SetHandler("mod_python"),
PythonHandler("tests::req_headers_out"),
PythonAccessHandler("tests::req_headers_out_access"),
PythonDebug("On")))
@@ -680,7 +677,7 @@
print "\n * Testing req.headers_out"
conn = httplib.HTTPConnection("127.0.0.1:%s" % PORT)
- conn.putrequest("GET", "/", skip_host=1)
+ conn.putrequest("GET", "/tests.py", skip_host=1)
conn.putheader("Host", "test_req_headers_out:%s" % PORT)
conn.endheaders()
response = conn.getresponse()
@@ -1733,6 +1730,10 @@
t1 = time.time()
print " ", time.ctime()
ab = quoteIfSpace(AB)
+ if not os.path.exists(ab):
+ print " ab not found. Skipping _global_lock test"
+ return
+
if os.name == "nt":
cmd = '%s -c 5 -n 5 http://127.0.0.1:%s/tests.py > NUL:' \
% (ab, PORT)