-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathstageout_verify.sh
executable file
·89 lines (87 loc) · 3.08 KB
/
stageout_verify.sh
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
#!/bin/sh
#
trap 'exit 1' 1 2 3 15
trap '/bin/rm -f /tmp/stageout_verify_$$.bin 1> /dev/null 2>&1' 0
#
#
#
# destinations the test can use:
voms-proxy-init -voms cms
voms-proxy-info -all
KNOWN_ERRORS="el9:srm"
STAGEOUT="gsiftp://gridftp.echo.stfc.ac.uk/cms: \
gsiftp://eoscmsftp.cern.ch/eos/cms \
srm://srmcms.pic.es:8443/srm/managerv2?SFN=/pnfs/pic.es/data/cms/disk \
srm://cmssrm-kit.gridka.de:8443/srm/managerv2?SFN=/pnfs/gridka.de/cms/disk-only \
davs://cmswebdav-kit.gridka.de:2880/pnfs/gridka.de/cms/disk-only \
davs://srmcms.pic.es:8459/pnfs/pic.es/data/cms/disk \
davs://ceph-svc02.gridpp.rl.ac.uk:1094/ \
davs://ceph-gw7.gridpp.rl.ac.uk:1094/ \
davs://eoscms.cern.ch:443/eos/cms \
davs://webdav.echo.stfc.ac.uk:1094/ \
root://eoscms.cern.ch//eos/cms \
root://xrootd.echo.stfc.ac.uk/ \
root://xrootd-cmst1-door.pic.es:1094//pnfs/pic.es/data/cms/disk"
PREFIX="/store/test/cmsbuild"
#
# create a small 64kB test file:
/usr/bin/head -c 65536 </dev/urandom 1>/tmp/stageout_verify_$$.bin
#
# calculate Adler-32 checksum:
CHKSUM=`/usr/bin/xrdadler32 /tmp/stageout_verify_$$.bin | /usr/bin/awk '{print $1; exit}'`
echo "Adler-32 checksum of test file stageout_verify_$$.bin is ${CHKSUM}"
#
# loop over stage-out protocols and verify at a test site:
# overall fails protocols:
MRC=""
SUMMARY=""
echo ""
OS_VER=$(rpm -q --queryformat '%{RELEASE}' glibc | sed 's|.*\.el|el|;s|_.*||')
echo "OS: ${OS_VER}, Known errors: ${KNOWN_ERRORS}"
for PROTO in root gsiftp srm davs; do
PASSED=0
TOTAL=0
echo "Stage-out protocol ${PROTO} .... "
#
for DEST in ${STAGEOUT}; do
if [[ "${DEST}" =~ ^${PROTO}:// ]]; then
let TOTAL=$TOTAL+1
echo " using ${DEST}"
/usr/bin/gfal-copy -t 90 --checksum ADLER32:${CHKSUM} \
file:///tmp/stageout_verify_$$.bin \
${DEST}${PREFIX}/stageout_verify_$$.bin 1>/dev/null
RC=$?
echo " gfal-copy, rc=${RC}"
if [ ${RC} -eq 0 ]; then
let PASSED=$PASSED+1
/usr/bin/gfal-rm -t 90 ${DEST}${PREFIX}/stageout_verify_$$.bin 1>/dev/null
echo " gfal-rm, rc=$?"
fi
fi
done
SUMMARY="${SUMMARY} ${PROTO}($PASSED/$TOTAL)"
KNOWN_ERROR=$(echo "${KNOWN_ERRORS}" | tr ' ' '\n' | grep "^${OS_VER}:${PROTO}$" | wc -l)
echo "Know error: ${OS_VER}:${PROTO}: ${KNOWN_ERROR}"
if [ $PASSED -eq 0 ] ; then
echo "Failed: $PASSED/$TOTAL"
if [ $KNOWN_ERROR -eq 0 ] ; then
MRC="${MRC} ${PROTO}($PASSED/$TOTAL)"
else
echo " OK: Ignoring this failure as ${PROTO} is part of known error for ${OS_VER}."
fi
else
echo "Passed: $PASSED/$TOTAL"
if [ $KNOWN_ERROR -gt 0 ] ; then
echo " Fail: Passed but it is suppose to fail, please update KNOWN_ERRORS if ${PROTO} works on ${OS_VER}"
MRC="${MRC} ${PROTO}($PASSED/$TOTAL)"
fi
fi
echo ""
done
#
echo "Test Summary:${SUMMARY}"
if [ "${MRC}" != "" ]; then
echo "Failed protocol(s): ${MRC}"
exit 1
fi
exit 0