CE-cms-dummy 9.65 KB
Newer Older
Stefano Belforte's avatar
Stefano Belforte committed
1
#!/bin/sh
Stefano Belforte's avatar
Stefano Belforte committed
2

Stefano Belforte's avatar
Stefano Belforte committed
3
4
5
6
7
8
9
10
info=0
note=0
warning=0
error=0

cat CMS-SAM-Banner.html
echo '<h1><a href="#summary">Jump to test summary</a></h1>'
echo "<h2>Preliminary checks</h2>"
11
echo "<pre>"
Stefano Belforte's avatar
Stefano Belforte committed
12
echo "version 1-11 21:00"
Stefano Belforte's avatar
Stefano Belforte committed
13
set -x
14
15
16
17
uname -a
date
voms-proxy-info -identity -fqan
id
Stefano Belforte's avatar
Stefano Belforte committed
18
cp -v $SAME_SENSOR_HOME/tests/fetch-from-web .
Stefano Belforte's avatar
Stefano Belforte committed
19
20
#ls -l fetch-from-web
cp -v $SAME_SENSOR_HOME/tests/CMS-SAM-banner.html .
Stefano Belforte's avatar
Stefano Belforte committed
21
env|grep SAME
Stefano Belforte's avatar
Stefano Belforte committed
22
set +x
Stefano Belforte's avatar
Stefano Belforte committed
23
echo "</pre>"
24

Stefano Belforte's avatar
Stefano Belforte committed
25
echo "<h2>Checking software directory for CMS VO</h2>"
26
if [ -n "$OSG_APP" ] ; then
Stefano Belforte's avatar
Stefano Belforte committed
27
    SW_DIR=$OSG_APP/cmssoft/cms
Stefano Belforte's avatar
Stefano Belforte committed
28
29
    [ -f $OSG_GRID/setup.sh ] && source $OSG_GRID/setup.sh
    echo "Checking variable: \$OSG_APP/cmssoft/cms=$OSG_APP/cmssoft/cms"
30
31
elif [ -n "$VO_CMS_SW_DIR" ] ; then
    SW_DIR=$VO_CMS_SW_DIR
Stefano Belforte's avatar
Stefano Belforte committed
32
    echo "Checking variable: \$VO_CMS_SW_DIR=$VO_CMS_SW_DIR"
Stefano Belforte's avatar
Stefano Belforte committed
33
34
else
    echo "ERROR: Neither VO_CMS_SW_DIR nor OSG_APP defined"
Stefano Belforte's avatar
Stefano Belforte committed
35
    echo "summary: SW_DIR_UNDEF"
Stefano Belforte's avatar
Stefano Belforte committed
36
37
38
    exit $SAME_ERROR
fi
echo "<pre>"
Stefano Belforte's avatar
Stefano Belforte committed
39
40
set -x
ls -ld $SW_DIR
Stefano Belforte's avatar
Stefano Belforte committed
41
result=$?
Stefano Belforte's avatar
Stefano Belforte committed
42
set +x
Stefano Belforte's avatar
Stefano Belforte committed
43
echo "</pre>"
Stefano Belforte's avatar
Stefano Belforte committed
44
45
echo

Stefano Belforte's avatar
Stefano Belforte committed
46
47
if [ $result != 0 ]
    then
Stefano Belforte's avatar
Stefano Belforte committed
48
49
    echo "ERROR: software directory non existent or non readable"
    echo "summary: NO_SW_DIR"
Stefano Belforte's avatar
Stefano Belforte committed
50
51
    exit $SAME_ERROR
fi
Stefano Belforte's avatar
Stefano Belforte committed
52
53
54
55
56
57

if [ ! -f $SW_DIR/cmsset_default.sh ] ; then
    echo "<h3>"
    echo "ERROR: cmssw setup file $SW_DIR/cmsset_default.sh not existing"
    echo "</h3>"
    echo "summary: NO_SETUP_SCRIPT"
Stefano Belforte's avatar
Stefano Belforte committed
58
59
60
    exit $SAME_ERROR
fi

Stefano Belforte's avatar
Stefano Belforte committed
61
62
echo "<h2>Sourcing the CMS environment</h2>"
export SCRAM_ARCH=slc4_ia32_gcc345
Stefano Belforte's avatar
Stefano Belforte committed
63
echo "<pre>"
Stefano Belforte's avatar
Stefano Belforte committed
64
source $SW_DIR/cmsset_default.sh
65
66
result=$?
echo "</pre>"
Stefano Belforte's avatar
Stefano Belforte committed
67

