CMS 3D CMS Logo

Public Member Functions | Public Attributes

addOnTests::testit Class Reference

Inherits threading::Thread.

List of all members.

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.

00018                                            :
00019         Thread.__init__(self)
00020         self.dirName = dirName
00021         self.commandList = commandList
00022         self.status=-1
00023         self.report=''
00024         self.nfail=[]
00025         self.npass=[]
00026 
00027         return
    

Member Function Documentation

def addOnTests::testit::run (   self)

Definition at line 28 of file addOnTests.py.

00029                  :
00030 
00031         startime='date %s' %time.asctime()
00032         exitCodes = []
00033 
00034         startDir = os.getcwd()
00035         
00036         for command in self.commandList:
00037 
00038             if not os.path.exists(self.dirName):
00039                 os.makedirs(self.dirName)
00040 
00041             commandbase = command.replace(' ','_').replace('/','_')
00042             logfile='%s.log' % commandbase[:150].replace("'",'').replace('../','')
00043             
00044             if os.path.exists( os.path.join(os.environ['CMS_PATH'],'cmsset_default.sh') ) :
00045                 executable = 'source $CMS_PATH/cmsset_default.sh; eval `scram run -sh`;'
00046             else:
00047                 executable = 'source $CMS_PATH/sw/cmsset_default.sh; eval `scram run -sh`;'
00048             # only if needed! executable += 'export FRONTIER_FORCERELOAD=long;' # force reload of db
00049             executable += 'cd '+self.dirName+';'
00050             executable += '%s > %s 2>&1' %(command, logfile)
00051 
00052             ret = os.system(executable)
00053             exitCodes.append( ret )
00054 
00055         endtime='date %s' %time.asctime()
00056         tottime='%s-%s'%(endtime,startime)
00057     
00058         for i in range(len(self.commandList)):
00059             command = self.commandList[i]
00060             exitcode = exitCodes[i]
00061             if exitcode != 0:
00062                 log='%s : FAILED - time: %s s - exit: %s\n' %(command,tottime,exitcode)
00063                 self.report+='%s\n'%log
00064                 self.nfail.append(1)
00065                 self.npass.append(0)
00066             else:
00067                 log='%s : PASSED - time: %s s - exit: %s\n' %(command,tottime,exitcode)
00068                 self.report+='%s\n'%log
00069                 self.nfail.append(0)
00070                 self.npass.append(1)
00071 
00072         os.chdir(startDir)
00073         
00074         return


Member Data Documentation

Definition at line 17 of file addOnTests.py.

Definition at line 17 of file addOnTests.py.

Definition at line 17 of file addOnTests.py.

Definition at line 17 of file addOnTests.py.

Definition at line 17 of file addOnTests.py.

Definition at line 17 of file addOnTests.py.