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