Inherits threading::Thread.
Public Member Functions | |
def | __init__ |
def | run |
Public Attributes | |
commandList | |
dirName | |
nfail | |
npass | |
report | |
status |
Definition at line 16 of file addOnTests.py.
def addOnTests::testit::__init__ | ( | self, | |
dirName, | |||
commandList | |||
) |
Definition at line 17 of file addOnTests.py.
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
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.