apicompatanamdw/compatanalysercmd/libraryanalyser/tsrc/latest.py
changeset 12 a0eee409ff14
equal deleted inserted replaced
11:bdd2944b914b 12:a0eee409ff14
       
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 #
       
    16 
       
    17 import sys
       
    18 import os
       
    19 import re
       
    20 import time
       
    21 import platform
       
    22 from xml.dom import minidom
       
    23 
       
    24 TC_DIR = os.getcwd() + os.sep + "TC" + os.sep
       
    25 SCRIPTS_DIR = os.getcwd() + os.sep + "scripts" + os.sep
       
    26 RESULTS_DIR = os.getcwd() + os.sep + "results" + os.sep
       
    27 usage = "-h /h -? /?".split()
       
    28 debug = 0
       
    29 
       
    30 def UpdateTimeTaken(tm):
       
    31     global time_taken, total_time_taken
       
    32     time_taken = tm
       
    33     total_time_taken += tm
       
    34 
       
    35 def Usage():
       
    36     print "Usage               : "+ sys.argv[0] + " <outputfile> | -build [<testcasefile>]"
       
    37     print "Execute test case(s): " + sys.argv[0] + " <outputfile> [<testcasefile>]"
       
    38     print "Build test case     : " + sys.argv[0] + " -build <testcase name>"
       
    39     sys.exit()
       
    40 
       
    41 def LABuild():
       
    42     if len(sys.argv) != 3:
       
    43         Usage()
       
    44     cmd = "python " + SCRIPTS_DIR + "latestbuild.py " + sys.argv[2].upper()
       
    45     os.system(cmd)
       
    46     sys.exit()
       
    47 
       
    48 def OpenResults():
       
    49     result = RESULTS_DIR + sys.argv[1]
       
    50     if os.path.exists(result) and os.name == 'nt':
       
    51         os.startfile(result)
       
    52     return
       
    53     
       
    54 def RunAll():
       
    55     global time_taken;
       
    56     cases = os.listdir(TC_DIR)
       
    57     p = re.compile('^LATC')
       
    58     for tc in cases:
       
    59         tc = tc.strip().upper()
       
    60         if p.match(tc):
       
    61             print "\n" + tc
       
    62             cmd = "python " +"\""+  SCRIPTS_DIR + "latestrun.py " + "\" " + tc
       
    63             stime = time.clock()
       
    64             os.system(cmd)
       
    65             etime = time.clock()
       
    66             UpdateTimeTaken(etime-stime)
       
    67             CompareResult(tc)
       
    68     WriteXml()
       
    69     if os.name != "posix" :
       
    70         OpenResults()
       
    71     return
       
    72     
       
    73 def RunTC():
       
    74     global time_taken;
       
    75     file = open( sys.argv[2] )
       
    76     cases = file.readlines()
       
    77     file.close()
       
    78     for tc in cases:
       
    79         tc = tc.strip().upper()
       
    80         if tc:
       
    81             print "\n" + tc
       
    82             cmd = "python " +"\""+ SCRIPTS_DIR + "latestrun.py " + "\" "+ tc
       
    83             stime = time.clock()
       
    84             os.system(cmd)
       
    85             etime = time.clock()
       
    86             UpdateTimeTaken(etime-stime)
       
    87             CompareResult(tc)
       
    88     WriteXml()
       
    89     if os.name != "posix" :
       
    90         OpenResults()
       
    91     return
       
    92 
       
    93 
       
    94 def CheckIssues(issue1, issueArr):
       
    95     issuefound = 0
       
    96 
       
    97     if debug == 1:
       
    98         print >>debfile, "-------------------------------\n"
       
    99         print >>debfile, "Type Id: "+ issue1.getElementsByTagName('typeid')[0].firstChild.data +" --> "
       
   100     
       
   101     for issue2 in issueArr:
       
   102         if  issue1.getElementsByTagName('typeid')[0].firstChild.data == issue2.getElementsByTagName('typeid')[0].firstChild.data and \
       
   103             (issue1.getElementsByTagName('funcpos').length == 0 or issue1.getElementsByTagName('funcpos')[0].firstChild.data == issue2.getElementsByTagName('funcpos')[0].firstChild.data ) and \
       
   104             (issue1.getElementsByTagName('newfuncpos').length == 0 or issue1.getElementsByTagName('newfuncpos')[0].firstChild.data == issue2.getElementsByTagName('newfuncpos')[0].firstChild.data ) and \
       
   105             (issue1.getElementsByTagName('funcname').length == 0 or issue1.getElementsByTagName('funcname')[0].firstChild.data == issue2.getElementsByTagName('funcname')[0].firstChild.data ) and \
       
   106             (issue1.getElementsByTagName('newfuncname').length == 0 or issue1.getElementsByTagName('newfuncname')[0].firstChild.data == issue2.getElementsByTagName('newfuncname')[0].firstChild.data ) and \
       
   107             (issue1.getElementsByTagName('bc_severity') == 0 or issue1.getElementsByTagName('bc_severity')[0].firstChild.data == issue2.getElementsByTagName('bc_severity')[0].firstChild.data ) and \
       
   108             (issue1.getElementsByTagName('sc_severity') == 0 or issue1.getElementsByTagName('sc_severity')[0].firstChild.data == issue2.getElementsByTagName('sc_severity')[0].firstChild.data ):
       
   109                if debug == 1:
       
   110                    print >>debfile, "Found.\n"
       
   111                issuefound = 1
       
   112                break				
       
   113 
       
   114     if issuefound == 0:        
       
   115         if debug == 1:
       
   116             print >>debfile, "NOT FOUND.\n"
       
   117 
       
   118     return issuefound 
       
   119 
       
   120 def WriteXml():
       
   121     global totalCount, passedCount, timeval, outfile, errfile, debug, debfile, time_taken, total_time_taken
       
   122     timeval = time.strftime("%a %b %d, %Y at %H:%M:%S", time.localtime())
       
   123     
       
   124     if totalCount > 0:
       
   125         passedPercent = "%.2f" % (passedCount/totalCount)*100
       
   126     else:
       
   127         passedPercent = "0"
       
   128 
       
   129     failedcount = totalCount - passedCount
       
   130     ohdr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
       
   131     ohdr = ohdr + "<?xml-stylesheet type=\"text/xsl\" href=\"latestresults.xsl\"?>\n"
       
   132     ohdr = ohdr+"<testsuite errors=\"0\" failures=\""+str(failedcount)+"\" hostname=\""+platform.node()+"\" name=\"LibraryAnalyser\" tests=\""+str(totalCount)+"\" time=\""+str(round(total_time_taken,3))+"\" timestamp=\""+str(timeval)+"\">\n"
       
   133     ohdr = ohdr+"<properties>\n</properties>\n"
       
   134     ohdr = ohdr+ostr+"</testsuite>\n"
       
   135     print >>outfile, ohdr
       
   136     outfile.close()
       
   137     
       
   138     if passedCount == totalCount:
       
   139         print >>errfile, "No differencies.\n"
       
   140     
       
   141     errfile.close()
       
   142     if debug == 1:
       
   143         debfile.close()
       
   144 
       
   145 def CompareResult(tc):              
       
   146     global ostr, totalCount, passedCount, debug, debfile, errfile
       
   147     if debug == 1:
       
   148         print >>debfile, "\n-----------------------\n"
       
   149         print >>debfile, "Testcase "+tc+"\n"
       
   150         print >>debfile, "-----------------------\n"
       
   151     
       
   152     # Read expected results (xml report):
       
   153     expfilename = "TC"+os.sep+tc+os.sep+"results"+os.sep+"expected_results.xml"
       
   154     if debug == 1:
       
   155         print >>debfile, "Reading expected results from file: "+expfilename+"\n"
       
   156         
       
   157     expected = minidom.parse(expfilename)
       
   158                             
       
   159     # Read actual results (xml report):
       
   160     actfilename = "TC"+os.sep+tc+os.sep+"results"+os.sep+"results.xml"
       
   161     if not os.path.exists(actfilename):
       
   162         failed = 1
       
   163         print >>errfile, "--------------------------------------------\n"
       
   164         print >>errfile, "TESTCASE: "+tc+"\n\n"
       
   165         print >>errfile, "Difference: Actual results file missing:\n"
       
   166         print >>errfile, "Filename: "+actfilename+"\n"
       
   167         print >>errfile, "--------------------------------------------\n"
       
   168         ostr = ostr+"  <testcase classname=\"LibraryAnalyser\" name=\""+tc+"\" time=\""+str(round(time_taken,3))+"\"\">\n"
       
   169         ostr = ostr+"    <failure message=\"Failed\" type=\"Failed\">Failed</failure>\n"
       
   170         ostr = ostr+"    <expresults>"+os.pardir+os.sep+expfilename+"</expresults>\n"
       
   171         ostr = ostr+"    <actresults>"+os.pardir+os.sep+actfilename+"</actresults>\n"
       
   172         ostr = ostr+"  </testcase>\n"
       
   173         totalCount += 1
       
   174         return
       
   175 
       
   176     if debug == 1 :
       
   177         print >>debfile, "Reading actual results from file: "+actfilename+"\n"
       
   178 
       
   179     actual = minidom.parse(actfilename)               
       
   180     ostr = ostr + "  <testcase classname=\"LibraryAnalyser\" name=\""+tc+"\" time=\""+str(round(time_taken,3))+"\">\n"
       
   181        
       
   182 
       
   183     totalCount += 1
       
   184     
       
   185     failed = 0 
       
   186     libfound = 0 
       
   187 
       
   188     for expLibrary in expected.getElementsByTagName('library'):   
       
   189         libfound = 0 
       
   190         if expLibrary.getElementsByTagName('name')[0].firstChild != None:
       
   191             expLibraryFilename = expLibrary.getElementsByTagName('name')[0].firstChild.data
       
   192         else:
       
   193             expLibraryFilename = " "
       
   194             
       
   195         if expLibrary.getElementsByTagName('comparefilename')[0].firstChild != None:
       
   196             expLibraryCompareFilename = expLibrary.getElementsByTagName('comparefilename')[0].firstChild.data
       
   197         else:
       
   198             expLibraryCompareFilename = " "
       
   199             
       
   200         # Strip off the paths from the filenames:
       
   201         
       
   202         if expLibraryFilename != " ":
       
   203           tmpIndex = expLibraryFilename.lower().rindex('\\') # index where the Library name begins
       
   204           expFile = expLibraryFilename[ tmpIndex+1 : len(expLibraryFilename) ].lower()
       
   205         else:
       
   206           expFile = " "
       
   207        
       
   208        
       
   209         if expLibraryCompareFilename != " ":
       
   210             tmpIndex = expLibraryCompareFilename.lower().rindex('\\') # index of last backslash.
       
   211             expCompareFile = expLibraryCompareFilename[ tmpIndex+1 : len(expLibraryCompareFilename) ].lower()
       
   212         else:
       
   213             expCompareFile = " "
       
   214 
       
   215         if debug == 1:
       
   216             print >>debfile, "********************************\n"
       
   217             print >>debfile, "EXP FILE: "+expFile+" -->\n"
       
   218 
       
   219         for actLibrary in actual.getElementsByTagName('library'):
       
   220             if actLibrary.getElementsByTagName('name')[0].firstChild != None:
       
   221                 actLibraryFilename = actLibrary.getElementsByTagName('name')[0].firstChild.data
       
   222             else:
       
   223                 actLibraryFilename = " "
       
   224                 
       
   225             if actLibrary.getElementsByTagName('comparefilename')[0].firstChild != None:
       
   226                 actLibraryCompareFilename = actLibrary.getElementsByTagName('comparefilename')[0].firstChild.data
       
   227             else:
       
   228                 actLibraryCompareFilename = " "
       
   229             
       
   230             # Strip off the paths from the filenames:
       
   231             
       
   232             if actLibraryFilename != " ":
       
   233                 tmpIndex = actLibraryFilename.lower().rindex(os.sep)  # index of last backslash.
       
   234                 actFile = actLibraryFilename[ tmpIndex+1 : len(actLibraryFilename) ].lower()
       
   235             else:
       
   236                 actFile = " "
       
   237             
       
   238             if actLibraryCompareFilename != " ":
       
   239                 tmpIndex = actLibraryCompareFilename.lower().rindex(os.sep)  # index of last backslash.
       
   240                 actCompareFile = actLibraryCompareFilename[ tmpIndex+1 : len(actLibraryCompareFilename) ].lower()
       
   241             else:
       
   242                 actCompareFile = " "
       
   243 
       
   244             if expFile == actFile:   
       
   245                 if debug == 1:
       
   246                     print >>debfile, "Found.\n"
       
   247                     
       
   248                 for iss1 in expLibrary.getElementsByTagName('issue'):
       
   249                     if CheckIssues(iss1, actLibrary.getElementsByTagName('issue')) == 0:
       
   250                         failed = 1
       
   251                         print >>errfile, "--------------------------------------------\n"
       
   252                         print >>errfile, "TESTCASE: "+tc+"\n\n"
       
   253                         print >>errfile, "Difference: Issue missing from actual results:\n"
       
   254                         print >>errfile, "Filename: "+expFile+"\n"
       
   255                         if iss2.getElementsByTagName('typeid').length > 0:
       
   256                             print >>errfile, "Typeid: "+iss1.getElementsByTagName('typeid')[0].firstChild.data+"\n"
       
   257                         if iss1.getElementsByTagName('funcpos').length > 0:
       
   258                             print >>errfile, "Function position: "+iss1.getElementsByTagName('funcpos')[0].firstChild.data+"\n"
       
   259                         if iss1.getElementsByTagName('newfuncpos').length > 0:
       
   260                             print >>errfile, "New function position: "+iss1.getElementsByTagName('newfuncpos')[0].firstChild.data+"\n"
       
   261                         if iss1.getElementsByTagName('funcname').length > 0:
       
   262                             print >>errfile, "Function name: "+iss1.getElementsByTagName('funcname')[0].firstChild.data+"\n"
       
   263                         if iss1.getElementsByTagName('newfuncname').length > 0:
       
   264                             print >>errfile, "New function name: "+iss1.getElementsByTagName('newfuncname')[0].firstChild.data+"\n"
       
   265                         if iss1.getElementsByTagName('bc_severity').length > 0:
       
   266                             print >>errfile, "BC Severity: "+iss1.getElementsByTagName('bc_severity')[0].firstChild.data+"\n"
       
   267                         if iss1.getElementsByTagName('sc_severity').length > 0:
       
   268                             print >>errfile, "SC Severity: "+iss1.getElementsByTagName('sc_severity')[0].firstChild.data+"\n"
       
   269                         print >>errfile, "--------------------------------------------\n"
       
   270 
       
   271                 libfound = 1
       
   272                 break
       
   273             
       
   274 
       
   275         if libfound == 0:
       
   276             if debug == 1:
       
   277                 print >>debfile, "NOT FOUND.\n"
       
   278             failed = 1
       
   279             print >>errfile, "--------------------------------------------\n"
       
   280             print >>errfile, "TESTCASE: "+tc+"\n\n"
       
   281             print >>errfile, "Difference: Library results missing from actual results:\n"
       
   282             print >>errfile, "Filename: "+expFile+"\n"
       
   283             if expLibrary.getElementsByTagName('typeid').length > 0:
       
   284                 print >>errfile, "Typeid: "+expLibrary.getElementsByTagName('typeid')[0].firstChild.data+"\n"
       
   285             if expLibrary.getElementsByTagName('funcpos').length > 0:
       
   286                 print >>errfile, "Function position: "+expLibrary.getElementsByTagName('funcpos')[0].firstChild.data+"\n"
       
   287             if expLibrary.getElementsByTagName('newfuncpos').length > 0:
       
   288                 print >>errfile, "New function position: "+expLibrary.getElementsByTagName('newfuncpos')[0].firstChild.data+"\n"
       
   289             if expLibrary.getElementsByTagName('funcname').length > 0:
       
   290                 print >>errfile, "Function name: "+expLibrary.getElementsByTagName('funcname')[0].firstChild.data+"\n"
       
   291             if expLibrary.getElementsByTagName('newfuncname').length > 0:
       
   292                 print >>errfile, "New function name: "+expLibrary.getElementsByTagName('newfuncname')[0].firstChild.data+"\n"
       
   293             if expLibrary.getElementsByTagName('bc_severity').length > 0:
       
   294                 print >>errfile, "BC Severity: "+expLibrary.getElementsByTagName('bc_severity')[0].firstChild.data+"\n"
       
   295             if expLibrary.getElementsByTagName('sc_severity').length > 0:
       
   296                 print >>errfile, "SC Severity: "+expLibrary.getElementsByTagName('sc_severity')[0].firstChild.data+"\n"
       
   297             print >>errfile, "--------------------------------------------\n"
       
   298     
       
   299     for actLibrary in actual.getElementsByTagName('library'):
       
   300         if actLibrary.getElementsByTagName('name')[0].firstChild != None:
       
   301             actLibraryFilename = actLibrary.getElementsByTagName('name')[0].firstChild.data
       
   302         else:
       
   303             actLibraryFilename = " "
       
   304         
       
   305         if actLibrary.getElementsByTagName('comparefilename')[0].firstChild != None:
       
   306             actLibraryCompareFilename = actLibrary.getElementsByTagName('comparefilename')[0].firstChild.data
       
   307         else:
       
   308             actLibraryCompareFilename = " "
       
   309         
       
   310         # Strip off the paths from the filenames:
       
   311         
       
   312         if actLibraryFilename != " ":
       
   313         	  tmpIndex = actLibraryFilename.lower().rindex(os.sep)  # index of last backslash.
       
   314         	  actFile = actLibraryFilename[ tmpIndex+1 : len(actLibraryFilename) ].lower()
       
   315         else:
       
   316             actFile = " "
       
   317         
       
   318         if actLibraryCompareFilename != " ":
       
   319         	 tmpIndex = actLibraryCompareFilename.lower().rindex(os.sep)  # index of last backslash.
       
   320         	 actCompareFile = actLibraryCompareFilename[ tmpIndex+1 : len(actLibraryCompareFilename) ].lower()
       
   321         else:
       
   322            actCompareFile = " "
       
   323         
       
   324         if debug == 1:
       
   325             print >>debfile, "********************************\n"
       
   326             print >>debfile, "ACT FILE: "+actFile+" -->\n"
       
   327 
       
   328         libfound = 0 
       
   329         for expLibrary in expected.getElementsByTagName('library'):
       
   330            if expLibrary.getElementsByTagName('name')[0].firstChild != None:
       
   331               expLibraryFilename = expLibrary.getElementsByTagName('name')[0].firstChild.data
       
   332            else:
       
   333               expLibraryFilename = " "
       
   334            
       
   335            if expLibrary.getElementsByTagName('comparefilename')[0].firstChild != None:
       
   336                expLibraryCompareFilename = expLibrary.getElementsByTagName('comparefilename')[0].firstChild.data
       
   337            else:
       
   338                expLibraryCompareFilename = " "
       
   339             
       
   340            # Strip off the paths from the filenames:
       
   341            if expLibraryFilename != " ":
       
   342                tmpIndex = expLibraryFilename.lower().rindex('\\') # index where the header name begins
       
   343                expFile = expLibraryFilename[ tmpIndex+1 : len(expLibraryFilename) ].lower()
       
   344            else:
       
   345                expFile = " "
       
   346        
       
   347            if expLibraryCompareFilename != " ":
       
   348                tmpIndex = expLibraryCompareFilename.lower().rindex('\\') # index of last backslash.
       
   349                expCompareFile = expLibraryCompareFilename[ tmpIndex+1 : len(expLibraryCompareFilename) ].lower()
       
   350            else:
       
   351                expCompareFile = " "
       
   352             
       
   353            if actFile == expFile and actCompareFile == expCompareFile:   
       
   354                if debug == 1:
       
   355                               print >>debfile, "Found.\n"
       
   356                    
       
   357                for iss2 in actLibrary.getElementsByTagName('issue'):
       
   358                    if CheckIssues(iss2, expLibrary.getElementsByTagName('issue')) == 0:
       
   359                        failed = 1
       
   360                        print >>errfile, "--------------------------------------------\n"
       
   361                        print >>errfile, "TESTCASE: "+tc+"\n\n"
       
   362                        print >>errfile, "Difference: Issue missing from expected results:\n"
       
   363                        print >>errfile, "Filename: "+expFile+"\n"
       
   364                        if iss2.getElementsByTagName('typeid').length > 0:
       
   365                            print >>errfile, "Typeid: "+iss2.getElementsByTagName('typeid')[0].firstChild.data+"\n"
       
   366                        if iss2.getElementsByTagName('funcpos').length > 0:
       
   367                            print >>errfile, "Function position: "+iss2.getElementsByTagName('funcpos')[0].firstChild.data+"\n"
       
   368                        if iss2.getElementsByTagName('newfuncpos').length > 0:
       
   369                            print >>errfile, "New function position: "+iss2.getElementsByTagName('newfuncpos')[0].firstChild.data+"\n"
       
   370                        if iss2.getElementsByTagName('funcname').length > 0:
       
   371                            print >>errfile, "Function name: "+iss2.getElementsByTagName('funcname')[0].firstChild.data+"\n"
       
   372                        if iss2.getElementsByTagName('newfuncname').length > 0:
       
   373                            print >>errfile, "New function name: "+iss2.getElementsByTagName('newfuncname')[0].firstChild.data+"\n"
       
   374                        if iss2.getElementsByTagName('bc_severity').length > 0:
       
   375                            print >>errfile, "BC Severity: "+iss2.getElementsByTagName('bc_severity')[0].firstChild.data+"\n"
       
   376                        if iss2.getElementsByTagName('sc_severity').length > 0:
       
   377                            print >>errfile, "SC Severity: "+iss2.getElementsByTagName('sc_severity')[0].firstChild.data+"\n"
       
   378                        print >>errfile, "--------------------------------------------\n"
       
   379                        
       
   380                libfound = 1
       
   381                break
       
   382             
       
   383         if libfound == 0:
       
   384             if debug == 1:
       
   385                 print >>debfile, "NOT FOUND.\n"
       
   386             
       
   387             failed = 1
       
   388             print >>errfile, "--------------------------------------------\n"
       
   389             print >>errfile, "TESTCASE: "+tc+"\n\n"
       
   390             print >>errfile, "Difference: Library results missing from expected results:\n"
       
   391             print >>errfile, "Filename: "+expFile+"\n"
       
   392             if actLibrary.getElementsByTagName('typeid').length > 0:
       
   393                 print >>errfile, "Typeid: "+actLibrary.getElementsByTagName('typeid')[0].firstChild.data+"\n"
       
   394             if actLibrary.getElementsByTagName('funcpos').length > 0:
       
   395                 print >>errfile, "Function position: "+actLibrary.getElementsByTagName('funcpos')[0].firstChild.data+"\n"
       
   396             if actLibrary.getElementsByTagName('newfuncpos').length > 0:
       
   397                 print >>errfile, "New function position: "+actLibrary.getElementsByTagName('newfuncpos')[0].firstChild.data+"\n"
       
   398             if actLibrary.getElementsByTagName('funcname').length > 0:
       
   399                 print >>errfile, "Function name: "+actLibrary.getElementsByTagName('funcname')[0].firstChild.data+"\n"
       
   400             if actLibrary.getElementsByTagName('newfuncname').length > 0:
       
   401                 print >>errfile, "New function name: "+actLibrary.getElementsByTagName('newfuncname')[0].firstChild.data+"\n"
       
   402             if actLibrary.getElementsByTagName('bc_severity').length > 0:
       
   403                 print >>errfile, "BC Severity: "+actLibrary.getElementsByTagName('bc_severity')[0].firstChild.data+"\n"
       
   404             if actLibrary.getElementsByTagName('sc_severity').length > 0:
       
   405                 print >>errfile, "SC Severity: "+actLibrary.getElementsByTagName('sc_severity')[0].firstChild.data+"\n"
       
   406             print >>errfile, "--------------------------------------------\n"
       
   407         
       
   408     if failed == 0:
       
   409         passedCount += 1
       
   410         ostr = ostr+"    <expresults>"+os.pardir+os.sep+expfilename+"</expresults>\n"
       
   411         ostr = ostr+"    <actresults>"+os.pardir+os.sep+actfilename+"</actresults>\n"
       
   412         ostr = ostr+"  </testcase>\n"
       
   413     else:
       
   414         ostr = ostr+"    <failure message=\"Failed\" type=\"Failed\">Failed</failure>\n"
       
   415         ostr = ostr+"    <expresults>"+os.pardir+os.sep+expfilename+"</expresults>\n"
       
   416         ostr = ostr+"    <actresults>"+os.pardir+os.sep+actfilename+"</actresults>\n"
       
   417         ostr = ostr+"  </testcase>\n"
       
   418 
       
   419 
       
   420 if len(sys.argv) == 1:
       
   421     Usage()
       
   422 if sys.argv[1] in usage:
       
   423     Usage()
       
   424 
       
   425 if sys.argv[1] == "-build":
       
   426     LABuild()
       
   427     
       
   428 ostr = ""
       
   429 if debug == 1:
       
   430     debfile = open("log/latestdebug.txt","w") # Debug information is printed to this file.
       
   431 
       
   432 passedCount = 0 
       
   433 totalCount = 0 
       
   434 time_taken = 0
       
   435 total_time_taken = 0
       
   436 
       
   437 outfile = open("results/"+ sys.argv[1],"w") # Test execution results are printed here.
       
   438 errfile = open("log/latestdiff.txt","w")  # Differences of not passed test cases are printed here.
       
   439 if len(sys.argv) == 2:
       
   440     RunAll()
       
   441 else:
       
   442     RunTC()
       
   443     
       
   444