Commit 70bf7171 authored by Andrea Sciaba's avatar Andrea Sciaba
Browse files

HTML-free version

parent a90cf2b0
#!/bin/sh
#
# CE-cms-basic
#
# This test does the following things:
# - looks for the software area
# - sources the CMS environment and checks for errors
# - checks that CMS_PATH is defined
# - checks that the Site Local Config (SLC) exists
# - checks that the SLC defines: TFC, local stageout, sitename and Frontier
# - checks that the TFC exists
#
# String exit codes:
# SW_DIR_UNDEF: location of CMS software directory undefined
# SW_DIR_NOT_READABLE: CMS software directory not existent or unreadable
# NO_SETUP_SCRIPT: could not source cmsset_default.sh
# CMS_PATH_UNDEF: CMS_PATH is undefined
# NO_JOBCONFIG_DIR: ${CMS_PATH}/SITECONF/local/JobConfig does not exist
# NO_SITELOCALCONFIG:
# ${CMS_PATH}/SITECONF/local/JobConfig/site-local-config.xml does not exist
# NO_TFC: TFC information missing
# NO_LOCALSTAGEOUT: LocalStageOut information missing
# NO_SITENAME: Site name not found
# NO_FRONTIER_CONFIG: FroNtier information missing
# LOCAL_SITE_CONF_CVS_ERROR: site-local-config.xml different from CVS version
# since more than 72 hours
# LOCAL_SITE_CONF_CVS_WARNING: site-local-config.xml different from CVS version
# since less than 72 hours
# CVS_NO_ACCESS: cannot access CVS
# TFC_CVS_ERROR: TFC different from CVS version since more than 72 hours
# TFC_CVS_WARNING: TFC different from CVS version since less than 72 hours
info=0
note=0
warning=0
error=0
cat $SAME_SENSOR_HOME/tests/CMS-SAM-Banner.html
cp $SAME_SENSOR_HOME/tests/fetch-from-web2 .
echo "<h2>Preliminary checks</h2>"
echo "<pre>"
uname -a
date
echo "VOMS identity, timeleft (sec) and FQANs:"
voms-proxy-info -timeleft -identity -fqan
id
cp $SAME_SENSOR_HOME/tests/fetch-from-web .
cp $SAME_SENSOR_HOME/tests/CMS-SAM-Banner.html .
echo "</pre>"
echo "<h2>Checking software directory</h2>"
# Find software area
if [ -n "$OSG_GRID" ] ; then
[ -f $OSG_GRID/setup.sh ] && source $OSG_GRID/setup.sh
echo "<p>OSG Middleware</p>"
if [ -d $OSG_APP/cmssoft/cms ] ;then
SW_DIR=$OSG_APP/cmssoft/cms
echo "<p>Checking variable: \$OSG_APP/cmssoft/cms=$OSG_APP/cmssoft/cms</p>"
if [ -d $OSG_APP/cmssoft/cms ] ; then
SW_DIR=$OSG_APP/cmssoft/cms
elif [ -d $CVMFS/cms.cern.ch ] ; then
SW_DIR=$CVMFS/cms.cern.ch
echo "<p>Checking variable: \$CVMFS/cms.cern.ch=$CVMFS/cms.cern.ch</p>"
SW_DIR=$CVMFS/cms.cern.ch
elif [ -d /cvmfs/cms.cern.ch ] ; then
SW_DIR=/cvmfs/cms.cern.ch
echo "<p>Checking fallback location: /cvmfs/cms.cern.ch</p>"
SW_DIR=/cvmfs/cms.cern.ch
else
echo "<p>Cannot find CMS software area.</p>"
exit $SAME_ERROR
echo "ERROR: Cannot find CMS software in OSG node"
echo "summary: SW_DIR_UNDEF"
exit $SAME_ERROR
fi
elif [ -n "$VO_CMS_SW_DIR" ] ; then
echo "<p>gLite Middleware</p>"
SW_DIR=$VO_CMS_SW_DIR
echo "<p>VO_CMS_SW_DIR=$VO_CMS_SW_DIR</p>"
else
echo "<p>"
echo "ERROR: Neither VO_CMS_SW_DIR nor OSG_APP defined"
echo "<br />"
echo "summary: SW_DIR_UNDEF"
exit $SAME_ERROR
fi
ls -ld $SW_DIR
result=$?
echo "</pre>"
if [ $result != 0 ]
then
echo "<p>"
if [ ! -d $SW_DIR ] ; then
echo "SwArea: $SW_DIR"
echo "ERROR: software directory non existent or non readable"
echo "<br />"
echo "summary: NO_SW_DIR"
exit $SAME_ERROR
fi
if [ ! -f $SW_DIR/cmsset_default.sh ] ; then
echo "<p>"
echo "ERROR: cmssw setup file $SW_DIR/cmsset_default.sh not existing"
echo "<br />"
echo "summary: NO_SETUP_SCRIPT"
echo "summary: SW_DIR_NOT_READABLE"
exit $SAME_ERROR
fi
echo "<h2>Sourcing CMS environment</h2>"
# Source CMS environment
echo
echo "Printing CMS site local config information..."
echo
tmpfile=`mktemp /tmp/tmp.XXXXXXXXXX`
export SCRAM_ARCH=slc5_amd64_gcc462
echo "<pre>"
source $SW_DIR/cmsset_default.sh > /dev/null
source $SW_DIR/cmsset_default.sh > $tmpfile 2>&1
result=$?
echo "</pre>"
if [ $result != 0 ]
then
echo "<p>"
if [ $result != 0 ] ; then
cat $tmpfile
rm -f $tmpfile
echo "ERROR: CMS software initialisation script cmsset_default.sh failed"
echo "<br />"
echo "summary: NO_SETUP_SCRIPT"
exit $SAME_ERROR
else
echo "<p>OK</p>"
fi
rm -f $tmpfile
echo "<h2>Check existence of configuration directory</h2>"
echo "<pre>"
echo "CMS_PATH=$CMS_PATH"
echo "</pre>"
if [ -z $CMS_PATH ]; then
echo "<p>"
if [ -z "$CMS_PATH" ]; then
echo "ERROR: CMS_PATH not defined"
echo "<br />"
echo "summary: CMS_PATH_UNDEF"
exit $SAME_ERROR
fi
echo "CMS_PATH: $CMS_PATH"
if [ ! -d $CMS_PATH ] ; then
echo "<p>"
echo "ERROR: CMS_PATH directory $CMS_PATH not existing"
echo "<br />"
echo "summary: NO_CMS_PATH"
exit $SAME_ERROR
fi
if [ ! -d $CMS_PATH/SITECONF/local/JobConfig ] ; then
echo "<p>"
if [ ! -d ${CMS_PATH}/SITECONF/local/JobConfig ] ; then
echo "ERROR: JobConfig directory $CMS_PATH/SITECONF/local/JobConfig not existing"
echo "<br />"
echo "summary: NO_JOBCONFIG_DIR"
exit $SAME_ERROR
fi
echo "<p>OK</p>"
echo "<h2>Check existence of local configuration file</h2>"
ConfigFile=${CMS_PATH}/SITECONF/local/JobConfig/site-local-config.xml
echo "<pre>"
echo "Path: $ConfigFile"
echo "</pre>"
echo "SiteLocalConfig: $ConfigFile"
if [ ! -f $ConfigFile ] ; then
echo "<p>"
echo "ERROR: Local Configuration file site-local-config.xml not existing"
echo "<br />"
echo "summary: NO_SITELOCALCONFIG"
exit $SAME_ERROR
fi
echo "<p>Dump of Local Configuration file is <a href=\"#CfgDump\">here</a></p>"
echo "<h2>Check entries for TFC, local stage, site name and Squid</h2>"
grep -q "trivialcatalog" $ConfigFile
TFCPath=`sed -nr '/trivialcatalog_file/s/.*:(.+)\?.*$/\1/p' $ConfigFile | uniq`
status=$?
if [ $status != 0 ] ; then
echo "<p>ERROR: TrivialFileCatalog string missing</p>"
echo "ERROR: TrivialFileCatalog string missing"
errorSummary="summary: NO_TFC"
error=1
else
echo "TFCPath: $TFCPath"
fi
grep -q "local-stage-out" $ConfigFile
......@@ -150,303 +128,165 @@ if [ $status != 0 ] ; then
error=1
fi
grep -q "site name" $ConfigFile
SiteName=`sed -nr '/<site name/s/^.*\"(.*)\".*$/\1/p' $ConfigFile`
status=$?
if [ $status != 0 ] ; then
echo "<p>ERROR: site name string missing</p>"
errorSummary="summary: NO_SiteName"
echo "ERROR: site name string missing"
errorSummary="summary: NO_SITENAME"
error=1
else
echo "SiteName: $SiteName"
fi
subSiteName=""
subSiteName=`grep "subsite name" $ConfigFile | cut -d'"' -f2`
if [ -n "$subSiteName" ] ; then
echo "SubSiteName: $subSiteName"
subSiteName=_$subSiteName
fi
grep -q "frontier-connect" $ConfigFile
status=$?
if [ $status != 0 ] ; then
echo "<p>ERROR: Frontier Configuration string missing</p>"
echo "ERROR: Frontier Configuration string missing"
errorSummary="summary: NO_FRONTIER_CONFIG"
error=1
fi
echo "<h2>Check TFC file existence</h2>"
TFCfile=`grep "trivialcatalog" $ConfigFile | cut -d':' -f2| cut -d'?' -f1|head -1`
echo "<pre>"
echo "Path: $TFCfile"
echo "</pre>"
if [ ! -f $TFCfile ] ; then
echo "<p>ERROR: TrivialFileCatalg $TFCfile not existing</p>"
errorSummary="summary: NO_TFC file"
error=1
fi
if [ $error == 1 ] ; then
echo "<p>ERROR: invalid local configuration file $ConfigFile<br />"
echo "ERROR: invalid local configuration file $ConfigFile"
echo $errorSummary
exit $SAME_ERROR
fi
echo "<h2>Compare local configuration file and TFC with CVS</h2>"
siteName=`grep "site name" $ConfigFile | grep -v "subsite name" | cut -d'"' -f2`
let seconds=`date +%s`-`stat -c%Y $ConfigFile`
let localConfigFileAgeInHours=$seconds/3600
echo "<pre>"
echo "Config file is ${localConfigFileAgeInHours} hours old"
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 "SiteLocalConfigAge: ${localConfigFileAgeInHours} hours"
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\""
cvsUrlp="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/JobConfig/site-local-config${_subSiteName}.xml?rev=HEAD&amp;content-type=text/plain\""
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 "CVS copy: $cvsUrlp<br />"
./fetch-from-web $cvsUrl $ConfigFileFromCVS
echo "CVSCopy: $cvsUrl"
./fetch-from-web2 \"$cvsUrl\" $ConfigFileFromCVS
rc=$?
echo "rc = $rc"
echo "</pre>"
[ $rc == "$SAME_INFO" ] && info=1
[ $rc == "$SAME_NOTICE" ] && note=1
if [ $rc == "$SAME_OK" ] || [ $rc == "$SAME_INFO" ] ; then
if [ $rc == 0 ] ; then
diff -q -w -B $ConfigFile $ConfigFileFromCVS
if [ $? == 1 ] ; then asCvs=0; fi
if [ $asCvs == 0 ] ; then
noConfigDump=1
cvsMarkupUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/JobConfig/site-local-config${_subSiteName}.xml?view=markup\""
cvsMarkupUrl="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/$SiteName/JobConfig/site-local-config${subSiteName}.xml?view=markup"
ConfigFileMarkup=`mktemp /tmp/site-local-config-from-CVS-Markup.xml.XXX`
echo "<p>Fetch CVS Markup copy of local config from $cvsMarkupUrl</p>"
echo "<pre>"
./fetch-from-web $cvsMarkupUrl $ConfigFileMarkup
rc=$?
echo "rc = $rc"
echo "</pre>"
[ $rc == "$SAME_INFO" ] && info=1
[ $rc == "$SAME_NOTICE" ] && note=1
cvsFileDate=`grep "<em>" $ConfigFileMarkup |head -1|awk -F '<em>|</em>' '{print $2 }'`
./fetch-from-web2 \"$cvsMarkupUrl\" $ConfigFileMarkup
cvsFileDate=`grep "<em>" $ConfigFileMarkup | head -1 | awk -F '<em>|</em>' '{print $2 }'`
let seconds=`date +%s`-`date +%s -d "$cvsFileDate"`
let cvsFileAgeInHours=$seconds/3600
echo "<p>CVS version of Local Configuration file is ${cvsFileAgeInHours} hours old</p>"
echo "<pre>"
echo "CVSConfigFileAge: ${cvsFileAgeInHours} hours"
if [ $localConfigFileAgeInHours -gt 72 ] && [ $cvsFileAgeInHours -gt 72 ] ; then
error=1
echo "</pre>"
echo "<p>ERROR: local site configuration file differ from CVS</p>"
echo "ERROR: local site configuration file differ from CVS"
errorSummary="summary: LOCAL_SITE_CONF_CVS_ERROR"
else
warning=1
echo "</pre>"
echo "<p>WARNING: local site configuration file differ from CVS"
echo "<br />"
echo "<will become error if this difference lasts more then 72h</p>"
echo "WARNING: local site configuration file differ from CVS"
errorSummary="summary: LOCAL_SITE_CONF_CVS_WARNING"
fi
diffList=`mktemp /tmp/diflist.XXXX`
diff $ConfigFile $ConfigFileFromCVS > $diffList
cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
cat $diffList
rm -f $diffList
else
echo "<p>OK</p>"
echo "Site Local Config CVS check: OK"
fi
rm -f $ConfigFileFromCVS
else
echo "<p>NOTICE: failed to access CVS Web repository</p>"
echo "NOTICE: failed to access CVS Web repository"
errorSummary="summary: CVS_NO_ACCESS"
note=1
fi
TFCfileName=`echo $TFCfile | awk -F'/' '{print $NF}'`
echo "<pre>"
let seconds=`date +%s`-`stat -c%Y $TFCfile`
let seconds=`date +%s`-`stat -c%Y $TFCPath`
let localTFCfileAgeInHours=$seconds/3600
echo "Local TFC file is ${localTFCfileAgeInHours} hours old"
echo "LocalTFCAge: ${localTFCfileAgeInHours} hours"
asCvs=1
TFCfileName=`echo $TFCPath | awk -F'/' '{print $NF}'`
cvsUrl="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${SiteName}/PhEDEx/${TFCfileName}?rev=HEAD&content-type=text/plain"
cvsUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/PhEDEx/${TFCfileName}?rev=HEAD&content-type=text/plain\""
cvsUrlp="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/PhEDEx/${TFCfileName}?rev=HEAD&amp;content-type=text/plain\""
echo "TFC file name: $TFCfileName"
TfcFileFromCVS=`mktemp /tmp/storage-from-CVS.xml.XXXX`
echo "CVS copy: $cvsUrlp"
./fetch-from-web $cvsUrl $TfcFileFromCVS
echo "TFCCVSCopy: $cvsUrl"
./fetch-from-web2 \"$cvsUrl\" $TfcFileFromCVS
rc=$?
echo "rc = $rc"
[ $rc == "$SAME_INFO" ] && info=1
[ $rc == "$SAME_NOTICE" ] && note=1
echo "</pre>"
if [ $rc == "$SAME_OK" ] || [ $rc == "$SAME_INFO" ] ; then
diff -q -w -B $TFCfile $TfcFileFromCVS
if [ $rc == 0 ] ; then
diff -q -w -B $TFCPath $TfcFileFromCVS
if [ $? == 1 ] ; then asCvs=0; fi
if [ $asCvs == 0 ] ; then
noTFCDump=1
cvsMarkupUrl="\"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/PhEDEx/${TFCfileName}?view=markup\""
cvsMarkupUrl="http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/SITECONF/${siteName}/PhEDEx/${TFCfileName}?view=markup"
TfcFileMarkup=`mktemp /tmp/TFC-from-CVS-Markup.xml.XXX`
echo "<pre>Fetch CVS Markup copy of TFC from $cvsMarkupUrl"
./fetch-from-web $cvsMarkupUrl $TfcFileMarkup
rc=$?
echo "rc = $rc"
echo "</pre>"
[ $rc == "$SAME_INFO" ] && info=1
[ $rc == "$SAME_WARNING" ] && warning=1
./fetch-from-web2 \"$cvsMarkupUrl\" $TfcFileMarkup
cvsFileDate=`grep "<em>" $TfcFileMarkup |head -1|awk -F '<em>|</em>' '{print $2 }'`
let seconds=`date +%s`-`date +%s -d "$cvsFileDate"`
let cvsFileAgeInHours=$seconds/3600
echo "<pre>"
echo "CVS version of Local Configuration file is ${cvsFileAgeInHours} hours old"
echo "</pre>"
echo "CVSTFCAge: ${cvsFileAgeInHours} hours"
if [ $localTFCfileAgeInHours -gt 72 ] && [ $cvsFileAgeInHours -gt 72 ] ; then
error=1
echo "<p>ERROR: local Trivial Catalog File file differ from CVS</p>"
echo "ERROR: local Trivial Catalog File file differ from CVS"
errorSummary="summary: TFC_CVS_ERROR"
else
echo "<p>WARNING: local Trivial Catalog File differ from CVS<br />"
echo "will become error if this difference lasts more then 72h</p>"
echo "WARNING: local Trivial Catalog File differ from CVS"
errorSummary="summary: TFC_CVS_WARNING"
fi
diffList=`mktemp /tmp/diflist.XXXX`
diff $TFCfile $TfcFileFromCVS > $diffList
echo "<pre>"
cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
cat $diffList
rm -f $diffList
else
echo "<p>OK</p>"
echo "TFC CVS check: OK"
fi
rm -f $TfcFileFromCVS
else
echo "<p>NOTICE: failed to access CVS Web repository</p>"
echo "NOTICE: failed to access CVS Web repository"
errorSummary="summary: CVS_NO_ACCESS"
note=1
fi
echo "<p>Dump of TFC file is <a href=\"#TFCDump\">here</a></p>"
echo "<h2>Check commands for remote stageout</h2>"
echo "<p>Needs at least ( lcg_utils 1.6.7 and gfal 1.10.8 ) or ( srmcp 2.0 )</p>"
echo "<pre>"
stageOutError=1
note=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
note=0
fi
fi
fi
echo "</pre>"
if [ $note == 1 ] ; then
echo "<p>NOTE: proper version of lcg-cp not available</p>"
fi
echo "<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`
if [ -n "$srmcpV1" -a $srmcpV1 -ge 2 ] ; then
stageOutError=0
fi
fi
echo "</pre>"
if [ $stageOutError == 1 ] ; then
echo "<p>ERROR: No validated command for remote stageout available</p>"
error=1
else
echo "<p>OK</p>"
fi
echo "<hr />"
echo "<h2>Dump of local configuration files</h2>"
if [ -n "$noConfigDump" ] ; then
echo "<h3><a name="CfgDump"></a>Configuration File Dump</h3>"
echo "<pre>"
cat $ConfigFile | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
echo "Site Local Config dump:"
cat $ConfigFile
fi
if [ -n "$noTFCDump" ] ; then
echo "<h3><a name="TFCDump"></a>TFC file Dump</h3>"
echo "<pre>"
cat $TFCfile | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "</pre>"
echo "TFC dump:"
cat $TFCPath
fi
echo '<h1><a name="summary"> Test Summary</a></h1>'
if [ $error == 1 ]
then
echo "<p>ERROR</p>"
echo $errorSummary
exit $SAME_ERROR
fi
if [ $warning == 1 ]
then
echo "<p>WARNING</p>"
echo $errorSummary
exit $SAME_WARNING
fi
if [ $note == 1 ]
then
echo "<p>NOTE</p>"
echo $errorSummary
exit $SAME_WARNING
fi
if [ $info == 1 ]
then
echo "<p>INFO</p>"
echo "summary: OK"
exit $SAME_OK
fi
echo "<p>OK</p>"
echo
echo "All checks OK"
echo "summary: OK"
exit $SAME_OK
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment