Lines 128-134
Link Here
|
128 |
"testconf.py and change the variables HTTPD, TESTHOME, MOD_PYTHON_SO " |
128 |
"testconf.py and change the variables HTTPD, TESTHOME, MOD_PYTHON_SO " |
129 |
"and LIBEXECDIR according to their description in the file.\n" |
129 |
"and LIBEXECDIR according to their description in the file.\n" |
130 |
) |
130 |
) |
131 |
sys.exit() |
131 |
sys.exit(1) |
132 |
else: |
132 |
else: |
133 |
def testpath(variable,isfile): |
133 |
def testpath(variable,isfile): |
134 |
value = getattr(testconf,variable,'<undefined>') |
134 |
value = getattr(testconf,variable,'<undefined>') |
Lines 151-157
Link Here
|
151 |
good = testpath('MOD_PYTHON_SO',True) and good |
151 |
good = testpath('MOD_PYTHON_SO',True) and good |
152 |
if not good: |
152 |
if not good: |
153 |
print "Please check your testconf.py file" |
153 |
print "Please check your testconf.py file" |
154 |
sys.exit() |
154 |
sys.exit(1) |
155 |
|
155 |
|
156 |
del testpath |
156 |
del testpath |
157 |
del good |
157 |
del good |
Lines 180-187
Link Here
|
180 |
CONFIG = os.path.join(TESTHOME, "conf", "test.conf") |
180 |
CONFIG = os.path.join(TESTHOME, "conf", "test.conf") |
181 |
DOCUMENT_ROOT = os.path.join(TESTHOME, "htdocs") |
181 |
DOCUMENT_ROOT = os.path.join(TESTHOME, "htdocs") |
182 |
PORT = 0 # this is set in fundUnusedPort() |
182 |
PORT = 0 # this is set in fundUnusedPort() |
183 |
|
183 |
|
184 |
|
184 |
SESSION_DIR = os.path.join(TESTHOME, 'session') |
|
|
185 |
if os.path.exists(SESSION_DIR): |
186 |
shutil.rmtree(SESSION_DIR) |
187 |
os.mkdir(SESSION_DIR) |
188 |
os.chmod(SESSION_DIR, 0777) |
189 |
|
185 |
# readBlockSize is required for the test_fileupload_* tests. |
190 |
# readBlockSize is required for the test_fileupload_* tests. |
186 |
# We can't import mod_python.util.readBlockSize from a cmd line |
191 |
# We can't import mod_python.util.readBlockSize from a cmd line |
187 |
# interpreter, so we'll hard code it here. |
192 |
# interpreter, so we'll hard code it here. |
Lines 303-308
Link Here
|
303 |
IfModule("!mod_dir.c", |
308 |
IfModule("!mod_dir.c", |
304 |
LoadModule("dir_module %s" % |
309 |
LoadModule("dir_module %s" % |
305 |
quoteIfSpace(os.path.join(modpath, "mod_dir.so")))), |
310 |
quoteIfSpace(os.path.join(modpath, "mod_dir.so")))), |
|
|
311 |
Directory('/', AllowOverride('None')), |
306 |
ServerRoot(SERVER_ROOT), |
312 |
ServerRoot(SERVER_ROOT), |
307 |
ErrorLog("logs/error_log"), |
313 |
ErrorLog("logs/error_log"), |
308 |
LogLevel("debug"), |
314 |
LogLevel("debug"), |
Lines 312-322
Link Here
|
312 |
TypesConfig("conf/mime.types"), |
318 |
TypesConfig("conf/mime.types"), |
313 |
PidFile("logs/httpd.pid"), |
319 |
PidFile("logs/httpd.pid"), |
314 |
ServerName("127.0.0.1"), |
320 |
ServerName("127.0.0.1"), |
315 |
Listen(PORT), |
321 |
Listen("%s:%s" % ("127.0.0.1", PORT)), |
316 |
PythonOption('PythonOptionTest sample_value'), |
322 |
PythonOption('PythonOptionTest sample_value'), |
317 |
DocumentRoot(DOCUMENT_ROOT), |
323 |
DocumentRoot(DOCUMENT_ROOT), |
318 |
LoadModule("python_module %s" % quoteIfSpace(MOD_PYTHON_SO))) |
324 |
LoadModule("python_module %s" % quoteIfSpace(MOD_PYTHON_SO))) |
319 |
|
325 |
|
|
|
326 |
if testconf.USER: |
327 |
s.append(User(testconf.USER)) |
328 |
if testconf.GROUP: |
329 |
s.append(Group(testconf.GROUP)) |
330 |
|
320 |
if APACHE_VERSION == '2.2': |
331 |
if APACHE_VERSION == '2.2': |
321 |
# mod_auth has been split into mod_auth_basic and some other modules |
332 |
# mod_auth has been split into mod_auth_basic and some other modules |
322 |
s.append(IfModule("!mod_auth_basic.c", |
333 |
s.append(IfModule("!mod_auth_basic.c", |
Lines 364-370
Link Here
|
364 |
# Qemu will run about 1/10 the native speed, so 1 second may |
375 |
# Qemu will run about 1/10 the native speed, so 1 second may |
365 |
# not be long enough for apache to shut down. |
376 |
# not be long enough for apache to shut down. |
366 |
count = 0 |
377 |
count = 0 |
367 |
pid_file = os.path.join(os.getcwd(), 'logs/httpd.pid') |
378 |
pid_file = os.path.join(SERVER_ROOT, 'logs', 'httpd.pid') |
368 |
while os.path.exists(pid_file): |
379 |
while os.path.exists(pid_file): |
369 |
time.sleep(1) |
380 |
time.sleep(1) |
370 |
count += 1 |
381 |
count += 1 |
Lines 1008-1023
Link Here
|
1008 |
ugh = file('ugh.pdf','rb') |
1019 |
ugh = file('ugh.pdf','rb') |
1009 |
content = ugh.read() |
1020 |
content = ugh.read() |
1010 |
ugh.close() |
1021 |
ugh.close() |
|
|
1022 |
digest = md5.new(content).hexdigest() |
1023 |
if digest != '9e8c42be55aac825e7a34d448044d0fe': |
1024 |
raise Exception('bad ugh digest') |
1011 |
except: |
1025 |
except: |
1012 |
print " * Skipping the test for The UNIX-HATERS handbook file upload." |
1026 |
print " * Skipping the test for The UNIX-HATERS handbook file upload." |
1013 |
print " To make this test, you need to download ugh.pdf from" |
1027 |
print " To make this test, you need to download ugh.pdf from" |
1014 |
print " http://research.microsoft.com/~daniel/uhh-download.html" |
1028 |
print " http://research.microsoft.com/~daniel/uhh-download.html" |
1015 |
print " into this script's directory." |
1029 |
print " into this script's directory." |
|
|
1030 |
|
1031 |
if str(sys.exc_info()[1]) == 'bad ugh digest': |
1032 |
print " (The file ugh.pdf that is currently present is not the " |
1033 |
print " correct file; we're looking for a file with md5: " |
1034 |
print " 9e8c42be55aac825e7a34d448044d0fe.)" |
1016 |
else: |
1035 |
else: |
1017 |
print " * Testing The UNIX-HATERS handbook file upload support" |
1036 |
print " * Testing The UNIX-HATERS handbook file upload support" |
1018 |
|
1037 |
|
1019 |
digest = md5.new(content).hexdigest() |
|
|
1020 |
|
1021 |
rsp = self.vhost_post_multipart_form_data( |
1038 |
rsp = self.vhost_post_multipart_form_data( |
1022 |
"test_fileupload", |
1039 |
"test_fileupload", |
1023 |
variables={'test':'abcd'}, |
1040 |
variables={'test':'abcd'}, |
Lines 1624-1629
Link Here
|
1624 |
ServerName("test_Session_Session"), |
1641 |
ServerName("test_Session_Session"), |
1625 |
DocumentRoot(DOCUMENT_ROOT), |
1642 |
DocumentRoot(DOCUMENT_ROOT), |
1626 |
Directory(DOCUMENT_ROOT, |
1643 |
Directory(DOCUMENT_ROOT, |
|
|
1644 |
PythonOption('session_directory "%s"'% |
1645 |
SESSION_DIR), |
1627 |
SetHandler("mod_python"), |
1646 |
SetHandler("mod_python"), |
1628 |
PythonHandler("tests::Session_Session"), |
1647 |
PythonHandler("tests::Session_Session"), |
1629 |
PythonDebug("On"))) |
1648 |
PythonDebug("On"))) |
Lines 1662-1667
Link Here
|
1662 |
ServerName("test_Session_Session"), |
1681 |
ServerName("test_Session_Session"), |
1663 |
DocumentRoot(DOCUMENT_ROOT), |
1682 |
DocumentRoot(DOCUMENT_ROOT), |
1664 |
Directory(DOCUMENT_ROOT, |
1683 |
Directory(DOCUMENT_ROOT, |
|
|
1684 |
PythonOption('session_directory "%s"'% |
1685 |
SESSION_DIR), |
1665 |
SetHandler("mod_python"), |
1686 |
SetHandler("mod_python"), |
1666 |
PythonHandler("tests::Session_Session"), |
1687 |
PythonHandler("tests::Session_Session"), |
1667 |
PythonDebug("On"))) |
1688 |
PythonDebug("On"))) |
Lines 2194-2198
Link Here
|
2194 |
return mpTestSuite |
2215 |
return mpTestSuite |
2195 |
|
2216 |
|
2196 |
tr = unittest.TextTestRunner() |
2217 |
tr = unittest.TextTestRunner() |
2197 |
tr.run(suite()) |
2218 |
result = tr.run(suite()) |
2198 |
|
2219 |
sys.exit(not result.wasSuccessful()) |