Stefano Belforte's avatar
Stefano Belforte committed
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
if [ $result != 0 ]
    then
    echo "<h3>"
    echo "ERROR: CMS software initialisation script cmsset_default.sh failed"
    echo "summary: NO_SETUP_SCRIPT"
    echo "</h3>"
    exit $SAME_ERROR
fi

echo "<h2>Make sure configuration directory is there</h2>"
echo "Checking variable: \$CMS_PATH=$CMS_PATH"
echo "<p>"
if [ -z $CMS_PATH ]; then
    echo "<h3>"
    echo "ERROR: CMS_PATH not defined"
    echo "summary: CMS_PATH_UNDEF"
    echo "</h3>"
    exit $SAME_ERROR
fi

if [ ! -d $CMS_PATH ] ; then
    echo "<h3>"
    echo "ERROR: CMS_PATH directory $CMS_PATH not existing"
    echo "summary: NO_CMS_PATH"
    echo "</h3>"
    exit $SAME_ERROR
fi

if [ ! -d $CMS_PATH/SITECONF/local/JobConfig ] ; then
    echo "<h3>"
    echo "ERROR: JobConfig directory $CMS_PATH/SITECONF/local/JobConfig not existing"
    echo "summary: NO_JOBCONFIG_DIR"
    echo "</h3>"
    exit $SAME_ERROR
fi

echo "<p>"
echo "OK"

echo "<h2>Make sure configuration file exists</h2>"

ConfigFile=${CMS_PATH}/SITECONF/local/JobConfig/site-local-config.xml
echo "Configuration file: $ConfigFile"
echo "<p>"

if [ ! -f $ConfigFile ] ; then
    echo "<h3>"
    echo "ERROR: Local Configuration file site-local-config.xml not existing"
    echo "summary: NO_SITELOCALCONFIG"
    echo "</h3>"
    exit $SAME_ERROR
fi
echo "<p>"
echo "OK"
echo "dump of Local Configuration file is <a href=\"#CfgDump\">here</a>"

echo "<h2>Make sure local configuration file has entries for TriviaFileCatalog,
local stage, site name and Squid</h2>"

grep -q "trivialcatalog" $ConfigFile
status=$?
if [ $status != 0 ] ; then
    echo "ERROR: TrivialFileCatlog string missing"
    errorSummary="summary: NO_TFC"
    error=1
fi

grep -q "local-stage-out" $ConfigFile
status=$?
if [ $status != 0 ] ; then
    echo "ERROR: LocalStageOut string missing"
    errorSummary="summary: NO_LOCALSTAGEOUT"
    error=1
fi

grep -q "site name" $ConfigFile
status=$?
if [ $status != 0 ] ; then
    echo "ERROR: site name string missing"
    errorSummary="summary: NO_SiteName"
    error=1
fi

grep -q "frontier-connect" $ConfigFile
status=$?
if [ $status != 0 ] ; then
    echo "ERROR: Frontier Configuration string missing"
    errorSummary="summary: NO_FRONTIER_CONFIG"
    error=1
fi

if [ $error == 0 ] ; then
 echo "<p>"
 echo "OK"
fi

echo "<p>"

echo "<h2>Make sure TFC file is where config file says it should be</h2>"
TFCfile=`grep "trivialcatalog" $ConfigFile | cut -d':' -f2| cut -d'?' -f1|head -1`
echo "Checking file: $TFCfile"

if [ ! -f $TFCfile ] ; then
    echo "ERROR: TrivialFileCatalg $TFCfile not existing"
    errorSummary="summary: NO_TFC file"
    error=1
fi
#if [ $err == 1 ] ; then
#    exit $SAME_ERROR
#fi

echo "<p>"
echo "OK"
echo "<p>"

if [ $error == 1 ] ; then
    echo "<h3>"
    echo "ERROR: invalid local configuration file $ConfigFile"
    echo $errorSummary
    echo "</h3>"
Stefano Belforte's avatar
Stefano Belforte committed
188
189
fi

Stefano Belforte's avatar
Stefano Belforte committed
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
echo "<h2>Compare local configuration file and TFC with CVS</h2>"

