CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
addOnTests.testit Class Reference
Inheritance diagram for addOnTests.testit:

Public Member Functions

def __init__
 
def run
 

Public Attributes

 commandList
 
 dirName
 
 nfail
 
 npass
 
 report
 
 status
 

Detailed Description

Definition at line 16 of file addOnTests.py.

Constructor & Destructor Documentation

def addOnTests.testit.__init__ (   self,
  dirName,
  commandList 
)

Definition at line 17 of file addOnTests.py.

17 
18  def __init__(self,dirName, commandList):
19  Thread.__init__(self)
20  self.dirName = dirName
21  self.commandList = commandList
22  self.status=-1
23  self.report=''
24  self.nfail=[]
25  self.npass=[]
26 
27  return

Member Function Documentation

def addOnTests.testit.run (   self)

Definition at line 28 of file addOnTests.py.

References addOnTests.testit.commandList, addOnTests.testit.dirName, MuonIsolationDQM.dirName, VariablePlotter::SubDirectory.dirName, VariablePlotter::Directory.dirName, python.rootplot.root2matplotlib.replace(), runall.testit.report, runTheMatrix_dev.WorkFlowRunner.report, runTheMatrix.WorkFlowRunner.report, addOnTests.testit.report, and ALIUtils.report.

28 
29  def run(self):
30 
31  startime='date %s' %time.asctime()
32  exitCodes = []
33 
34  startDir = os.getcwd()
35 
36  for command in self.commandList:
37 
38  if not os.path.exists(self.dirName):
39  os.makedirs(self.dirName)
40 
41  commandbase = command.replace(' ','_').replace('/','_')
42  logfile='%s.log' % commandbase[:150].replace("'",'').replace('../','')
43 
44  if os.path.exists( os.path.join(os.environ['CMS_PATH'],'cmsset_default.sh') ) :
45  executable = 'source $CMS_PATH/cmsset_default.sh; eval `scram run -sh`;'
46  else:
47  executable = 'source $CMS_PATH/sw/cmsset_default.sh; eval `scram run -sh`;'
48  # only if needed! executable += 'export FRONTIER_FORCERELOAD=long;' # force reload of db
49  executable += 'cd '+self.dirName+';'
50  executable += '%s > %s 2>&1' %(command, logfile)
51 
52  ret = os.system(executable)
53  exitCodes.append( ret )
54 
55  endtime='date %s' %time.asctime()
56  tottime='%s-%s'%(endtime,startime)
57 
58  for i in range(len(self.commandList)):
59  command = self.commandList[i]
60  exitcode = exitCodes[i]
61  if exitcode != 0:
62  log='%s : FAILED - time: %s s - exit: %s\n' %(command,tottime,exitcode)
63  self.report+='%s\n'%log
64  self.nfail.append(1)
65  self.npass.append(0)
66  else:
67  log='%s : PASSED - time: %s s - exit: %s\n' %(command,tottime,exitcode)
68  self.report+='%s\n'%log
69  self.nfail.append(0)
70  self.npass.append(1)
71 
72  os.chdir(startDir)
73 
74  return

Member Data Documentation

addOnTests.testit.commandList

Definition at line 20 of file addOnTests.py.

Referenced by addOnTests.testit.run().

addOnTests.testit.dirName

Definition at line 19 of file addOnTests.py.

Referenced by addOnTests.testit.run().

addOnTests.testit.nfail

Definition at line 23 of file addOnTests.py.

addOnTests.testit.npass

Definition at line 24 of file addOnTests.py.

addOnTests.testit.report

Definition at line 22 of file addOnTests.py.

Referenced by addOnTests.testit.run().

addOnTests.testit.status

Definition at line 21 of file addOnTests.py.