1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
|
#!/bin/bash
#
# This script is a part of SRM test suite. It is a wrapper around the main
# srm_test binary, calling it with apropriate args, checking output,
# diffing the resulting files and notifying user about result.
#
# Written by Jiri Kosina <kosina@fzu.cz>
# Modified/Improved/Updated by GG (Gilbert.Grosdidier@cern.ch)
# Last rev: 27/12/2006 (GG) + 16/11/2007
#
# $Id: srmv1Suite,v 1.14 2007/11/17 02:20:58 grodid Exp $
## Comments by GG
## Required:
## - Grid proxy
## - srmv1 server running on target machine UNDER ROOT
## > setenv GRIDMAPDIR /etc/grid-security/gridmapdir/
## > setenv GRIDMAP /etc/grid-security/grid-mapfile
## > limit coredumpsize unlimited
## > /afs/cern.ch/project/gd/grodid/DPM-MYSQL-RH73/srmv1/srmv1 -c /afs/cern.ch/user/g/grodid/private/PROC/procps-3.2.3/dpns_lxb1901.config -l /var/tmp/grodid/logs/srmv1.log
## - NO $DPNS/DPM_HOST vars
## - settings: machine, protocol
## Usage: $0 targetNode userName protocol
target=$1
tstNAME=$2
proto=$3
sfile=$4
subTree=$5
##BADsite_domain=`echo $target | perl -pe 's/(\w*?)\.(.*)/$2/'`
site_domain=`echo $target | perl -pe 's/([-\w]*?)\.(.*)/$2/'`
# uhm ... let's clean this sometime :)
##export PATH=/opt/lcg/bin:/opt/globus/bin:/opt/globus/sbin:/opt/edg/bin:/usr/local/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/cern/pro/bin:/opt/gpt/sbin:/usr/java/j2sdk1.4.1_01/bin:/software/j2re1.3.1/bin:/opt/edg/bin:/opt/edg/sbin:/opt/edg/bin:/opt/edg/sbin:$PATH
export PATH=$PATH:/opt/lcg/bin:/opt/globus/bin:/opt/globus/sbin:/opt/edg/bin:/usr/local/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/cern/pro/bin:/opt/gpt/sbin:/usr/java/j2sdk1.4.1_01/bin:/software/j2re1.3.1/bin:/opt/edg/bin:/opt/edg/sbin:/opt/edg/bin:/opt/edg/sbin
## Implies that in standalone mode, we run it from test/srmv1 directory
## Not really required: PATH redefined for rfcp in my_rfcp_in.sh & my_rfcp_out.sh ## Not valid any more
export PATH=../../rfio:$PATH
# which protocol [gsiftp/gftp/rfio/(gsi)dcap]
PROTO=gsiftp
PROTO=gftp
#PROTO=rfio
#PROTO=dcap
PROTO=$proto
if [ "$PROTO" = "gftp" ]
then
PROTO=gsiftp
fi
if [ "$VOTEAM"X = "X" ]
then
voteam="dteam"
else
voteam=$VOTEAM
fi
# this for castortest
SURL=srm://castorgridtest.cern.ch:8443//castor/cern.ch/grid/dteam/srm_test_suite_file.$$.$RANDOM
# this for castorgrid
SURL=srm://castorgrid.cern.ch:8443//castor/cern.ch/grid/dteam/srm_test_suite_file.$$.$RANDOM
# this for lxb1909 (Castor - 1760
SURL=srm://lxb1909.cern.ch:8443//castor/cern.ch/home/dteam/srm_test_suite_file.$$.$RANDOM
SURL=srm://lxb1760.cern.ch:8443//castor/cern.ch/home/dteam/srm_test_suite_file.$$.$RANDOM
# this for dcache at lxb1753 (dCache
#SURL=srm://lxb1753.cern.ch:8443//pnfs/cern.ch/data/dteam/srm_test_suite_file.$$.$RANDOM
#BADSURL=srm://lxb1753.cern.ch:8443//pnfs/cern.ch/data/srm_test_suite_file.$$.$RANDOM
# this for dcache at lxn1180 (dCache
#SURL=srm://lxn1180.cern.ch:8443//pnfs/cern.ch/data/dteam/srm_test_suite_file.$$.$RANDOM
# this for dcache at lxb0740 (dCache
#SURL=srm://lxb0740.cern.ch:8443//pnfs/cern.ch/data/dteam/srm_test_suite_file.$$.$RANDOM
# this for dpm at lxb1901 (GG machine ... - not GSIFTP enabled yet
SURL=srm://lxb1901.cern.ch:8443//dpm/dteam/grodid/srm_test_suite_file.$$.$RANDOM
SURL=srm://${target}:8443//dpm/dteam/grodid/srm_test_suite_file.$$.$RANDOM
##SURL=srm://${target}:8443//dpm/dteam/grodid/otherdir/srm_test_suite_file.$$.$RANDOM
# this for dpm at lxb1727, lxb1904, lxgate22 (GG machines ...
if [ "$subTree"X = "X" ]
then
SURL=srm://${target}:8443//dpm/${site_domain}/home/${voteam}/srmv1_Tfile.$$.$RANDOM
SURL=srm://${target}:8443//dpm/${site_domain}/home/${voteam}/srmv1_Tfile.${sfile}.$RANDOM
else
SURL=srm://${target}:8443//dpm/${site_domain}/home/${voteam}/${subTree}/srmv1_Tfile.$$.$RANDOM
SURL=srm://${target}:8443//dpm/${site_domain}/home/${voteam}/${subTree}/srmv1_Tfile.${sfile}.$RANDOM
fi
# this for dpm at lxb0732 (JPB machine ... srmv1 ? RH73 - not GSIFTP enabled yet ?
#SURL=srm://lxb0732.cern.ch:8443//dpm/dteam/grodid/srm_test_suite_file.$$.$RANDOM
# this for dpm at lxb0739 (Classic - 1767 - CANNOT work - not SRM enabled !
#SURL=srm://lxb0739.cern.ch:8443//dpm/dteam/grodid/srm_test_suite_file.$$.$RANDOM
case "$target" in
# this for castorgrid
castor) SURL=srm://castorgrid.cern.ch:8443//castor/cern.ch/grid/dteam/srm_test_suite_file.$$.$RANDOM;;
# this for lxb1909 (Castor - 1760
lxb1909) SURL=srm://lxb1909.cern.ch:8443//castor/cern.ch/home/dteam/srm_test_suite_file.$$.$RANDOM;;
lxb1760) SURL=srm://lxb1760.cern.ch:8443//castor/cern.ch/home/dteam/srm_test_suite_file.$$.$RANDOM;;
# this for dcache at lxb1753 (dCache - 0740
lxb1753) SURL=srm://lxb1753.cern.ch:8443//pnfs/cern.ch/data/dteam/srm_test_suite_file.$$.$RANDOM;;
lxb0740) SURL=srm://lxb0740.cern.ch:8443//pnfs/cern.ch/data/dteam/srm_test_suite_file.$$.$RANDOM;;
esac
##### this for castorgrid
####if [ "$target" = "castor" ]
#### SURL=srm://castorgrid.cern.ch:8443//castor/cern.ch/grid/dteam/srm_test_suite_file.$$.$RANDOM
####
##### this for lxb1909 (Castor - 1760
####if [ "$target" = "lxb1909" ]
#### SURL=srm://lxb1909.cern.ch:8443//castor/cern.ch/home/dteam/srm_test_suite_file.$$.$RANDOM
####
##echo "[++]" ./$SRM_TEST $PROTO $SURL $SURL2
##exit 0
SURL2=$SURL.SECOND_FILE
BUG=0
SRM_TEST=srm_test
SRM_TEST=srm_testjiri_26
SRM_TEST=srm_testJiri
/bin/rm -f TESTFILE*
/bin/rm -f OUTPUT
# create file that would be used
echo "This is my test file." > TESTFILE
echo "This is my test file2." > TESTFILE2
#cp -p /boot/vmlinux-2.4.21-20.0.1.EL.cernsmp TESTFILE2
##GOODcp -p /boot/vmlinux-2.4.21-20.EL.cernsmp TESTFILE2
##??ln -sb /tmp/grodid/csec_trace.log TESTFILE2
##GG chmod +x ./my_gsiftp_in.sh
##GG chmod +x ./my_gsiftp_out.sh
##GG chmod +x ./my_rfcp_in.sh
##GG chmod +x ./my_rfcp_out.sh
##GG chmod +x ./my_dccp_in.sh
##GG chmod +x ./my_dccp_out.sh
## echo "[+] ./srm_test" $PROTO $SURL $SURL2
## chmod +x ./srm_test
## echo "***"
## ./srm_test $PROTO $SURL $SURL2
echo "[+]" ./$SRM_TEST $PROTO $SURL $SURL2
##GG chmod +x ./$SRM_TEST
echo "***"
##GG ./$SRM_TEST $PROTO $SURL $SURL2
$SRM_TEST $PROTO $SURL $SURL2
RETVAL=$?
echo "Return value from test suite is $RETVAL"
echo "***"
if [ $RETVAL -eq 1 ]; then
BUG=1
echo "There was some bug(s) during run of test suite."
echo "See the output and look for lines beginning with [!]"
echo "If error messages follow, this is probably due to previous SRM errors"
echo ""
echo "However if everything later passes, this doesn't mean that the SRM"
echo "implementation is OK - it just means that the files were correctly transmitted"
fi
# First file
BUGF=0
if ( ! [ -f TESTFILE ]; ) then
echo "[!] TESTFILE not found!"
BUGF=1
fi
if ( ! [ -f TESTFILE.x ]; ) then
echo "[!] TESTFILE.x not found!"
BUGF=1
fi
if ( ! [ -f TESTFILE.x.y.y ]; ) then
echo "[!] TESTFILE.x.y.y not found!"
BUGF=1
fi
if ( ! [ $BUGF -eq 1 ]; ) then
diff TESTFILE TESTFILE.x > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "[!] #1: Strange differ (diff of TESTFILE and TESTFILE.x)"
BUG=1
else
echo "[+] #1: PASSED (diff of TESTFILE and TESTFILE.x)"
fi
# this should differ
diff TESTFILE.x TESTFILE.x.y.y > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "[+] #2: PASSED (diff of TESTFILE.x and TESTFILE.x.y.y)"
else
echo "[!] #2: Strange equality (diff of TESTFILE.x and TESTFILE.x.y.y)"
BUG=1
fi
diff TESTFILE.x.y TESTFILE.x.y.y > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "[!] #3: Strange differ (diff of TESTFILE.x.y and TESTFILE.x.y.y)"
BUG=1
else
echo "[+] #3: PASSED (diff of TESTFILE.x.y and TESTFILE.x.y.y)"
fi
else
BUG=1
fi
# Second file
BUGF=0
if ( ! [ -f TESTFILE2 ]; ) then
echo "[!] TESTFILE2 not found!"
BUGF=1
fi
if ( ! [ -f TESTFILE2.x ]; ) then
echo "[!] TESTFILE2.x not found!"
BUGF=1
fi
if ( ! [ -f TESTFILE2.x.y.y ]; ) then
echo "[!] TESTFILE2.x.y.y not found!"
BUGF=1
fi
if ( ! [ $BUGF -eq 1 ]; ) then
diff TESTFILE2 TESTFILE2.x > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "[!] #1: Strange differ (diff of TESTFILE2 and TESTFILE2.x)"
BUG=1
else
echo "[+] #1: PASSED (diff of TESTFILE2 and TESTFILE2.x)"
fi
# this should differ
diff TESTFILE2.x TESTFILE2.x.y.y > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "[+] #2: PASSED (diff of TESTFILE2.x and TESTFILE2.x.y.y)"
else
echo "[!] #2: Strange equality (diff of TESTFILE2.x and TESTFILE2.x.y.y)"
BUG=1
fi
diff TESTFILE2.x.y TESTFILE2.x.y.y > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "[!] #3: Strange differ (diff of TESTFILE2.x.y and TESTFILE2.x.y.y)"
BUG=1
else
echo "[+] #3: PASSED (diff of TESTFILE2.x.y and TESTFILE2.x.y.y)"
fi
else
BUG=1
fi
# final word
if [ $BUG -eq 1 ]; then
echo "Final result: NOT passed all tests"
else
echo "Final result: PASSED all tests"
fi
exit $BUG
|