Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
etf
cmssam
Commits
5c33e6b8
Commit
5c33e6b8
authored
Oct 02, 2012
by
Andrea Sciaba
Browse files
Removed HTML
parent
d7d5d5c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
SiteTests/testjob/tests/AnalysisTest.sh
View file @
5c33e6b8
#!/bin/sh
#
# Choose CMSSW version
#
cmsswvsn
=
CMSSW_5_3_1
#
# Print CMS_PATH
#
printf
"CMS_PATH
$CMS_PATH
\n
"
#
# Check that scramv1 command was defined by . $CMS_PATH/cmsset_default.sh
#
which scramv1
>
/dev/null 2>&1
sset
=
$?
if
[
$sset
-ne
0
]
then
printf
"AnalysisTest.sh: Error. scramv1 not found
\n
"
echo
"ERROR: scramv1 not found"
echo
"summary: SCRAM_NOT_FOUND"
exit
$SAME_ERROR
fi
#
# Get Working Directory
#
current
=
`
pwd
`
#
# Set up CMSSW
#
# Set up CMSSW
tmpfile
=
`
mktemp
/tmp/tmp.scram.XXXXXXXXXX
`
printf
"scramv1 project CMSSW
$cmsswvsn
... starting
\n
"
echo
"scramv1 project CMSSW
$cmsswvsn
... starting"
scramv1 project CMSSW
$cmsswvsn
>
$tmpfile
2>&1
scms
=
$?
if
[
$scms
-ne
0
]
then
cat
$tmpfile
printf
"AnalysisTest.sh: Error.
$cmsswvsn
not available
\n
"
#
# temporarely end with WARNING, not ERROR to allow for SL4 CE's
#exit $SAME_ERROR
exit
$SAME_WARNING
echo
"ERROR:
$cmsswvsn
not available"
echo
"summary: CMSSW_NOT_FOUND"
exit
$SAME_ERROR
fi
tail
-5
$tmpfile
printf
"scramv1 project CMSSW
$cmsswvsn
... completed
\n
"
#
cd
$cmsswvsn
/src
export
SCRAM_ARCH
=
`
scramv1
arch
`
printf
"scramv1 runtime -sh ... starting
\n
"
eval
`
scramv1 runtime
-sh
`
printf
"scramv1 runtime -sh ... completed
\n
"
#
# Return to working directory
#
cd
$current
#
# There are all files available in SAM dataset, which is at all sites
#
/bin/cat
>
possible-input-files
<<
EOI
/store/mc/SAM/GenericTTbar/GEN-SIM-RECO/CMSSW_5_3_1_START53_V5-v1/0013/CE4D66EB-5AAE-E111-96D6-003048D37524.root
/store/mc/SAM/GenericTTbar/GEN-SIM-RECO/CMSSW_5_3_1_START53_V5-v1/0013/C4FA6C05-51AE-E111-B9BA-001D09F295A1.root
/store/mc/SAM/GenericTTbar/GEN-SIM-RECO/CMSSW_5_3_1_START53_V5-v1/0013/52D06725-4BAE-E111-A059-001D09F252DA.root
/store/mc/SAM/GenericTTbar/GEN-SIM-RECO/CMSSW_5_3_1_START53_V5-v1/0013/3E573418-4BAE-E111-B0CD-BCAEC532971D.root
EOI
#
nFiles
=
`
cat
possible-input-files |
wc
-l
`
#
#
p
ick a randm
on
integer in [1,nFiles]
#
P
ick a rand
o
m integer in [1,nFiles]
d
=
`
date
+%N|tr
-d
0
`
let
r
=
d%nFiles+1
#
echo
"Will use file N.
$r
fom possible input files"
nl
=
0
until
[
$nl
-eq
$r
]
...
...
@@ -81,11 +60,8 @@ done < possible-input-files
inputFile
=
$line
echo
inputFile:
$inputFile
#
# Create configuration file for cmsRun followin example in
# Create configuration file for cmsRun following the example in
# http://cmslxr.fnal.gov/lxr/source/FWCore/Integration/test/testRunMergeMERGE_cfg.py#006
#
/bin/cat
>
analysis_test.py
<<
EOI
import FWCore.ParameterSet.Config as cms
...
...
@@ -105,54 +81,45 @@ process.out = cms.OutputModule("PoolOutputModule",
process.e = cms.EndPath(process.out)
EOI
echo
""
echo
"================= cmsRun configuration file: analysis_test.py ====================="
echo
""
cat
analysis_test.py
echo
""
start
=
`
date
+%s
`
#
# Run cmsRun
#
echo
echo
"START TIME:
`
date
`
--> running cmsRun -j fjr.xml -p analysis_test.py"
echo
start
=
`
date
+%s
`
cmsRun
-j
fjr.xml
-p
analysis_test.py 2>&1
srun
=
$?
#echo ""
#echo "================= trimmed framework job report file: fjr.xml ====================="
#echo ""
#cat fjr.xml | grep -v Branch | grep -v LumiSection | grep -v RunNumber | sed 's/</\</g' | sed 's/>/\>/g'
#echo "=================================================================================="
#echo ""
echo
"
`
date
`
--> DONE"
echo
"END TIME:
`
date
`
"
stop
=
`
date
+%s
`
echo
"ELAPSED TIME:
$[
$stop
-
$start
] seconds"
echo
"ELAPSED TIME:
$[
$stop
-
$start
] s"
echo
if
[
$srun
-ne
0
]
;
then
echo
""
echo
"================= cmsRun configuration file: analysis_test.py ====================="
echo
""
cat
analysis_test.py
echo
""
fi
#
# Check FJR for errors
#
grep
-q
"FrameworkError "
fjr.xml
sfjr
=
$?
if
[
$sfjr
-eq
0
]
then
printf
"AnalysisTest.sh
: FrameworkError found in F
ramework Job Report
\n
"
grep
"FrameworkError "
fjr.xml
|
sed
's/</\</g'
|
sed
's/>/\>/g'
echo
"ERROR
: FrameworkError found in F
JR
"
grep
"FrameworkError "
fjr.xml
# if possible extract error
which xml_grep
>
/dev/null 2>1
&&
xml_grep FrameworkError fjr.xml
fi
#
# Check cmsRun exit status
#
if
[
$srun
-ne
0
-o
$sfjr
-eq
0
]
then
printf
"AnalysisTest.sh: Error
$srun
from cmsRun
\n
"
echo
"ERROR: cmsRun failed with exit code
$srun
"
echo
"summary: CMSRUN_FAILED_CODE_
$srun
"
exit
$SAME_ERROR
fi
#
# Exit
#
printf
"OK
\n
"
echo
"Test succeeded"
echo
"summary: OK"
exit
$SAME_OK
SiteTests/testjob/tests/CE-cms-analysis
View file @
5c33e6b8
...
...
@@ -5,101 +5,53 @@ shopt -s expand_aliases
err
=
0
warn
=
0
cat
$SAME_SENSOR_HOME
/tests/CMS-SAM-Banner.html
echo
"<pre>"
set
-x
uname
-a
cat
/etc/issue
date
date
--utc
voms-proxy-info
-identity
-fqan
id
set
+x
echo
"</pre>"
echo
"<h2><a name=
\"
AnalysisTest
\"
></a>Analysis Test</h2>"
# Source the CMS environment
echo
"<h3>Sourcing the CMS environment</h3>"
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>"
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>"
echo
"Cannot find CMS software area."
echo
"</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
else
echo
"<p>ERROR: Neither VO_CMS_SW_DIR nor OSG_APP defined</p>"
echo
"ERROR: Neither VO_CMS_SW_DIR nor OSG_GRID defined"
echo
"summary: SW_DIR_UNDEF"
exit
$SAME_ERROR
fi
echo
"<pre>"
echo
"CMS software location SW_DIR="
$SW_DIR
# This test requires SLC5 arch, currently
tmpfile
=
`
mktemp
/tmp/tmp.XXXXXXXXXX
`
# check for SL5
slVersion
=
"unknown"
if
[
-f
$SW_DIR
/common/cmsos
]
;
then
osVersion
=
`
$SW_DIR
/common/cmsos
`
echo
"osVersion from
\$
SW_DIR/common/cmsos ="
$osVersion
cmsarch
=
`
$SW_DIR
/common/cmsarch
`
echo
"scram_arch from
\$
SW_DIR/common/cmsarch="
$cmsarch
slVersion
=
`
echo
$cmsarch
|cut
-d
'_'
-f1
`
fi
echo
"slVersion="
$slVersion
echo
"</pre>"
# this test requires SLC5 arch, currently
export
SCRAM_ARCH
=
slc5_amd64_gcc462
export
BUILD_ARCH
=
$SCRAM_ARCH
echo
"<pre>"
source
$SW_DIR
/cmsset_default.sh
>
$tmpfile
2>&1
result
=
$?
cat
$tmpfile
echo
"</pre>"
grep
'Your shell is not able to find'
$tmpfile
>
/dev/null
result2
=
$?
rm
-f
$tmpfile
if
[
$result
!=
0
]
then
echo
"<p>ERROR:
$SW_DIR
/cmsset_default.sh non existent or non readable</p>"
if
[
$result
!=
0
]
;
then
cat
$tmpfile
rm
-f
$tmpfile
echo
"ERROR: CMS software initialisation script cmsset_default.sh failed"
echo
"summary: NO_SETUP_SCRIPT"
exit
$SAME_ERROR
fi
if
[
$result2
==
0
]
then
echo
"<p>ERROR:
$SW_DIR
/cmsset_default.sh failed</p>"
# temporarely set this to WARNING to allow soft fail for SL4 clusters
exit
$SAME_WARNING
fi
rm
-f
$tmpfile
# Execute main test scripts
echo
"<h3>Test analysis of data from /store/data </h3>"
echo
"
<pre>
"
echo
"Running
$SAME_SENSOR_HOME
/tests/AnalysisTest.sh 2>&1"
echo
echo
"
Test analysis of data from /store/data...
"
echo
AnalysisTestWorkDir
=
`
mktemp
-d
AnalysisTestWorkDir.XXXXXXXXXX
`
pushd
.
>
/dev/null
cd
$AnalysisTestWorkDir
pwd
$SAME_SENSOR_HOME
/tests/AnalysisTest.sh
>
AnalysisTest.out 2>&1
result
=
$?
cat
AnalysisTest.out
echo
"AnalysisTest.sh executed with exit code "
$result
echo
"</pre>"
popd
>
/dev/null
if
[
$result
==
"
$SAME_WARNING
"
]
;
then
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment