8 from threading
import Thread
10 scriptPath = os.path.dirname( os.path.abspath(sys.argv[0]) )
11 if scriptPath
not in sys.path:
12 sys.path.append(scriptPath)
29 startime=
'date %s' %time.asctime()
34 if not os.path.exists(self.
dirName):
37 commandbase = command.replace(
' ',
'_').
replace(
'/',
'_')
40 executable =
'cd '+self.
dirName+
'; '+command+
' > '+logfile+
' 2>&1'
42 ret = os.system(executable)
43 exitCodes.append( ret )
45 endtime=
'date %s' %time.asctime()
46 tottime=
'%s-%s'%(endtime,startime)
50 exitcode = exitCodes[i]
52 log=
'%s : FAILED - time: %s s - exit: %s\n' %(command,tottime,exitcode)
57 log=
'%s : PASSED - time: %s s - exit: %s\n' %(command,tottime,exitcode)
78 if t.isAlive() : nActive += 1
84 self.
devPath = os.environ[
'LOCALRT'] +
'/src/'
86 if os.environ.has_key(
'CMSSW_RELEASE_BASE')
and (os.environ[
'CMSSW_RELEASE_BASE'] !=
""): self.
relPath = os.environ[
'CMSSW_RELEASE_BASE'] +
'/src/'
88 lines = {
'read312RV' : [
'cmsRun '+self.
file2Path(
'Utilities/ReleaseScripts/scripts/read312RV_cfg.py')],
89 'fastsim1' : [
'cmsRun '+self.
file2Path(
'FastSimulation/Configuration/test/IntegrationTestFake_cfg.py')],
90 'fastsim2' : [
'cmsRun '+self.
file2Path(
'FastSimulation/Configuration/test/IntegrationTest_cfg.py')],
92 'fastsim4' : [
'cmsRun '+self.
file2Path(
'FastSimulation/Configuration/test/IntegrationTestWithHLT_cfg.py')],
93 'pat1' : [
'cmsRun '+self.
file2Path(
'PhysicsTools/PatAlgos/test/IntegrationTest_cfg.py')],
96 hltTests = {
'hlt1' : [
'cmsDriver.py TTbar_Tauola.cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:startup --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --fileout file:RelVal_Raw_GRun_STARTUP.root',
97 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnLine_HLT_GRun.py'),
98 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:startup_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_GRun_STARTUP.root --fileout file:RelVal_Raw_GRun_STARTUP_HLT_RECO.root'],
99 'hlt2' : [
'cmsDriver.py TTbar_Tauola.cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=HeavyIons -n 10 --conditions auto:starthi --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --fileout file:RelVal_Raw_HIon_STARTUP.root',
100 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnLine_HLT_HIon.py'),
101 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --mc --scenario=HeavyIons -n 10 --conditions auto:starthi_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_HIon_STARTUP.root --fileout file:RelVal_Raw_HIon_STARTUP_HLT_RECO.root'],
102 'hlt3' : [
'cmsDriver.py RelVal -s L1REPACK --data --scenario=pp -n 10 --conditions auto:startup --relval 9000,50 --datatier "RAW" --eventcontent RAW --fileout file:RelVal_Raw_GRun_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root',
103 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_GRun.py'),
104 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:hltonline_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_GRun_DATA.root --fileout file:RelVal_Raw_GRun_DATA_HLT_RECO.root'],
105 'hlt4' : [
'cmsDriver.py RelVal -s L1REPACK --data --scenario=HeavyIons -n 10 --conditions auto:starthi --relval 9000,50 --datatier "RAW" --eventcontent RAW --fileout file:RelVal_Raw_HIon_DATA.root --filein /store/hidata/HIRun2011/HIHighPt/RAW/v1/000/182/838/F20AAF66-F71C-E111-9704-BCAEC532971D.root',
106 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_HIon.py'),
107 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --data --scenario=HeavyIons -n 10 --conditions auto:hltonline_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_HIon_DATA.root --fileout file:RelVal_Raw_HIon_DATA_HLT_RECO.root'],
108 'hlt5' : [
'cmsDriver.py TTbar_Tauola.cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:startup --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --fileout file:RelVal_Raw_PIon_STARTUP.root',
109 'cmsRun ' + self.
file2Path(
'HLTrigger/Configuration/test/OnLine_HLT_PIon.py'),
110 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:startup_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_PIon_STARTUP.root --fileout file:RelVal_Raw_PIon_STARTUP_HLT_RECO.root'],
111 'hlt6' : [
'cmsDriver.py RelVal -s L1REPACK --data --scenario=pp -n 10 --conditions auto:startup --relval 9000,50 --datatier "RAW" --eventcontent RAW --fileout file:RelVal_Raw_PIon_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root',
112 'cmsRun ' + self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_PIon.py'),
113 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:hltonline_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_PIon_DATA.root --fileout file:RelVal_Raw_PIon_DATA_HLT_RECO.root'],
117 for dirName, command
in lines.items():
120 for dirName, commandList
in hltTests.items():
121 self.
commands[dirName] = commandList
125 print ",".
join(self.commands.keys())
130 fullPath = self.
relPath + rFile
131 if os.path.exists(self.
devPath + rFile): fullPath = self.
devPath + rFile
138 if not os.path.exists(
'addOnTests'):
139 os.makedirs(
'addOnTests')
140 os.chdir(
'addOnTests')
146 print 'Running in %s thread(s)' % self.
maxThreads
148 for dirName, command
in self.commands.items():
150 if testList
and not dirName
in testList:
159 print 'Preparing to run %s' % str(command)
160 current =
testit(dirName, command)
161 self.threadList.append(current)
163 time.sleep(random.randint(1,5))
172 for f
in pingle.nfail: nfail += f
173 for p
in pingle.npass: npass += p
174 report += pingle.report
178 reportSumm =
'\n %s tests passed, %s failed \n' %(npass,nfail)
181 runall_report_name=
'runall-report.log'
182 runall_report=open(runall_report_name,
'w')
183 runall_report.write(report+reportSumm)
184 runall_report.close()
187 print '==> in :', os.getcwd()
188 print ' going to copy log files to logs dir ...'
189 if not os.path.exists(
'logs'):
192 cmd =
"for L in `ls "+dirName+
"/*.log`; do cp $L logs/cmsDriver-`dirname $L`_`basename $L` ; done"
193 print "going to ",cmd
197 pickle.dump(self.
commands, open(
'logs/addOnTests.pkl',
'w') )
205 print "in ", os.getcwd()
207 if not os.path.exists(tgtDir):
210 cmd =
'tar cf - addOnTests.log addOnTests/logs | (cd '+tgtDir+
' ; tar xf - ) '
212 print 'executing: ',cmd
215 print "ERROR uploading logs:", ret, cmd
217 print "EXCEPTION while uploading addOnTest-logs : ", str(e)
227 opts, args = getopt.getopt(argv,
"dj:t:", [
"nproc=",
'uploadDir=',
'tests=',
'noRun',
'dump'])
228 except getopt.GetoptError, e:
229 print "unknown option", str(e)
237 for opt, arg
in opts :
238 if opt
in (
'-j',
"--nproc" ):
240 if opt
in (
"--uploadDir", ):
242 if opt
in (
'--noRun', ):
244 if opt
in (
'-d',
'--dump', ):
246 if opt
in (
'-t',
'--tests', ):
247 testList = arg.split(
",")
254 tester.runTests(testList)
256 tester.upload(uploadDir)
259 if __name__ ==
'__main__' :
static std::string join(char **cmd)