- Essentials for automated testing
authorZdeněk Šustr <sustr4@cesnet.cz>
Tue, 6 Mar 2012 13:03:16 +0000 (13:03 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Tue, 6 Mar 2012 13:03:16 +0000 (13:03 +0000)
- Results in HTML printed out in bold

org.glite.testsuites.ctb/CANL-C/tests/canl-autonomous-test.sh [new file with mode: 0755]
org.glite.testsuites.ctb/CANL-C/tests/canl-common-testbeds.sh [new file with mode: 0755]
org.glite.testsuites.ctb/CANL-C/tests/test-common.sh

diff --git a/org.glite.testsuites.ctb/CANL-C/tests/canl-autonomous-test.sh b/org.glite.testsuites.ctb/CANL-C/tests/canl-autonomous-test.sh
new file mode 100755 (executable)
index 0000000..cbe5a32
--- /dev/null
@@ -0,0 +1,134 @@
+#!/bin/bash
+#
+# Copyright (c) Members of the EGEE Collaboration. 2004-2010.
+# See http://www.eu-egee.org/partners for details on the copyright holders.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# show help and usage
+progname=`basename $0`
+showHelp()
+{
+cat << EndHelpHeader
+This script is intended for running a fully automated deployment and functionality test of the C-part of caNl, depending on its examples
+
+Prerequisities:
+New empty machine, certificates
+
+Tests called:
+       Deployment
+       The full caNl-c Test Suite
+
+EndHelpHeader
+
+       echo "Usage: $progname [OPTIONS] hostname"
+       echo "Options:"
+       echo " -h | --help            Show this help message."
+}
+
+STARTTIME=`date +%s`
+
+egrep -i "Debian|Ubuntu" /etc/issue
+if [ \$? = 0 ]; then
+        INSTALLCMD="apt-get install -q --yes"
+        INSTALLPKGS="lintian"
+else
+        INSTALLCMD="yum install -q -y --nogpgcheck"
+        INSTALLPKGS="rpmlint"
+fi
+
+$INSTALLCMD wget
+
+# read common definitions and functions
+for COMMON in canl-common.sh test-common.sh canl-common-testbeds.sh
+do
+       if [ ! -r ${COMMON} ]; then
+               printf "Downloading common definitions '${COMMON}'"
+               wget -O ${COMMON} http://jra1mw.cvs.cern.ch/cgi-bin/jra1mw.cgi/org.glite.testsuites.ctb/CANL-C/tests/$COMMON?view=co > /dev/null
+               if [ ! -r ${COMMON} ]; then
+                       exit 2
+               else 
+                       chmod +x $COMMON
+                       test_done
+               fi
+       fi
+done
+source canl-common.sh
+source canl-common-testbeds.sh
+#also read L&B common definitions for common functions.
+if [ ! -r lb-common-testbeds.sh ]; then
+       printf "Downloading common definitions 'lb-common-testbeds.sh'"
+        wget -O lb-common-testbeds.sh http://jra1mw.cvs.cern.ch/cgi-bin/jra1mw.cgi/org.glite.testsuites.ctb/LB/tests/lb-common-testbeds.sh?view=co > /dev/null
+        if [ ! -r lb-common-testbeds.sh ]; then
+                exit 2
+        else
+               chmod +x lb-common-testbeds.sh
+                test_done
+        fi
+fi
+source lb-common-testbeds.sh
+
+
+printf "Getting the 'install' script... "
+# Example script, for real tests it should be downloaded or otherwise obtained
+SCENARIO=${SCENARIO:-"Clean installation"}
+test -s caNlInstall.sh || cat << EndInstallScript > caNlInstall.sh
+rpm -Uvhi http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
+yum install -y yum-priorities yum-protectbase
+
+cd /etc/yum.repos.d
+wget --no-check-certificate https://twiki.cern.ch/twiki/pub/EMI/EMI-2/emi-2-rc3-sl5.repo
+
+yum install -y canl-c
+EndInstallScript
+test_done
+
+
+printf "Generating the 'arrange' script... "
+gen_arrange_script_canl `hostname -f` 0
+test_done
+
+
+printf "Installing... "
+sh caNlInstall.sh > Install_log.txt 2> Install_err.log
+test_done
+
+printf "Running tests... "
+sh arrange_canl_test_root.sh none glite 80 '-x' > test_log.txt 2> test_err.log
+test_done
+
+ENDTIME=`date +%s`
+
+#Generating report section
+gen_deployment_header $ENDTIME $STARTTIME "$SCENARIO" > report.twiki
+
+cat caNlInstall.sh >> report.twiki
+printf "</verbatim>
+
+---++++ Full Output of the Installation
+
+<verbatim>\n" >> report.twiki
+cat Install_log.txt >> report.twiki
+
+printf "</verbatim>
+
+---+++ Tests
+
+| !TestPlan | <B>N/A</B> |
+| Tests | http://jra1mw.cvs.cern.ch/cgi-bin/jra1mw.cgi/org.glite.testsuites.ctb/CANL-C/tests/ |
+
+<verbatim>\n" >> report.twiki
+cat test_log.txt >> report.twiki
+
+
diff --git a/org.glite.testsuites.ctb/CANL-C/tests/canl-common-testbeds.sh b/org.glite.testsuites.ctb/CANL-C/tests/canl-common-testbeds.sh
new file mode 100755 (executable)
index 0000000..109d2a1
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Copyright (c) Members of the EGEE Collaboration. 2004-2010.
+# See http://www.eu-egee.org/partners for details on the copyright holders.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+function gen_arrange_script_canl()
+{
+remotehost=$1
+COPYPROXY=$2
+
+egrep -i "Debian|Ubuntu" /etc/issue
+if [ \$? = 0 ]; then 
+        INSTALLCMD="apt-get install -q --yes"
+       INSTALLPKGS="lintian"
+else
+        INSTALLCMD="yum install -q -y --nogpgcheck"
+       INSTALLPKGS="rpmlint"
+fi
+
+cat << EndArrangeScript > arrange_canl_test_root.sh 
+CERTFILE=\$1
+GLITE_USER=\$2
+GSTSTCOLS=\$3
+OUTPUT_OPT=\$4
+
+echo "Certificate file: \$CERTFILE "
+echo "gLite user:       \$GLITE_USER "
+echo "Terminal width:   \$GSTSTCOLS "
+echo "Output format:    \$OUTPUT_OPT "
+
+export GSTSTCOLS
+
+${INSTALLCMD} wget lsof canl-examples cvs voms-clients globus-proxy-utils $INSTALLPKGS
+
+cd /tmp
+
+if [ $COPYPROXY -eq 1 ]; then
+       mv \$CERTFILE x509up_u\`id -u\`
+       chown \`id -un\`:\`id -gn\` x509up_u\`id -u\`
+else
+       rm -rf /tmp/test-certs/grid-security
+       cvs -d :pserver:anonymous@glite.cvs.cern.ch:/cvs/jra1mw co org.glite.testsuites.ctb/LB > /dev/null 2>/dev/null
+       ./org.glite.testsuites.ctb/LB/tests/lb-generate-fake-proxy.sh > fake-prox.out.\$\$
+       FAKE_CAS=\`cat fake-prox.out.\$\$ | grep -E "^X509_CERT_DIR" | sed 's/X509_CERT_DIR=//'\`
+       if [ "\$FAKE_CAS" = "" ]; then
+                echo "Failed generating proxy" >&2
+                exit 2
+        else
+                cp -rv \$FAKE_CAS/* /etc/grid-security/certificates/
+        fi
+
+       TRUSTED_CERTS=\`cat fake-prox.out.\$\$ | grep -E "^TRUSTED_CERTS" | sed 's/TRUSTED_CERTS=//'\`
+       export x509_USER_CERT=\${TRUSTED_CERTS}/trusted_client00.cert
+       export x509_USER_KEY=\${TRUSTED_CERTS}/trusted_client00.priv-clear
+       rm fake-prox.out.\$\$
+fi
+
+cd ~/
+mkdir caNl_testing
+cd caNl_testing
+cvs -d :pserver:anonymous@glite.cvs.cern.ch:/cvs/jra1mw co org.glite.testsuites.ctb/CANL-C
+cd org.glite.testsuites.ctb/CANL-C/tests
+echo ========================
+echo "  REAL TESTS START HERE"
+echo ========================
+echo "</verbatim>"
+echo "<literal>"
+./canl-test-cert-handle.sh --origin \$x509_USER_CERT --key \$x509_USER_KEY \$OUTPUT_OPT
+./canl-test-cs-openssl.sh \$OUTPUT_OPT
+./canl-test-sec-connection.sh \$OUTPUT_OPT
+echo "</literal>"
+echo "<verbatim>"
+echo ==================
+echo "  TESTS END HERE"
+echo ==================
+echo "</verbatim>"
+
+EndArrangeScript
+}
+
index 520fb27..1b3a637 100644 (file)
@@ -177,23 +177,23 @@ is_html=1
 
 begin_bold="<b>"
 begin_black="<font color=\"black\">"
-begin_red="<font color=\"red\">"
-begin_green="<font color=\"green\">"
-begin_yellow="<font color=\"orange\">"
-begin_blue="<font color=\"blue\">"
-begin_magenta="<font color=\"magenta\">"
-begin_cyan="<font color=\"cyan\">"
-begin_white="<font color=\"white\">"
+begin_red="<B><font color=\"red\">"
+begin_green="<B><font color=\"green\">"
+begin_yellow="<B><font color=\"orange\">"
+begin_blue="<B><font color=\"blue\">"
+begin_magenta="<B><font color=\"magenta\">"
+begin_cyan="<B><font color=\"cyan\">"
+begin_white="<B><font color=\"white\">"
 
 end_bold="</b>"
 end_black="$ENDFONT"
-end_red="$ENDFONT"
-end_green="$ENDFONT"
-end_yellow="$ENDFONT"
-end_blue="$ENDFONT"
-end_magenta="$ENDFONT"
-end_cyan="$ENDFONT"
-end_white="$ENDFONT"
+end_red="$ENDFONT</B>"
+end_green="$ENDFONT</B>"
+end_yellow="$ENDFONT</B>"
+end_blue="$ENDFONT</B>"
+end_magenta="$ENDFONT</B>"
+end_cyan="$ENDFONT</B>"
+end_white="$ENDFONT</B>"
 
 set_test
 }