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