siteName=`grep "site name" $ConfigFile | grep -v "subsite name" | cut -d'"' -f2`
echo "siteName =" $siteName
subSiteName=`grep "subsite name" $ConfigFile | cut -d'"' -f2`
_subSiteName=
if [ "x$subSiteName" == "x" ] ; then
   echo "subSiteName =" $subSiteName
else
   echo "subSiteName =" $subSiteName
   _subSiteName=_`echo $subSiteName`
fi
echo "<br>"

asCvs=1
cvsUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/JobConfig/site-local-config${_subSiteName}.xml?rev=HEAD&content-type=text/plain\""
ConfigFileFromCVS=`mktemp /tmp/site-local-config-from-CVS.xml.XXX`
echo "Fetch CVS copy of local config from $cvsUrl<br>"
./fetch-from-web $cvsUrl $ConfigFileFromCVS
rc=$?
echo "rc = $rc <br>"
[ $rc == $SAME_INFO ] && info=1
[ $rc == $SAME_WARNING ] && warning=1

#if [ $rc == $SAME_WARNING ] || [ $rc == $SAME_ERROR ] ; then
#  echo "<br>INFO: failed to access CVS Web repository<bre>"
#else


if [ $rc == $SAME_OK ] || [ $rc == $SAME_INFO ] ; then
  diff -q -w -B $ConfigFile $ConfigFileFromCVS
  if [ $? == 1 ] ; then asCvs=0; fi
  echo "<br>"
  if [ $asCvs == 0 ] ; then
    error=1
    echo "<strong>ERROR: local site configuration file differ from CVS</strong>"
    diffList=`mktemp /tmp/diflist.XXXX`
    diff $ConfigFile $ConfigFileFromCVS > $diffList
    echo "<pre>"
    cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
    echo "</pre>"
    rm -f $diffList
  else
    echo "OK local site configuration file agrees with CVS copy"
    echo "<br>"
  fi
  rm -f $ConfigFileFromCVS
else
  echo "<br>INFO: failed to access CVS Web repository<bre>"
  info=1
Stefano Belforte's avatar
Stefano Belforte committed
240
fi
Stefano Belforte's avatar
Stefano Belforte committed
241
242
243
244
echo "<br>"

echo "dump of Local Configuration file is <a href=\"#CfgDump\">here</a>"
echo "<br>"
Stefano Belforte's avatar
Stefano Belforte committed
245

Stefano Belforte's avatar
Stefano Belforte committed
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292

asCvs=1
cvsUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/PhEDEx/storage${_subSiteName}.xml?rev=HEAD&content-type=text/plain\""
TfcFileFromCVS=`mktemp /tmp/storage-from-CVS.xml.XXXX`
echo "Fetch CVS copy of TFC from $cvsUrl<br>"
./fetch-from-web $cvsUrl $TfcFileFromCVS
rc=$?
echo "rc = $rc <br>"
[ $rc == $SAME_INFO ] && info=1
[ $rc == $SAME_WARNING ] && warning=1

#if [ $rc == $SAME_WARNING ] || [ $rc == $SAME_ERROR ] ; then
#  echo "<br>INFO: failed to access CVS Web repository<bre>"
#else
if [ $rc == $SAME_OK ] || [ $rc == $SAME_INFO ] ; then
  diff -q -w -B $TFCfile $TfcFileFromCVS
  if [ $? == 1 ] ; then asCvs=0; fi
  echo "<br>"
  if [ $asCvs == 0 ] ; then
    error=1
    echo "<strong>ERROR: local Trivial Catalog File file differ from CVS</strong>"
    diffList=`mktemp /tmp/diflist.XXXX`
    diff $TFCfile $TfcFileFromCVS > $diffList
    echo "<pre>"
    cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
    echo "</pre>"
    rm -f $diffList
  else
    echo "OK local Trivial File Catalog file agrees with CVS copy"
    echo "<br>"
  fi
  rm -f $TfcFileFromCVS
else
  echo "<br>INFO: failed to access CVS Web repository<bre>"
  info=1
fi

echo "<p>dump of TFC file is <a href=\"#TFCDump\">here</a>"


echo "<p>"


echo "<h2>Verify presence of commands needed for remote stageout</h2>"
echo "Needs at least ( lcg_utils 1.6.7 and gfal 1.10.8 ) or ( srmcp 2.0 ) " 

