Commit c6d54407 authored by Stefano Belforte's avatar Stefano Belforte
Browse files

oopss. this is the right file

parent db90e2f0
#!/bin/sh
shopt -s expand_aliases
#
# Choose CMSSW version
#
cmsswvsn=CMSSW_2_1_12
#
# Print CMS_PATH
#
printf "CMS_PATH $CMS_PATH\n"
#
# Check that scramv1 command was defined by . $CMS_PATH/cmsset_default.sh
#
type scramv1 > /dev/null 2>&1
sset=$?
if [ $sset -ne 0 ]
then
printf "AnalysisTest.sh: Error. scramv1 not found\n"
exit $SAME_ERROR
err=0
warn=0
cat $SAME_SENSOR_HOME/tests/CMS-SAM-Banner.html
echo "<pre>"
echo "version 23-9 17:00"
set -x
uname -a
cat /etc/issue
date
date --utc
voms-proxy-info -identity -fqan
id
set +x
echo "<h2><a name="Analysis Test"></a>Analysis Test</h2>"
# Source the CMS environment
echo "<h3>Sourcing the CMS environment</h3>"
export SCRAM_ARCH=slc4_ia32_gcc345
export BUILD_ARCH=slc4_ia32_gcc345
if [ -n "$OSG_APP" ] ; then
SW_DIR=$OSG_APP/cmssoft/cms
elif [ -n "$VO_CMS_SW_DIR" ] ; then
SW_DIR=$VO_CMS_SW_DIR
else
echo "ERROR: Neither VO_CMS_SW_DIR nor OSG_APP defined"
exit $SAME_ERROR
fi
#
# Get Working Directory
#
current=`pwd`
#
# Set up CMSSW
#
tmpfile=`mktemp /tmp/tmp.scram.XXXXXXXXXX`
printf "scramv1 project CMSSW $cmsswvsn ... starting\n"
scramv1 project CMSSW $cmsswvsn > $tmpfile 2>&1
scms=$?
if [ $scms -ne 0 ]
then
cat $tmpfile
printf "AnalysisTest.sh: Error. $cmsswvsn not available\n"
exit $SAME_ERROR
tmpfile=`mktemp /tmp/tmp.XXXXXXXXXX`
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 "ERROR: $SW_DIR/cmsset_default.sh non existent or non readable"
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/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/18A1B60B-A5A5-DD11-84FC-00163E1124E2.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/2C556CAE-ACA5-DD11-A6C7-00163E11248E.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/5A50C03F-ADA5-DD11-9FE8-00163E11247A.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/5E326586-A4A5-DD11-A6AA-0015600E3ECA.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/806CD613-AEA5-DD11-8795-00163E112499.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/8C1E14E9-AFA5-DD11-ACFE-00163E1124AF.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/94AD82A3-AEA5-DD11-9E95-00163E11247A.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/A82F9385-A3A5-DD11-B03E-00163E1124E9.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/BCC46CCA-A4A5-DD11-9CB5-001560AC1D24.root
/store/mc/SAM/QCD_pt_0_15/GEN-SIM-RAW-RECO/IDEAL_V9_SAM/0000/F21EB2B6-ABA5-DD11-87D5-00163E11247C.root
EOI
#
nFiles=`cat possible-input-files | wc -l`
#
# pick a randmon 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 ]
do
let nl=nl+1
read line
done < possible-input-files
inputFile=$line
echo inputFile: $inputFile
#
# Create configuration file for cmsRun followin 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
process = cms.Process("CopyJob")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 100
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring("${inputFile}")
)
process.out = cms.OutputModule("PoolOutputModule",
fileName = cms.untracked.string('myout.root'),
outputCommands = cms.untracked.vstring('drop *')
)
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
#
printf "local file Analysis test\n"
printf "START TIME: `date` --> running cmsRun -j fjr.xml -p analysis_test.py\n"
cmsRun -j fjr.xml -p analysis_test.py
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/</\&lt;/g' | sed 's/>/\&gt;/g'
echo "=================================================================================="
echo ""
printf "`date` --> DONE\n"
stop=`date +%s`
printf "ELAPSED TIME: $[ $stop - $start ] seconds\n"
#
# Check FJR for errors
#
grep -q "FrameworkError " fjr.xml
sfjr=$?
if [ $sfjr -eq 0 ]
then
printf "AnalysisTest.sh: FrameworkError found in Framework Job Report\n"
grep "FrameworkError " fjr.xml | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
# if possible extract error
which xml_grep > /dev/null 2>1 && xml_grep FrameworkError fjr.xml
if [ $result2 == 0 ]
then
echo "ERROR: $SW_DIR/cmsset_default.sh failed"
exit $SAME_ERROR
fi
#
# Check cmsRun exit status
#
if [ $srun -ne 0 -o $sfjr -eq 0 ]
then
printf "AnalysisTest.sh: Error $srun from cmsRun\n"
exit $SAME_ERROR
# Execute main test scripts
echo "<h3>Test analysis of data from /store/data </h3>"
echo "<pre>"
echo " SAME_SENSOR_HOME: " $SAME_SENSOR_HOME
echo "Running $SAME_SENSOR_HOME/tests/AnalysisTest.sh 2>&1"
AnalysisTestWorkDir=`mktemp -d AnalysisTestWorkDir.XXXXXXXXXX`
pushd . > /dev/null
cd $AnalysisTestWorkDir
pwd
$SAME_SENSOR_HOME/tests/AnalysisTest.sh 2>&1
result=$?
echo "AnalysisTest.sh executed with exit code " $result
echo "</pre>"
popd > /dev/null
if [ $result == $SAME_WARNING ] ; then
warn=1
fi
#
# Exit
#
printf "OK\n"
if [ $result == $SAME_ERROR ] ; then
err=1
fi
echo "<h3>Test analysis of data from /store/user </h3>"
echo "<pre>"
echo " SAME_SENSOR_HOME: " $SAME_SENSOR_HOME
echo "Running $SAME_SENSOR_HOME/tests/AnalysisTestUser.sh 2>&1"
AnalysisTestUserWorkDir=`mktemp -d AnalysisTestUserWorkDir.XXXXXXXXXX`
pushd . > /dev/null
cd $AnalysisTestUserWorkDir
pwd
$SAME_SENSOR_HOME/tests/AnalysisTestUser.sh 2>&1
result=$?
echo "</pre>"
popd > /dev/null
if [ $result != $SAME_OK ] ; then
warn=1
fi
if [ $err == 1 ] ; then
exit $SAME_ERROR
fi
if [ $warn == 1 ] ; then
exit $SAME_WARNING
fi
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