Blame tests/p_mod_python/mod_python_test.sh

Athmane Madjoudj 23f349
#!/bin/sh
Athmane Madjoudj 23f349
# Author: Athmane Madjoudj <athmanem@gmail.com>
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
t_Log "Running $0 - Apache httpd mod_python is functional"
Athmane Madjoudj 23f349
if (t_GetPkgRel basesystem | grep -q el5)
Athmane Madjoudj 23f349
then
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
cat > /etc/httpd/conf.d/tf_mptest.conf <
Athmane Madjoudj 23f349
<Directory /var/www/html/mptest> 
Athmane Madjoudj 23f349
    AddHandler mod_python .py
Athmane Madjoudj 23f349
    PythonHandler mptest 
Athmane Madjoudj 23f349
    PythonDebug On 
Athmane Madjoudj 23f349
</Directory>
Athmane Madjoudj 23f349
EOF
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
mkdir -p /var/www/html/mptest/
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
cat > /var/www/html/mptest/mptest.py <
Athmane Madjoudj 23f349
from mod_python import apache
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
def handler(req):
Athmane Madjoudj 23f349
    req.content_type = 'text/plain'
Athmane Madjoudj 23f349
    req.write("t_functional_mod_python_test")
Athmane Madjoudj 23f349
    return apache.OK
Athmane Madjoudj 23f349
EOF
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
t_ServiceControl httpd reload
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
curl -s http://localhost/mptest/mptest.py | grep -q 't_functional_mod_python_test'
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
t_CheckExitStatus $?
Athmane Madjoudj 23f349
Athmane Madjoudj 23f349
else 
Athmane Madjoudj 23f349
    echo "Skipped on CentOS 6"
Athmane Madjoudj 23f349
fi