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')],
97 'hlt_mc_2014' : [
'cmsDriver.py TTbar_Tauola_8TeV_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run1_mc_2014 --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --fileout file:RelVal_Raw_2014_MC.root',
98 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnMc_HLT_2014.py'),
99 'cmsDriver.py RelVal -s HLT:2014,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run1_mc_2014 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_2014_MC.root --fileout file:RelVal_Raw_2014_MC_HLT_RECO.root'],
100 'hlt_mc_Fake' : [
'cmsDriver.py TTbar_Tauola_8TeV_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run1_mc_Fake --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --fileout file:RelVal_Raw_Fake_MC.root',
101 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnMc_HLT_Fake.py'),
102 'cmsDriver.py RelVal -s HLT:Fake,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run1_mc_Fake --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_Fake_MC.root --fileout file:RelVal_Raw_Fake_MC_HLT_RECO.root'],
103 'hlt_mc_FULL' : [
'cmsDriver.py TTbar_Tauola_13TeV_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_FULL --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --fileout file:RelVal_Raw_FULL_MC.root',
104 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnMc_HLT_FULL.py'),
105 'cmsDriver.py RelVal -s HLT:FULL,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_FULL --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_FULL_MC.root --fileout file:RelVal_Raw_FULL_MC_HLT_RECO.root'],
106 'hlt_mc_GRun' : [
'cmsDriver.py TTbar_Tauola_13TeV_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_GRun --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --fileout file:RelVal_Raw_GRun_MC.root',
107 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnMc_HLT_GRun.py'),
108 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_GRun_MC.root --fileout file:RelVal_Raw_GRun_MC_HLT_RECO.root'],
109 'hlt_mc_HIon' : [
'cmsDriver.py TTbar_Tauola_13TeV_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=HeavyIons -n 10 --conditions auto:run2_mc_HIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --fileout file:RelVal_Raw_HIon_MC.root',
110 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnMc_HLT_HIon.py'),
111 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --mc --scenario=HeavyIons -n 10 --conditions auto:run2_mc_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_HIon_MC.root --fileout file:RelVal_Raw_HIon_MC_HLT_RECO.root'],
112 'hlt_mc_PIon' : [
'cmsDriver.py TTbar_Tauola_13TeV_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_PIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAW --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --fileout file:RelVal_Raw_PIon_MC.root',
113 'cmsRun ' + self.
file2Path(
'HLTrigger/Configuration/test/OnMc_HLT_PIon.py'),
114 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_PIon_MC.root --fileout file:RelVal_Raw_PIon_MC_HLT_RECO.root'],
115 'hlt_data_2014' : [
'cmsDriver.py RelVal -s L1REPACK --data --scenario=pp -n 10 --conditions auto:run1_hlt_2014 --relval 9000,50 --datatier "RAW" --eventcontent RAW --fileout file:RelVal_Raw_2014_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root',
116 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_2014.py'),
117 'cmsDriver.py RelVal -s HLT:2014,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run1_data_2014 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_2014_DATA.root --fileout file:RelVal_Raw_2014_DATA_HLT_RECO.root'],
118 'hlt_data_Fake' : [
'cmsDriver.py RelVal -s L1REPACK --data --scenario=pp -n 10 --conditions auto:run1_hlt_Fake --relval 9000,50 --datatier "RAW" --eventcontent RAW --fileout file:RelVal_Raw_Fake_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root',
119 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_Fake.py'),
120 'cmsDriver.py RelVal -s HLT:Fake,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run1_data_Fake --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_Fake_DATA.root --fileout file:RelVal_Raw_Fake_DATA_HLT_RECO.root'],
121 'hlt_data_FULL' : [
'cmsDriver.py RelVal -s NONE --data --scenario=pp -n 10 --conditions auto:run2_hlt_FULL --relval 9000,50 --datatier "RAW" --eventcontent RAW --fileout file:RelVal_Raw_FULL_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root',
122 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_FULL.py'),
123 'cmsDriver.py RelVal -s HLT:FULL,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_FULL --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_FULL_DATA.root --fileout file:RelVal_Raw_FULL_DATA_HLT_RECO.root'],
124 'hlt_data_GRun' : [
'cmsDriver.py RelVal -s NONE --data --scenario=pp -n 10 --conditions auto:run2_hlt_GRun --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',
125 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_GRun.py'),
126 'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_GRun_DATA.root --fileout file:RelVal_Raw_GRun_DATA_HLT_RECO.root'],
127 'hlt_data_HIon' : [
'cmsDriver.py RelVal -s NONE --data --scenario=HeavyIons -n 10 --conditions auto:run2_hlt_HIon --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',
128 'cmsRun '+self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_HIon.py'),
129 'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --data --scenario=HeavyIons -n 10 --conditions auto:run2_data_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --customise=HLTrigger/Configuration/CustomConfigs.MassReplaceInputTag --processName=HLTRECO --filein file:RelVal_Raw_HIon_DATA.root --fileout file:RelVal_Raw_HIon_DATA_HLT_RECO.root'],
130 'hlt_data_PIon' : [
'cmsDriver.py RelVal -s NONE --data --scenario=pp -n 10 --conditions auto:run2_hlt_PIon --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',
131 'cmsRun ' + self.
file2Path(
'HLTrigger/Configuration/test/OnData_HLT_PIon.py'),
132 'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --customise=SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_PIon_DATA.root --fileout file:RelVal_Raw_PIon_DATA_HLT_RECO.root'],
136 for dirName, command
in lines.items():
139 for dirName, commandList
in hltTests.items():
140 self.
commands[dirName] = commandList
144 print ",".
join(self.commands.keys())
149 fullPath = self.
relPath + rFile
150 if os.path.exists(self.
devPath + rFile): fullPath = self.
devPath + rFile
157 if not os.path.exists(
'addOnTests'):
158 os.makedirs(
'addOnTests')
159 os.chdir(
'addOnTests')
165 print 'Running in %s thread(s)' % self.
maxThreads
167 for dirName, command
in self.commands.items():
169 if testList
and not dirName
in testList:
178 print 'Preparing to run %s' % str(command)
179 current =
testit(dirName, command)
180 self.threadList.append(current)
182 time.sleep(random.randint(1,5))
191 for f
in pingle.nfail: nfail += f
192 for p
in pingle.npass: npass += p
193 report += pingle.report
197 reportSumm =
'\n %s tests passed, %s failed \n' %(npass,nfail)
200 runall_report_name=
'runall-report.log'
201 runall_report=open(runall_report_name,
'w')
202 runall_report.write(report+reportSumm)
203 runall_report.close()
206 print '==> in :', os.getcwd()
207 print ' going to copy log files to logs dir ...'
208 if not os.path.exists(
'logs'):
211 cmd =
"for L in `ls "+dirName+
"/*.log`; do cp $L logs/cmsDriver-`dirname $L`_`basename $L` ; done"
212 print "going to ",cmd
216 pickle.dump(self.
commands, open(
'logs/addOnTests.pkl',
'w') )
224 print "in ", os.getcwd()
226 if not os.path.exists(tgtDir):
229 cmd =
'tar cf - addOnTests.log addOnTests/logs | (cd '+tgtDir+
' ; tar xf - ) '
231 print 'executing: ',cmd
234 print "ERROR uploading logs:", ret, cmd
236 print "EXCEPTION while uploading addOnTest-logs : ", str(e)
246 opts, args = getopt.getopt(argv,
"dj:t:", [
"nproc=",
'uploadDir=',
'tests=',
'noRun',
'dump'])
247 except getopt.GetoptError, e:
248 print "unknown option", str(e)
256 for opt, arg
in opts :
257 if opt
in (
'-j',
"--nproc" ):
259 if opt
in (
"--uploadDir", ):
261 if opt
in (
'--noRun', ):
263 if opt
in (
'-d',
'--dump', ):
265 if opt
in (
'-t',
'--tests', ):
266 testList = arg.split(
",")
273 tester.runTests(testList)
275 tester.upload(uploadDir)
278 if __name__ ==
'__main__' :
static std::string join(char **cmd)