CMS 3D CMS Logo

Functions | Variables

testRegression Namespace Reference

Functions

def AddLogStatusDB
def BuildLogfile
def CheckIfOkStatusDB
def CheckLabelSequenceDB
def CheckPath
def CmdUsage
def Command
def CreateReleaseDB
def CreateResultsDB
def CreateSequenceDB
def CreateStatusDB
def DeleteReleaseDB
def DropReleaseDB
def DropResultsDB
def DropSequenceDB
def DropStatusDB
def extractErr
def extractID
def extractLogin
def GetAutoIncResultsDB
def GetDate
def getLogin
def GetMaxRunIDStatusDB
def getText
def NextIDVal
def NextRunIDVal
def ParseXML
def ReadArgs
def ReadCurrentStatusDB
def ReadReleaseDB
def ReadResultsDB
def ReadSequenceDB
def ReadStatusDB
def RunTest
def setConn
def SetEnv
def TestCompat
def TestCompatRef
def WebLabels
def WebReadLogStatusDB
def WebReleasesHeaders
def WebResultsList
def WebStatus
def WebStatusHeaders
def WebStatusRunID
def WriteReleaseDB
def WriteResultsDB
def WriteSequenceDB
def WriteStatusDB

Variables

string AUTH_PATH = "/afs/cern.ch/cms/DB/conddb/test/authentication.xml"
string DATABASE = "cms_orcoff_prep"
string mLabel = ''
tuple pipe = subprocess.Popen(cmdList, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
int resCount = 0
list resNames = []
tuple result = setConn()
int runID = 0
string stat = "SUCCESS"
tuple stdout_value = pipe.communicate()
tuple timeStamp = GetDate()
string USERNAME = "CMS_COND_REGRESSION"

Function Documentation

def testRegression::AddLogStatusDB (   label,
  runID,
  logStr 
)

Definition at line 313 of file testRegression.py.

00314                                         :
00315         curs = conn.cursor()
00316         sqlstr = "UPDATE TEST_STATUS SET LOG = :lstr WHERE LABEL = :labl AND RUNID = :rid"
00317         curs.prepare(sqlstr)
00318         curs.execute(sqlstr, lstr = logStr, labl=label, rid=runID)
        conn.commit()
def testRegression::BuildLogfile (   label,
  runID 
)

Definition at line 188 of file testRegression.py.

00189                               :
00190         logFile = open("logs/TestLog"+str(runID)+".txt", "w")
00191         logFile.write('\Output:'+stdout_value)
00192         

def testRegression::CheckIfOkStatusDB (   runID,
  label 
)

Definition at line 319 of file testRegression.py.

00320                                    :
00321         curs = conn.cursor()
00322         sqlstr = "SELECT ID FROM TEST_STATUS WHERE RUNID = :rid AND LABEL = :labl"
00323         curs.prepare(sqlstr)
00324         curs.execute(sqlstr, rid = runID, labl = label)
00325         idList = []
00326         for row in curs:
00327                 idList.append(row[0])
00328         curs = conn.cursor()
00329         sqlstr = "SELECT ID, STATUS FROM TEST_RESULTS WHERE ID >= :mi AND ID <= :ma AND LABEL = :labl"
00330         curs.prepare(sqlstr)
00331         #print "ID = %d label=%s minid=%d maxid=%d" %(runID,label, min(idList),max(idList))
00332         curs.execute(sqlstr, mi=min(idList), ma=max(idList), labl = label)
00333         for row in curs:
00334                 if row[1] != 0:
00335                         return False
00336         return True

def testRegression::CheckLabelSequenceDB (   label)

Definition at line 396 of file testRegression.py.

00397                                :
00398         curs = conn.cursor()
00399         sqlstr = "SELECT * FROM SEQUENCES WHERE LABEL = :labl"
00400         curs.prepare(sqlstr)
00401         curs.execute(sqlstr, labl=label)
00402         for row in curs:
00403                 return True
        return False
def testRegression::CheckPath (   release,
  arch,
  path 
)

Definition at line 633 of file testRegression.py.

00634                                    :
00635         if(os.path.exists(path)):
00636                 if(os.path.exists(os.path.join(path, release))):
00637                         if(os.path.exists(os.path.join(path, release, "test", arch))):
00638                                 return True
00639                         else:
00640                                 print "Architecture not found"
00641                                 return False
00642                 else:
00643                         print "Release not found"
00644                         return False
00645         else:
00646                 print "Path not found"
                return False
def testRegression::CmdUsage ( )

Definition at line 624 of file testRegression.py.

00625               :
00626         print "Command line arguments :"
00627         print "-c (-s) creates descriptor(status) db schema"
00628         print "-d drops descriptor(status) db schema. Optional : -R [release] -A [arch] to drop single entry (for descriptor db)"
00629         print "-w writes data to db. Goes only with -R [release] -A [arch] -P [path]"
00630         print "-r (-s) reads contents of descriptor(status) db"
00631         print "-t (-o) (-i) runs test. Goes only with -L [label] -R [release] -A [arch] -P [path] " 
00632         print "(-o) specifies reference release. supply additional parameters --R [refRelease] --A [refArch] --P [refPath]"
        print "(-i) argument forces candidate to test with itself as a reference"
def testRegression::Command (   runStr)

Definition at line 540 of file testRegression.py.

00541                    :
00542         cmds = """
00543 if [ $RETVAL = 0 ]; then
00544 echo "Executing Command """+runStr+""" "
00545 echo "with $TRELEASE $TARCH :"
00546         """+runStr+"""
00547         RETVAL=$?
00548         if [ $RETVAL != 0 ]; then
00549 echo "Task failed on $TRELEASE $TARCH return code :  $RETVAL"
00550         else
00551 echo "Task performed successfully"
00552         fi
00553 fi
00554 """
        return cmds
def testRegression::CreateReleaseDB ( )

Definition at line 220 of file testRegression.py.

00221                      :
00222         curs = conn.cursor()
00223         sqlstr = "CREATE TABLE VERSION_TABLE (ID NUMBER, RELEASE VARCHAR2(50), ARCH VARCHAR2(30), PATH VARCHAR(255), CONSTRAINT PK_ID PRIMARY KEY(RELEASE, ARCH) )"
00224         curs.prepare(sqlstr)
00225         curs.execute(sqlstr)
        print 'VERSION TABLE CREATED'
def testRegression::CreateResultsDB ( )

Definition at line 337 of file testRegression.py.

00337                      :  
00338         curs = conn.cursor()
00339         sqlstr = "CREATE TABLE TEST_RESULTS (RID NUMBER, ID NUMBER, LABEL VARCHAR(20), NAME VARCHAR(100), STATUS NUMBER)"
00340         curs.prepare(sqlstr)
00341         curs.execute(sqlstr)
00342         sqlstr = "CREATE SEQUENCE AUTO_INC INCREMENT BY 1 START WITH 1"
00343         curs.prepare(sqlstr)
00344         curs.execute(sqlstr)
00345         conn.commit()
def testRegression::CreateSequenceDB ( )

Definition at line 378 of file testRegression.py.

00379                       :
00380         curs = conn.cursor()
00381         sqlstr = "CREATE TABLE SEQUENCES (LABEL VARCHAR(20), ID NUMBER, RUNID NUMBER)"
00382         curs.prepare(sqlstr)
00383         curs.execute(sqlstr)
        conn.commit()
def testRegression::CreateStatusDB ( )

Definition at line 249 of file testRegression.py.

00250                     :
00251         curs = conn.cursor()
00252         sqlstr = "CREATE TABLE TEST_STATUS (ID NUMBER, RUNID NUMBER, RDATE DATE, LABEL VARCHAR2(20), "
00253         sqlstr += "T_RELEASE VARCHAR2(50), T_ARCH VARCHAR2(30), R_RELEASE VARCHAR(50), R_ARCH VARCHAR2(30), LOG CLOB, "
00254         sqlstr += "CONSTRAINT PK_ID2 PRIMARY KEY(ID, RUNID, LABEL))"
00255         curs.prepare(sqlstr)
00256         curs.execute(sqlstr)
00257         CreateResultsDB()
00258         CreateSequenceDB()
00259         conn.commit()
        print 'STATUS TABLE CREATED'
def testRegression::DeleteReleaseDB (   release,
  arch 
)

Definition at line 232 of file testRegression.py.

00233                                   :
00234         curs = conn.cursor()
00235         sqlstr = "DELETE FROM VERSION_TABLE WHERE RELEASE = :rel AND ARCH = :arc"
00236         curs.prepare(sqlstr)
00237         curs.execute(sqlstr, rel = release, arc = arch)
00238         conn.commit()
        print 'VALUE DELETED'
def testRegression::DropReleaseDB ( )

Definition at line 226 of file testRegression.py.

00227                    :
00228         curs = conn.cursor()
00229         sqlstr = "DROP TABLE VERSION_TABLE"
00230         curs.prepare(sqlstr)
00231         curs.execute(sqlstr)
        print 'VERSION TABLE DROPPED'
def testRegression::DropResultsDB ( )

Definition at line 346 of file testRegression.py.

00347                    :
00348         curs = conn.cursor()
00349         sqlstr = "DROP TABLE TEST_RESULTS"
00350         curs.prepare(sqlstr)
00351         curs.execute(sqlstr)
00352         sqlstr = "DROP SEQUENCE AUTO_INC"
00353         curs.prepare(sqlstr)
00354         curs.execute(sqlstr)
        conn.commit()
def testRegression::DropSequenceDB ( )

Definition at line 404 of file testRegression.py.

00405                     :
00406         curs = conn.cursor()
00407         sqlstr = "DROP TABLE SEQUENCES"
00408         curs.prepare(sqlstr)
00409         curs.execute(sqlstr)
        conn.commit()
def testRegression::DropStatusDB ( )

Definition at line 260 of file testRegression.py.

00261                   :
00262         curs = conn.cursor()
00263         sqlstr = "DROP TABLE TEST_STATUS"
00264         curs.prepare(sqlstr)
00265         curs.execute(sqlstr)
00266         DropResultsDB()
00267         DropSequenceDB()
        print 'STATUS TABLE DROPPED'
def testRegression::extractErr (   runID,
  stdoutStr 
)

Definition at line 208 of file testRegression.py.

00209                                 :
00210         reStr = "\!L\!([^!]+)\!TR\!([^!]+)\!TA\!([^!]+)\!RR\!([^!]+)\!RA\!([^!]+)"
00211         for i in range (0, resCount):
00212                 reStr +=  "\!C"+str(i)+"\!(\d+)"
00213 
00214         pattern = re.compile(reStr)
00215         matching = pattern.findall(stdoutStr)
00216         stdoutMod = pattern.sub("", stdoutStr)
00217         for match in matching:
00218                 WriteStatusDB(runID, match)
00219         return stdoutMod

def testRegression::extractID (   release)

Definition at line 193 of file testRegression.py.

00194                       :
00195         pattern = re.compile("^CMSSW_(\d+)_(\d+)_(\d+|\D)(_pre(\d+)|_patch(\d+))?")
00196         matching = pattern.match(release)
00197         version = 0
00198         if matching:
00199                 g = matching.groups()
00200                 if(g[2].isdigit()):
00201                         if(g[4] is not None and g[4].isdigit()):
00202                                         version = int(g[0]) * 1000000 + int(g[1]) * 10000 + int(g[2]) * 100 + int(g[4])
00203                         else:
00204                                 version = int(g[0]) * 1000000 + int(g[1]) * 10000 + int(g[2]) * 100
00205                 else:
00206                         version = int(g[0]) * 1000000 + int(g[1]) * 10000 +9999
00207                 if(version is not None):
                        return version
def testRegression::extractLogin (   login)

Definition at line 82 of file testRegression.py.

00083                        :
00084         pattern = re.compile(r'value="([^"]+)')
00085         matching = pattern.search(login)
00086         version = 0
00087         if matching:
00088                 g = matching.groups()
                return g[0]
def testRegression::GetAutoIncResultsDB ( )

Definition at line 370 of file testRegression.py.

00371                          :
00372         curs = conn.cursor()
00373         sqlstr = "SELECT AUTO_INC.NextVal FROM DUAL"
00374         curs.prepare(sqlstr)
00375         curs.execute(sqlstr)
00376         for row in curs:
00377                 return row[0]
        
def testRegression::GetDate ( )

Definition at line 447 of file testRegression.py.

00448              :
00449         curs = conn.cursor()
00450         sqlstr = "SELECT SYSTIMESTAMP AS \"NOW\" FROM DUAL"
00451         curs.prepare(sqlstr)
00452         curs.execute(sqlstr)
00453         for row in curs:
                return row[0]   
def testRegression::getLogin (   auth,
  connStr 
)

Definition at line 89 of file testRegression.py.

00090                            :
00091         pfile = open(auth, "r")
00092         plist = pfile.readlines()
00093         for i in range (0, len(plist)):
00094                 if string.find(plist[i], '<connection name="'+connStr+'">') != -1:
00095                         PASSWORD = extractLogin(plist[i+2])
00096         return (PASSWORD)
        
def testRegression::GetMaxRunIDStatusDB (   label)

Definition at line 280 of file testRegression.py.

00281                               :
00282         curs = conn.cursor()
00283         sqlstr = "SELECT MAX(RUNID) FROM TEST_STATUS WHERE LABEL = :labl"
00284         curs.prepare(sqlstr)
00285         curs.execute(sqlstr, labl=label)
00286         for row in curs:
00287                 if(row[0] is not None):
00288                         return row[0]
00289                 else:
                        return 0
def testRegression::getText (   nodelist)

Definition at line 25 of file testRegression.py.

00026                      :
00027     rc = []
00028     for node in nodelist:
00029                 if node.nodeType == node.TEXT_NODE:
00030                         rc.append(node.data)
    return ''.join(rc)
def testRegression::NextIDVal (   label)

Definition at line 410 of file testRegression.py.

00411                     :
00412         curs = conn.cursor()
00413         sqlstr = "SELECT ID FROM SEQUENCES WHERE LABEL = :labl FOR UPDATE"
00414         curs.prepare(sqlstr)
00415         curs.execute(sqlstr, labl=label)
00416         maxID = 0
00417         for row in curs:
00418                 maxID = row[0]
00419         maxID += 1
00420         sqlstr = "UPDATE SEQUENCES SET ID = :maxid WHERE LABEL = :labl"
00421         curs.prepare(sqlstr)
00422         curs.execute(sqlstr, maxid = maxID, labl=label)
00423         conn.commit()
00424         curs = conn.cursor()
00425         sqlstr = "SELECT ID FROM SEQUENCES WHERE LABEL = :labl"
00426         curs.prepare(sqlstr)
00427         curs.execute(sqlstr, labl=label)
00428         for row in curs:
                return row[0]
def testRegression::NextRunIDVal (   label)

Definition at line 429 of file testRegression.py.

00430                        :
00431         curs = conn.cursor()
00432         sqlstr = "SELECT RUNID FROM SEQUENCES WHERE LABEL = :labl"
00433         curs.prepare(sqlstr)
00434         curs.execute(sqlstr, labl=label)
00435         maxID = 0
00436         for row in curs:
00437                 maxID = row[0]
00438         maxID += 1
00439         sqlstr = "UPDATE SEQUENCES SET RUNID = :maxid"
00440         curs.prepare(sqlstr)
00441         curs.execute(sqlstr, maxid = maxID)
00442         sqlstr = "SELECT RUNID FROM SEQUENCES WHERE LABEL = :labl"
00443         curs.prepare(sqlstr)
00444         curs.execute(sqlstr, labl=label)
00445         for row in curs:
00446                 return row[0]
                
def testRegression::ParseXML (   filename,
  label 
)

Definition at line 31 of file testRegression.py.

00032                              :
00033         results = []
00034         initResults = []
00035         finalResults = []
00036         dom = parse(filename)
00037         xml = dom.getElementsByTagName("xml")
00038         execTest = False
00039         env = []
00040         if xml != None:
00041                 for xm in xml:
00042                         test = xm.getElementsByTagName("test")
00043                         for it in test:
00044                                 #print it.toxml()
00045                                 if "name" in  it.attributes.keys():
00046                                         tLabel = str(it.attributes["name"].value)
00047                                         if  tLabel == label:
00048                                                 execTest = True
00049                                                 global mLabel
00050                                                 mLabel = label
00051                                 if execTest == True:
00052                                         inits = it.getElementsByTagName("init")
00053                                         finals = it.getElementsByTagName("final")
00054                                         seqs = it.getElementsByTagName("sequence")
00055                                         for init in inits:
00056                                                 commands = init.getElementsByTagName("command")
00057                                                 for command in commands:
00058                                                         if "exec" in  command.attributes.keys():
00059                                                                 initResults.append(str(command.attributes["exec"].value))
00060                                                         if "env" in  command.attributes.keys():
00061                                                                         env.append(str(command.attributes["env"].value))
00062                                         for seq in seqs:
00063                                                 commands = seq.getElementsByTagName("command")
00064                                                 for command in commands:
00065                                                         if "exec" in  command.attributes.keys():
00066                                                                 results.append(str(command.attributes["exec"].value))
00067                                                         if "result" in  command.attributes.keys():
00068                                                                 global resNames
00069                                                                 resNames.append(str(command.attributes["result"].value))
00070                                                         else: 
00071                                                                 resNames.append("%NONE")
00072                                                         if "env" in  command.attributes.keys():
00073                                                                 env.append(str(command.attributes["env"].value))
00074                                         for final in finals:
00075                                                 commands = final.getElementsByTagName("command")
00076                                                 for command in commands:
00077                                                         if "exec" in  command.attributes.keys():
00078                                                                 finalResults.append(str(command.attributes["exec"].value))
00079                                                         if "env" in  command.attributes.keys():
00080                                                                         env.append(str(command.attributes["env"].value))
00081                                 execTest = False
        return initResults,results, finalResults,  env
def testRegression::ReadArgs ( )

Definition at line 647 of file testRegression.py.

00648               :
00649         try:
00650                 opts, args = getopt.getopt(sys.argv[1:], "cdwrthsoiL:R:A:P:", ['R=', 'A=', 'P='])
00651         except getopt.GetoptError, err:
00652                 # print help information and exit:
00653                 print str(err) # will print something like "option -a not recognized"
00654                 CmdUsage()
00655                 sys.exit(2)
00656         RELEASE = None
00657         ARCH = None
00658         PATH = None
00659         REF_RELEASE = None
00660         REF_ARCH = None
00661         REF_PATH = None
00662         LABEL = None
00663         wflag = False
00664         tflag = False
00665         dflag = False
00666         sflag = False
00667         cflag = False
00668         rflag = False
00669         oflag = False
00670         iflag = False
00671         cmds = ""
00672         for o, a in opts:
00673                 if o == "-c":
00674                         cflag = True
00675                 elif o == "-d":
00676                         dflag = True
00677                 elif o == "-w":
00678                         wflag = True
00679                 elif o == "-r":
00680                         rflag = True
00681                 elif o == "-t":
00682                         tflag = True
00683                 elif o == "-s":
00684                         sflag = True
00685                 elif o == "-o":
00686                         oflag = True
00687                 elif o == "-i":
00688                         iflag = True
00689                 elif o == "-L":
00690                         LABEL = a
00691                 elif o == "-R":
00692                         RELEASE = a
00693                 elif o == "-A":
00694                         ARCH = a
00695                 elif o == "-P":
00696                         PATH = a
00697                 elif o in ("-K", "--R"):
00698                         REF_RELEASE = a
00699                 elif o in ("-L", "--A"):
00700                         REF_ARCH = a
00701                 elif o in ("-M", "--P"):
00702                         REF_PATH = a
00703                 elif o == "-h":
00704                         CmdUsage()
00705                 else:
00706                         assert False, "unhandled option"
00707         if(cflag == True):
00708                 if(sflag == True):
00709                         CreateStatusDB()
00710                 else:
00711                         CreateReleaseDB()
00712         if(rflag == True):
00713                 if(sflag == True):
00714                         ReadStatusDB()
00715                 else:
00716                         ReadReleaseDB()
00717         if(wflag == True):
00718                 if(RELEASE != None and ARCH != None and PATH != None):
00719                                 WriteReleaseDB(RELEASE, ARCH, PATH)
00720                 else:
00721                         print "Bad arguments for -w"
00722         if(dflag == True):
00723                 if(sflag == True):
00724                         DropStatusDB();
00725                 else:
00726                         if(RELEASE != None and ARCH != None):
00727                                 DeleteReleaseDB(RELEASE, ARCH)
00728                         else:
00729                                 DropReleaseDB();
00730         if(tflag == True): 
00731                 if LABEL != None :
00732                         global pResults, iResults, fResults, setEnvs
00733                         iResults,pResults, fResults , setEnvs = ParseXML("sequences.xml", LABEL)
00734                         if(iResults == None or pResults == None or fResults == None):
00735                                 print "Error : sequences.xml reading failed!"
00736                         if(RELEASE != None and ARCH != None and PATH != None):
00737                                 if(oflag == True):
00738                                         if(REF_RELEASE != None and REF_ARCH != None and REF_PATH != None):
00739                                                 if(CheckPath(RELEASE, ARCH, PATH) == True):
00740                                                         if(CheckPath(REF_RELEASE, REF_ARCH, REF_PATH) == True):
00741                                                                 cmds=TestCompatRef(LABEL, RELEASE, ARCH, PATH, REF_RELEASE, REF_ARCH, REF_PATH)
00742                                                         else :
00743                                                                 print "Bad reference release arguments"
00744                                                 else :
00745                                                         print "Bad test release arguments"
00746                                         else:
00747                                                 print "Bad arguments for -t"
00748                                 else:
00749                                         if(CheckPath(RELEASE, ARCH, PATH) == True):
00750                                                 cmds = ''
00751                                                 if iflag == True:
00752                                                         cmds += TestCompatRef(LABEL, RELEASE, ARCH, PATH, RELEASE, ARCH, PATH)
00753                                                 cmds += TestCompat(LABEL, RELEASE, ARCH, PATH)
00754                                         else :
00755                                                 print "Bad test release arguments"
00756                 else:
00757                         print "Bad arguments for -t"
00758         return (cmds, LABEL)

def testRegression::ReadCurrentStatusDB (   runID)

Definition at line 290 of file testRegression.py.

00291                               :
00292         curs = conn.cursor()
00293         sqlstr = "SELECT ID, RUNID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH, R_RELEASE, R_ARCH "
00294         sqlstr +="FROM TEST_STATUS WHERE RUNID = :rid ORDER BY ID"
00295         curs.prepare(sqlstr)
00296         curs.execute(sqlstr, rid= runID)
00297         print 'STATUS TABLE READ'
00298         print 'ID  RUNID RDATE  LABEL   T_RELEASE     T_ARCH      R_RELEASE     R_ARCH'
00299         for row in curs:
00300                 print row
                print ReadResultsDB(row[0])
def testRegression::ReadReleaseDB ( )

Definition at line 239 of file testRegression.py.

00240                    :
00241         curs = conn.cursor()
00242         sqlstr = "SELECT ID, RELEASE, ARCH, PATH FROM VERSION_TABLE ORDER BY ID, RELEASE, ARCH"
00243         curs.prepare(sqlstr)
00244         curs.execute(sqlstr)
00245         print 'VERSION TABLE READ'
00246         print 'ID     RELEASE     ARCH     PATH'
00247         for row in curs:
00248                 print row
                
def testRegression::ReadResultsDB (   id)

Definition at line 362 of file testRegression.py.

00363                      :
00364         curs = conn.cursor()
00365         sqlstr = "SELECT LABEL, NAME, STATUS FROM TEST_RESULTS WHERE ID = :ids"
00366         curs.prepare(sqlstr)
00367         curs.execute(sqlstr, ids = id)
00368         conn.commit()
00369         for row in curs:
                print row
def testRegression::ReadSequenceDB (   label)

Definition at line 389 of file testRegression.py.

00390                          :
00391         curs = conn.cursor()
00392         sqlstr = "SELECT * FROM SEQUENCES WHERE LABEL = :labl"
00393         curs.prepare(sqlstr)
00394         curs.execute(sqlstr, labl=label)
00395         for row in curs:
                print row
def testRegression::ReadStatusDB ( )

Definition at line 268 of file testRegression.py.

00269                   :
00270         curs = conn.cursor()
00271         sqlstr = "SELECT ID, RUNID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH, R_RELEASE, R_ARCH, LOG "
00272         sqlstr +="FROM TEST_STATUS ORDER BY ID"
00273         curs.prepare(sqlstr)
00274         curs.execute(sqlstr)
00275         print 'STATUS TABLE READ'
00276         print 'ID  RUNID RDATE   LABEL  T_RELEASE     T_ARCH      R_RELEASE     R_ARCH'
00277         for row in curs:
00278                 print row[0:8]
00279                 print ReadResultsDB(row[0])
                print row[8].read() 
def testRegression::RunTest (   label,
  release,
  arch,
  path,
  refRelease,
  refArch,
  refPath 
)

Definition at line 555 of file testRegression.py.

00556                                                                       :
00557         cmds ="""
00558         RETVAL=0
00559 echo "*****************************************************************************************"
00560 echo "Reference release: """+refRelease+""" "
00561 echo "Arch: """+refArch+""" "
00562 echo "Path: """+refPath+""" "
00563 echo "*****************************************************************************************"
00564 """
00565         nr = 0
00566         enr = 0
00567         envType = 0
00568         print "init"
00569         for res in iResults:
00570                 cmds += """
00571 echo "==============================================="
00572 """
00573                 print res
00574                 if setEnvs[enr] == "ref" and envType != 1:
00575                         cmds += SetEnv(refRelease, refArch,refPath)
00576                         envType = 1
00577                 elif setEnvs[enr] == "cand" and envType != 2:
00578                         cmds += SetEnv(release, arch, path)
00579                         envType = 2
00580                 cmds +=Command(res)
00581                 enr +=1
00582         print "cmd"
00583         for res in pResults:
00584                 cmds += """
00585 echo "==============================================="
00586 """
00587                 print res
00588                 if setEnvs[enr] == "ref" and envType != 1:
00589                         cmds += SetEnv(refRelease, refArch,refPath)
00590                         envType = 1
00591                 elif setEnvs[enr] == "cand" and envType != 2:
00592                         cmds += SetEnv(release, arch, path)
00593                         envType = 2
00594                 cmds +=Command(res)
00595                 cmds += 'RCODE['+str(nr)+']=$RETVAL'
00596                 nr +=1
00597                 enr +=1
00598         print "final"
00599         cmds += """
00600         RETVAL=0
00601         """
00602         for res in fResults:
00603                 cmds += """
00604 echo "==============================================="
00605 """
00606                 print res
00607                 if setEnvs[enr] == "ref" and envType != 1:
00608                         cmds += SetEnv(refRelease, refArch,refPath)
00609                         envType = 1
00610                 elif setEnvs[enr] == "cand" and envType != 2:
00611                         cmds += SetEnv(release, arch, path)
00612                         envType = 2
00613                 cmds +=Command(res)
00614                 enr +=1
00615         global resCount
00616         resCount = nr
00617         cmds += """
00618 echo "==============================================="
00619         echo "Script return code : ${RCODE[1]}"
00620 echo "!L!"""+label+"""!TR!"""+release+"""!TA!"""+arch+"""!RR!"""+refRelease+"""!RA!"""+refArch
00621         for i in range (0, nr):
00622                 cmds+= "!C"+str(i)+"!${RCODE["+str(i)+"]}"
00623         cmds += "\""
        return cmds
def testRegression::setConn ( )

Definition at line 97 of file testRegression.py.

00098              :
00099         os.environ['TNS_ADMIN'] = "/afs/cern.ch/project/oracle/admin"
00100         coralConnStr = "oracle://"+DATABASE+"/"+USERNAME+""
00101         PASSWORD = getLogin(AUTH_PATH, coralConnStr)
00102         conn_string = str(USERNAME+"/"+PASSWORD+"@"+DATABASE)   
00103         conn = cx_Oracle.connect(conn_string)   
        return {'r0':conn, 'r1':coralConnStr, 'r2':USERNAME, 'r3':PASSWORD, 'r4':AUTH_PATH}
def testRegression::SetEnv (   release,
  arch,
  path 
)

Definition at line 496 of file testRegression.py.

00497                                :
00498         random.seed()
00499         srcPath = os.path.join(path, release,"src")
00500         cmds = """
00501 if [ $RETVAL = 0 ]; then
00502 echo "Setting environment variables for """+release+""" """+arch+""" "
00503 echo "path : """+path+""""
00504         eval pushd """+srcPath+"""
00505         RETVAL=$?
00506         if [ $RETVAL = 0 ]; then
00507                 export SCRAM_ARCH="""+arch+"""
00508                 RETVAL=$?
00509                 if [ $RETVAL = 0 ]; then
00510                         eval `scram runtime -sh`
00511                         RETVAL=$?
00512                         if [ $RETVAL = 0 ]; then
00513                                 export TNS_ADMIN=/afs/cern.ch/project/oracle/admin
00514                                 RETVAL=$?
00515                                 if [ $RETVAL = 0 ]; then
00516                                         eval popd
00517                                         RETVAL=$?
00518                                 fi
00519                         fi
00520                 fi
00521         TRELEASE="""+release+"""
00522         TARCH="""+arch+"""
00523         TPATH="""+path+"""
00524         TMAPNAME="""+release+"""_"""+arch+"""
00525         TMAINDB="""+coralConnStr+"""
00526         TAUXDB="""+"oracle://cms_orcoff_prep/CMS_COND_WEB"+"""
00527         TUSERNAME="""+USERNAME+"""
00528         TPASSWORD="""+PASSWORD+"""
00529         TTEST=$LOCALRT/test/$TARCH
00530         TBIN=$LOCALRT/bin/$TARCH
00531         TAUTH="""+AUTH_PATH+"""
00532         TSEED="""+str(random.randrange(1, 10))+"""
00533 echo "Environment variables set successfully"
00534         else
00535 echo "Setting environment failed on """+release+""" """+arch+""" return code :  $RETVAL"
00536         fi
00537 fi
00538 echo "----------------------------------------------" 
00539 """
        return cmds
def testRegression::TestCompat (   label,
  release,
  arch,
  path 
)

Definition at line 454 of file testRegression.py.

00455                                           :
00456         relID = extractID(release)
00457         print "Testing exec "+label+" "+release+" "+arch+" from "
00458         print path+" : "
00459         curs = conn.cursor()
00460         cmds = """
00461 echo ""
00462 echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
00463 echo "Candidate release: """+release+""" "
00464 echo "Arch: """+arch+""" "
00465 echo "Path: """+path+""" "
00466 echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
00467 """
00468         sqlstr = "SELECT RELEASE, ARCH, PATH FROM VERSION_TABLE WHERE ID < :rid"
00469         curs.prepare(sqlstr)
00470         curs.execute(sqlstr, rid = relID)
00471         for row in curs:
00472                 cmds += RunTest(label, release, arch, path, row[0], row[1], row[2])
        return cmds
def testRegression::TestCompatRef (   label,
  release,
  arch,
  path,
  refRelease,
  refArch,
  refPath 
)

Definition at line 473 of file testRegression.py.

00474                                                                            :
00475         relID = extractID(release)
00476         print "Testing "+release+" "+arch+" from "
00477         print path+" : "
00478         curs = conn.cursor()
00479         cmds = """
00480 echo ""
00481 echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
00482 echo "Candidate release: """+release+""" "
00483 echo "Arch: """+arch+""" "
00484 echo "Path: """+path+""" "
00485 echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
00486 """
00487         cmds += RunTest(label, release, arch, path, refRelease, refArch, refPath)
        return cmds
def testRegression::WebLabels ( )

Definition at line 125 of file testRegression.py.

00126                :
00127         result = setConn()
00128         con = result.get('r0')
00129         curs = con.cursor()
00130         sqlstr = "SELECT DISTINCT LABEL FROM TEST_STATUS"
00131         curs.prepare(sqlstr)
00132         curs.execute(sqlstr)
00133         return curs

def testRegression::WebReadLogStatusDB (   label,
  runID 
)

Definition at line 179 of file testRegression.py.

00180                                     :
00181         result = setConn()
00182         con = result.get('r0')
00183         curs = con.cursor()
00184         sqlstr = "SELECT LOG FROM TEST_STATUS WHERE RUNID = :rid"
00185         curs.prepare(sqlstr)
00186         curs.execute(sqlstr, rid = runID)
00187         for row in curs:
                return row[0].read()
def testRegression::WebReleasesHeaders (   label,
  release = "",
  arch = "" 
)

Definition at line 161 of file testRegression.py.

00162                                                   :
00163         result = setConn()
00164         con = result.get('r0')
00165         curs = con.cursor()
00166         if(release != "" and arch != ""):
00167                 sqlstr = "SELECT DISTINCT RUNID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH FROM TEST_STATUS WHERE T_RELEASE = :rel AND T_ARCH = :arc AND LABEL = :labl ORDER BY RUNID DESC"
00168                 curs.prepare(sqlstr)
00169                 curs.execute(sqlstr, rel=release, arc=arch, labl=label)
00170         elif(release != ""):
00171                 sqlstr = "SELECT DISTINCT RUNID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH FROM TEST_STATUS WHERE T_RELEASE = :rel AND LABEL = :labl ORDER BY RUNID DESC"
00172                 curs.prepare(sqlstr)
00173                 curs.execute(sqlstr, rel=release, labl=label)
00174         elif(arch != ""):
00175                 sqlstr = "SELECT DISTINCT RUNID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH FROM TEST_STATUS WHERE T_ARCH = :arc AND LABEL = :labl ORDER BY RUNID DESC"
00176                 curs.prepare(sqlstr)
00177                 curs.execute(sqlstr, arc=arch, labl=label)
00178         result = curs.fetchall()
        return result
def testRegression::WebResultsList (   runID,
  label 
)

Definition at line 144 of file testRegression.py.

00145                                 :
00146         result = setConn()
00147         con = result.get('r0')
00148         curs = con.cursor()
00149         sqlstr = "SELECT ID FROM TEST_STATUS WHERE RUNID = :rid AND LABEL = :labl"
00150         curs.prepare(sqlstr)
00151         curs.execute(sqlstr, rid = runID, labl = label)
00152         idList = []
00153         for row in curs:
00154                 idList.append(row[0])
00155         sqlstr = "SELECT ID, STATUS, NAME FROM TEST_RESULTS WHERE ID >= :mi AND ID <= :ma AND LABEL = :labl"
00156         curs.prepare(sqlstr)
00157         curs.execute(sqlstr, mi=min(idList), ma=max(idList), labl = label)
00158         result = curs.fetchall()
00159         count = len(result)/len(idList)
00160         print count
        return result, count
def testRegression::WebStatus (   id,
  label 
)

Definition at line 134 of file testRegression.py.

00135                         :
00136         result = setConn()
00137         con = result.get('r0')
00138         curs = con.cursor()
00139         sqlstr = "SELECT ID, R_RELEASE, R_ARCH FROM TEST_STATUS WHERE RUNID = :ids AND LABEL = :labl ORDER BY R_RELEASE" 
00140         curs.prepare(sqlstr)
00141         curs.execute(sqlstr, ids=id, labl=label)
00142         result = curs.fetchall()
00143         return result
        
def testRegression::WebStatusHeaders (   label)

Definition at line 114 of file testRegression.py.

00115                            :
00116         result = setConn()
00117         con = result.get('r0')
00118         curs = con.cursor()
00119         sqlstr = "SELECT DISTINCT RUNID, TO_CHAR(RDATE, 'DD.MM.YYYY HH24:MI:SS'), LABEL, T_RELEASE, T_ARCH "
00120         sqlstr +="FROM TEST_STATUS WHERE LABEL = :labl ORDER BY RUNID DESC"
00121         curs.prepare(sqlstr)
00122         curs.execute(sqlstr, labl = label)
00123         result = curs.fetchall()
00124         return result
                
def testRegression::WebStatusRunID (   label)

Definition at line 104 of file testRegression.py.

00105                          :
00106         result = setConn()
00107         con = result.get('r0')
00108         curs = con.cursor()
00109         sqlstr = "SELECT MAX(RUNID) FROM TEST_STATUS WHERE LABEL = :labl"
00110         curs.prepare(sqlstr)
00111         curs.execute(sqlstr, labl=label)
00112         max = 0
00113         for row in curs:
                return row[0]
def testRegression::WriteReleaseDB (   release,
  arch,
  path 
)

Definition at line 488 of file testRegression.py.

00489                                        :
00490         curs = conn.cursor()
00491         relID = extractID(release)
00492         print "relID "+str(relID)
00493         sqlstr = "INSERT INTO VERSION_TABLE(ID, RELEASE, ARCH, PATH) VALUES(:rid, :rel, :arc, :pat)"
00494         curs.execute(sqlstr, rid = relID, rel = release, arc = arch, pat = path)
00495         conn.commit()
        print 'TABLE WRITTEN'   
def testRegression::WriteResultsDB (   id,
  label,
  name,
  status 
)

Definition at line 355 of file testRegression.py.

00356                                            :
00357         curs = conn.cursor()
00358         sqlstr = "INSERT INTO TEST_RESULTS(RID, ID, LABEL, NAME, STATUS)"
00359         sqlstr +="VALUES(:rid, :ids, :labl, :nam, :stat)"
00360         curs.prepare(sqlstr)
00361         curs.execute(sqlstr, rid = GetAutoIncResultsDB(), ids = id, labl = label, nam = name, stat = status)
        conn.commit()
def testRegression::WriteSequenceDB (   label)

Definition at line 384 of file testRegression.py.

00385                           :
00386         curs = conn.cursor()
00387         sqlstr = "INSERT INTO SEQUENCES (LABEL, ID, RUNID) VALUES (:labl, 0, 0)"
00388         curs.prepare(sqlstr)
        curs.execute(sqlstr, labl=label)
def testRegression::WriteStatusDB (   runID,
  match 
)

Definition at line 301 of file testRegression.py.

00302                                :
00303         curs = conn.cursor()
00304         id = NextIDVal(match[0])
00305         sqlstr = "INSERT INTO TEST_STATUS(ID, RUNID, RDATE, LABEL, T_RELEASE, T_ARCH, R_RELEASE, R_ARCH)"
00306         sqlstr +="VALUES(:ids, :rid, :ts, :labl, "
00307         sqlstr +=":trel, :tarc, :rrel, :rarc)"
00308         curs.prepare(sqlstr)
00309         curs.execute(sqlstr, ids = id , rid = runID, ts=timeStamp, labl=match[0], trel = match[1], tarc = match[2], rrel = match[3], rarc = match[4])
00310         conn.commit()
00311         for i in range(5, len(match)):
00312                 if resNames[i-5] != "%NONE":
                        WriteResultsDB(id, label, resNames[i-5], match[i])

Variable Documentation

string testRegression::AUTH_PATH = "/afs/cern.ch/cms/DB/conddb/test/authentication.xml"

Definition at line 22 of file testRegression.py.

string testRegression::DATABASE = "cms_orcoff_prep"

Definition at line 20 of file testRegression.py.

Definition at line 19 of file testRegression.py.

tuple testRegression::pipe = subprocess.Popen(cmdList, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

Definition at line 771 of file testRegression.py.

Definition at line 17 of file testRegression.py.

Definition at line 18 of file testRegression.py.

tuple testRegression::result = setConn()

Definition at line 759 of file testRegression.py.

string testRegression::stat = "SUCCESS"

Definition at line 781 of file testRegression.py.

Referenced by DTSectColl::addTU(), CSCTFAnalyzer::analyze(), L1GctPrintLuts::analyze(), L1TCSCTF::analyze(), L1MuDTEtaProcessor::assign(), DTRunConditionVar::beginJob(), DTTriggerEfficiencyTask::beginRun(), DTLocalTriggerTask::beginRun(), DTLocalTriggerBaseTask::beginRun(), DTTriggerEfficiencyTest::beginRun(), DTLocalTriggerEfficiencyTest::beginRun(), CSCTriggerPrimitivesBuilder::build(), StormStorageMaker::check(), StormLcgGtStorageMaker::check(), RFIOStorageMaker::check(), LocalStorageMaker::check(), stor::utils::checkDirectory(), stor::FileHandler::checkFileSizeMatch(), HcalDetDiagLEDMonitor::CheckStatus(), HcalDetDiagPedestalMonitor::CheckStatus(), pos::PixelROCStatus::clear(), DTSectCollThCand::CoarseSync(), L1MuGMTMatrix< T >::colAny(), MuonDTSeedFromRecHits::computePtWithVtx(), EcalUncalibRecHitRatioMethodAlgo< C >::computeTime(), CSCTriggerPrimitivesBuilder::CSCTriggerPrimitivesBuilder(), DQMFileSaver::DQMFileSaver(), DTRunConditionVarClient::endRun(), SiStripDetVOffBuilder::FileExists(), MuonShowerInformationFiller::fillHitsByStation(), LocalFileSystem::findCachePath(), pos::PixelROCStatus::get(), MatacqProducer::getCalibTriggerType(), LaserSorter::getDetailedTriggerType(), WatcherStreamFileReader::getInputFile(), reco::HitPattern::getRPCLayer(), L1MuDTAssignmentUnit::getTSphi(), metsig::SignAlgoResolutions::initializeJetResolutions(), reco::HitPattern::innermostMuonStationWithHits(), LocalFileSystem::isLocalPath(), L1MuDTAddressArray::L1MuDTAddressArray(), LaserSorter::LaserSorter(), main(), FileToolKit::MakeDir(), pos::PixelConfigFile::makeNewVersion(), MatacqProducer::mcheck(), MatacqProducer::msize(), L1MuDTAddressArray::operator!=(), operator<<(), L1MuDTAddressArray::operator=(), L1MuDTAddressArray::operator==(), reco::HitPattern::outermostMuonStationWithHits(), evf::iDie::perLumiFileSaver(), evf::Vulture::prowling(), PileUpProducer::read(), NuclearInteractionSimulator::read(), L1MuDTEtaProcessor::receiveData(), L1MuDTAddressArray::reset(), LaserSorter::restoreStreamsOfLumiBlock(), L1MuGMTMatrix< T >::rowAny(), L1MuDTWedgeSorter::run(), DTLocalTriggerTPTest::runClientDiagnostic(), DTLocalTriggerLutTest::runClientDiagnostic(), DTTriggerEfficiencyTest::runClientDiagnostic(), DTLocalTriggerEfficiencyTest::runClientDiagnostic(), DTTriggerLutTest::runClientDiagnostic(), DTLocalTriggerTest::runClientDiagnostic(), L1MuDTWedgeSorter::runCOL(), pos::PixelROCStatus::set(), HcalDetDiagPedestalData::set_statistics(), HcalDetDiagLaserData::set_statistics(), HcalDetDiagLaserData::set_statistics1(), CSCTriggerPrimitivesBuilder::setConfigParameters(), CalibCoeff::setStatus(), File::size(), LocalFileSystem::statFSInfo(), LaserSorter::streamFileName(), L1MuDTAssignmentUnit::TSR(), WatcherStreamFileReader::WatcherStreamFileReader(), and CSCTriggerPrimitivesBuilder::~CSCTriggerPrimitivesBuilder().

tuple testRegression::stdout_value = pipe.communicate()

Definition at line 772 of file testRegression.py.

tuple testRegression::timeStamp = GetDate()
string testRegression::USERNAME = "CMS_COND_REGRESSION"

Definition at line 21 of file testRegression.py.