echo "<p>"
293
echo "<pre>"
Stefano Belforte's avatar
Stefano Belforte committed
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
stageOutError=1

which lcg-cp
rc=$?
if [ $rc == 0 ] ; then
  lcg-cp --version
  lcgVersion=`lcg-cp --version|grep "lcg_util"|cut -d'-' -f2`
  gfalVersion=`lcg-cp --version|grep GFAL|cut -d'-' -f3`
  lcgV1=`echo $lcgVersion|cut -d. -f1`
  lcgV2=`echo $lcgVersion|cut -d. -f2`
  lcgV3=`echo $lcgVersion|cut -d. -f3`
  gfalV1=`echo $gfalVersion|cut -d. -f1`
  gfalV2=`echo $gfalVersion|cut -d. -f2`
  gfalV3=`echo $gfalVersion|cut -d. -f3`
  lcgOK=0
  if [ $lcgV1 -gt 1 ] ; then
    lcgOK=1
  else
    if [ $lcgV1 -eq 1 ] && [ $lcgV2 -gt 6 ] ; then
      lcgOK=1
    else
      if [ $lcgV2 -eq 6 ] && [ $lcgV3 -ge 7 ] ; then
	lcgOK=1
      fi
    fi
  fi
  gfalOK=0
  if [ $gfalV1 -gt 1 ] ; then
    gfalOK=1
  else
    if [ $gfalV1 -eq 1 ] && [ $gfalV2 -gt 10 ] ; then
      gfalOK=1
    else
      if [ $gfalV2 -eq 10 ] && [ $gfalV3 -ge 8 ] ; then
	 gfalOK=1
      fi
    fi
  fi

  if [ $lcgOK == 1 ] ; then
      if [ $gfalOK == 1 ] ; then
	  stageOutError=0
      fi
  fi
fi

echo "</pre><p><pre>"

which srmcp
rc=$?

if [ $rc == 0 ] ; then
  srmcp -version | grep -v WARNING
  srmcpVersion=`srmcp -version 2>&1|egrep "Client version"|awk '{print $(NF)'}`
  srmcpV1=`echo $srmcpVersion|cut -d. -f1`
  srmcpV2=`echo $srmcpVersion|cut -d. -f2`
#  srmcpV3=`echo $srmcpVersion|cut -d. -f3`
  if [ $srmcpV1 -ge 2 ] ; then
      stageOutError=0
  fi
fi


echo "</pre>"
if [ $stageOutError == 1  ] ; then
    echo "ERROR: No validated command for remote stageout available"
    error=1
else
    echo "OK"
fi
echo "<p>"




echo "<p>"
echo "<hr>"
echo "<p>"


echo "<h2>Dump of local configuration files</h2><br>"

echo "<h3><a name="CfgDump"></a>Configuration File Dump</h3><pre>"
cat $ConfigFile  | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
Stefano Belforte's avatar
Stefano Belforte committed
378
379
echo "</pre>"

Stefano Belforte's avatar
Stefano Belforte committed
380
381
382
echo "<h3><a name="TFCDump"></a>TFC file Dump</h3><pre>"
cat $TFCfile  | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
Stefano Belforte's avatar
Stefano Belforte committed
383

Stefano Belforte's avatar
Stefano Belforte committed
384
385
386
387
388
389
390
echo '<h1><a name="summary"> Test Summary</a></h1><p>'


if [ $error == 1 ]
then
  echo "<p><strong> ERROR </strong></p>"
  exit $SAME_ERROR
391
392
fi

Stefano Belforte's avatar
Stefano Belforte committed
393
394
395
396
397
398
399
400
401
402
if [ $warning == 1 ]
then
  echo "<p><strong> WARNING </strong></p>"
  exit $SAME_WARNING
fi

if [ $note == 1 ]
then
  echo "<p><strong> NOTE </strong></p>"
  exit $SAME_NOTE
403
404
fi

Stefano Belforte's avatar
Stefano Belforte committed
405
406
407
408
if [ $info == 1 ]
then
  echo "<p><strong> INFO </strong></p>"
  exit $SAME_INFO
Stefano Belforte's avatar
Stefano Belforte committed
409
fi
410

411

Stefano Belforte's avatar
Stefano Belforte committed
412
echo "<p><strong> OK </strong></p>"
Stefano Belforte's avatar
Stefano Belforte committed
413
exit $SAME_OK