summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAthmane Madjoudj <athmane@fedoraproject.org>2011-07-02 11:59:25 +0100
committerAthmane Madjoudj <athmane@fedoraproject.org>2011-07-02 11:59:25 +0100
commit188948efd084f587225c4faf6224501300e4fd7d (patch)
treed5e98227b64d0d1d97a6dd309668f09c29e911f1
downloadtestcases-scripts-188948efd084f587225c4faf6224501300e4fd7d.tar.gz
testcases-scripts-188948efd084f587225c4faf6224501300e4fd7d.tar.xz
testcases-scripts-188948efd084f587225c4faf6224501300e4fd7d.zip
- Initial commit
-rwxr-xr-xhttpd/0-install_httpd.sh8
-rwxr-xr-xhttpd/httpd_basic_auth.sh22
-rwxr-xr-xhttpd/httpd_php.sh10
-rwxr-xr-xhttpd/httpd_servehtml.sh8
-rwxr-xr-xhttpd/httpd_vhost.sh22
-rwxr-xr-xhttpd/runtests.sh17
6 files changed, 87 insertions, 0 deletions
diff --git a/httpd/0-install_httpd.sh b/httpd/0-install_httpd.sh
new file mode 100755
index 0000000..30266f0
--- /dev/null
+++ b/httpd/0-install_httpd.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+# A small Apache HTTPd test suite
+# Author: Athmane Madjoudj <athmane@fedoraproject.org>
+
+# HTTPD / PHP
+yum -y -d0 install httpd mod_ssl php php-mysql
+chkconfig httpd on
+service httpd start
diff --git a/httpd/httpd_basic_auth.sh b/httpd/httpd_basic_auth.sh
new file mode 100755
index 0000000..4e0090f
--- /dev/null
+++ b/httpd/httpd_basic_auth.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# A small Apache HTTPd test suite
+# Author: Athmane Madjoudj <athmane@fedoraproject.org>
+
+echo "Running $0 - httpd basic authentication test."
+
+cat > /etc/httpd/conf.d/dir-test-basic-auth.conf <<EOF
+Alias /basic_auth_test /var/www/html/basic_auth_test
+<Directory "/var/www/html/basic_auth_test">
+ AuthType Basic
+ AuthName "Test"
+ AuthUserFile /etc/httpd/htpasswd
+ require user test
+</Directory>
+EOF
+
+htpasswd -c -b /etc/httpd/htpasswd test test
+mkdir -p /var/www/html/basic_auth_test
+echo "Basic authentication Test Page" > /var/www/html/basic_auth_test/index.html
+service httpd reload
+curl -s -u test:test http://localhost/basic_auth_test/ | grep 'Basic authentication Test Page' > /dev/null 2>&1
+
diff --git a/httpd/httpd_php.sh b/httpd/httpd_php.sh
new file mode 100755
index 0000000..12a3cb0
--- /dev/null
+++ b/httpd/httpd_php.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# A small Apache HTTPd test suite
+# Author: Athmane Madjoudj <athmane@fedoraproject.org>
+
+echo "<?php echo phpinfo(); ?>" > /var/www/html/test.php
+
+echo "Running $0 - httpd handle PHP test"
+
+curl -s http://localhost/test.php | grep 'PHP Version' > /dev/null 2>&1
+
diff --git a/httpd/httpd_servehtml.sh b/httpd/httpd_servehtml.sh
new file mode 100755
index 0000000..8b0cb06
--- /dev/null
+++ b/httpd/httpd_servehtml.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# A small Apache HTTPd test suite
+# Author: Athmane Madjoudj <athmane@fedoraproject.org>
+
+echo "Running $0 - httpd serve html page test."
+
+curl -s http://localhost/ | grep 'Test Page' > /dev/null 2>&1
+
diff --git a/httpd/httpd_vhost.sh b/httpd/httpd_vhost.sh
new file mode 100755
index 0000000..2021e9f
--- /dev/null
+++ b/httpd/httpd_vhost.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# A small Apache HTTPd test suite
+# Author: Athmane Madjoudj <athmane@fedoraproject.org>
+
+echo "Running $0 - httpd virtual host test."
+
+echo "127.0.0.1 test" >> /etc/hosts
+cat > /etc/httpd/conf.d/vhost-test.conf <<EOF
+NameVirtualHost *:80
+
+<VirtualHost *:80>
+ ServerAdmin webmaster@test
+ DocumentRoot /var/www/vhosts/test/
+ ServerName test
+</VirtualHost>
+EOF
+
+mkdir -p /var/www/vhosts/test/
+echo "Virtual Host Test Page" > /var/www/vhosts/test/index.html
+service httpd reload
+curl -s http://test/ | grep 'Virtual Host Test Page' > /dev/null 2>&1
+
diff --git a/httpd/runtests.sh b/httpd/runtests.sh
new file mode 100755
index 0000000..e3f4f4a
--- /dev/null
+++ b/httpd/runtests.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# A small Apache HTTPd test suite
+# Author: Athmane Madjoudj <athmane@fedoraproject.org>
+
+# Install some required utilities
+yum -y -d0 install curl grep
+
+# Run install
+./0-install_httpd.sh
+
+# Run tests
+
+for testscript in httpd_*
+do
+ ./$testscript
+ [ $? -eq 0 ] && echo "==> [ PASS ]" || echo "==> [ FAIL ]"
+done