use default paths to canl sample server and client binaries, download and build them...
authorMarcel Poul <marcel.poul@cern.ch>
Sat, 18 Feb 2012 23:52:56 +0000 (23:52 +0000)
committerMarcel Poul <marcel.poul@cern.ch>
Sat, 18 Feb 2012 23:52:56 +0000 (23:52 +0000)
org.glite.testsuites.ctb/CANL-C/tests/canl-common.sh
org.glite.testsuites.ctb/CANL-C/tests/canl-test-sec-connection.sh

index 7c2bc0f..bacd386 100755 (executable)
@@ -48,6 +48,9 @@ export PATH
 GRIDPROXYINFO=grid-proxy-info
 #voms binaries
 VOMSPROXYFAKE=voms-proxy-fake
+#canl sample binaries
+EMI_CANL_CLIENT=emi-canl-client
+EMI_CANL_SERVER=emi-canl-server
 
 # default LB ports
 GLITE_LB_SERVER_PORT=${GLITE_LB_SERVER_PORT:-9000}
@@ -95,6 +98,18 @@ SYS_STAT=stat
 
 #generate proxy shell script file
 GEN_PROXY=./canl-generate-fake-proxy.sh
+
+function get_canl_examples()
+{
+       wget -q -O canl_examples.tar.gz \
+               'http://jra1mw.cvs.cern.ch:8180/cgi-bin/jra1mw.cgi/emi.canl.canl-c/examples.tar.gz?view=tar' &> /dev/null || return 1
+       tar xzf canl_examples.tar.gz || return 1
+       rm -rf canl_examples.tar.gz
+       make -s || return 1
+       rm -rf examples/
+       return 0
+}
+
 function check_credentials_and_generate_proxy()
 {      
        check_credentials
@@ -106,13 +121,11 @@ function check_credentials_and_generate_proxy()
                fi
                $GEN_PROXY $PROXYLIFE
                if [ $? != 0 ]; then
-                       test_failed
                        print_error "Proxy not created - process failed"
                        return 2
                fi
                check_credentials
                if [ $? != 0 ]; then
-                       test_failed
                        print_error "Credentials still not passing check"
                        return 2
                fi
@@ -162,7 +175,7 @@ function check_binaries()
        do      
                check_exec $file 
                if [ $? -gt 0 ]; then
-                       print_error "command $file not found"
+                       print_error "$file not found"
                        ret=$TEST_ERROR
                fi
        done
index 4ac7673..95df019 100755 (executable)
@@ -52,13 +52,17 @@ if [ ! -r ${COMMON} ]; then
 fi
 source ${COMMON}
 
-logfile=$$.tmp
-flag=0
+#logfile=$$.tmp
+#flag=0
+srvbin=""
+clibin=""
 while test -n "$1"
 do
        case "$1" in
                "-h" | "--help") showHelp && exit 2 ;;
 #              "-o" | "--output") shift ; logfile=$1 flag=1 ;;
+               "-s" | "--srvbin") shift ; srvbin=$1 ;;
+               "-k" | "--clibin") shift ; clibin=$1 ;;
                "-t" | "--text")  setOutputASCII ;;
                "-c" | "--color") setOutputColor ;;
                "-x" | "--html")  setOutputHTML ;;
@@ -79,16 +83,45 @@ done
 
 {
 test_start
-printf "Downloading canl examples sources"
-wget -q -O canl_examples.tar.gz \
-       'http://jra1mw.cvs.cern.ch:8180/cgi-bin/jra1mw.cgi/emi.canl.canl-c/examples.tar.gz?view=tar' &> /dev/null || exit 1
-tar xzf canl_examples.tar.gz || exit 1
+# check canl binaries
+printf "Testing if binaries of canl examples are available"
+if [ -n "$srvbin" -a -n "$clibin" ]; then
+       check_binaries $srvbin $clibin
+       if [ $? -gt 0 ]; then
+               test_failed
+               printf "Downloading canl source files and building examples"
+               get_canl_examples
+               if [ $? -gt 0 ]; then
+                       test_failed
+                       test_end
+                       exit $TEST_ERROR
+               fi
+               EMI_CANL_SERVER='./emi-canl-server'
+               EMI_CANL_CLIENT='./emi-canl-client'
+       fi
+       EMI_CANL_SERVER="$srvbin"
+       EMI_CANL_CLIENT="$clibin"
+else
+       #default path
+       check_binaries $EMI_CANL_SERVER $EMI_CANL_CLIENT 
+       if [ $? -gt 0 ]; then
+               test_failed
+               printf "Downloading canl source files and building examples"
+               get_canl_examples
+               if [ $? -gt 0 ]; then
+                       test_failed
+                       test_end
+                       exit $TEST_ERROR
+               fi
+               EMI_CANL_SERVER='./emi-canl-server'
+               EMI_CANL_CLIENT='./emi-canl-client'
+       fi
+fi
 test_done
-rm -rf canl_examples.tar.gz
 
 # check_binaries
 printf "Testing if all binaries are available"
-check_binaries $VOMSPROXYFAKE $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK
+check_binaries $EMI_CANL_SERVER $EMI_CANL_CLIENT $VOMSPROXYFAKE $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK
 if [ $? -gt 0 ]; then
        test_failed
 else
@@ -98,6 +131,7 @@ fi
 printf "Testing credentials"
 check_credentials_and_generate_proxy
 if [ $? -gt 0 ]; then
+       test_failed
        test_end
        exit 2
 else