apicompatanamdw/compatanalysercmd/headeranalyser/tsrc/hatest.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 HABuild():
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 + "hatestbuild.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('^HATC')
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 + "hatestrun.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 + "hatestrun.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
        if issue1.getElementsByTagName('cause')[0].firstChild != None:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   100
            print >>debfile, "ISSUE: "+ issue1.getElementsByTagName('cause')[0].firstChild.data +" --> "
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   101
        else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   102
            print >>debfile, "ISSUE:  --> "
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   103
        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   104
    for issue2 in issueArr:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   105
        if  issue1.getElementsByTagName('typestring')[0].firstChild.data == issue2.getElementsByTagName('typestring')[0].firstChild.data and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   106
            (( issue1.getElementsByTagName('cause')[0].firstChild == None and issue2.getElementsByTagName('cause')[0].firstChild == None ) or \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   107
            (issue1.getElementsByTagName('cause')[0].firstChild != None and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   108
            issue1.getElementsByTagName('cause')[0].firstChild.data == issue2.getElementsByTagName('cause')[0].firstChild.data )) and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   109
            issue1.getElementsByTagName('identitydescription')[0].firstChild.data == issue2.getElementsByTagName('identitydescription')[0].firstChild.data and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   110
            issue1.getElementsByTagName('severity')[0].getElementsByTagName('typestring')[0].firstChild.data == issue2.getElementsByTagName('severity')[0].getElementsByTagName('typestring')[0].firstChild.data and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   111
            issue1.getElementsByTagName('severity')[0].getElementsByTagName('typeid')[0].firstChild.data == issue2.getElementsByTagName('severity')[0].getElementsByTagName('typeid')[0].firstChild.data and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   112
            issue1.getElementsByTagName('scseverity')[0].getElementsByTagName('typestring')[0].firstChild.data == issue2.getElementsByTagName('scseverity')[0].getElementsByTagName('typestring')[0].firstChild.data and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   113
            issue1.getElementsByTagName('scseverity')[0].getElementsByTagName('typeid')[0].firstChild.data == issue2.getElementsByTagName('scseverity')[0].getElementsByTagName('typeid')[0].firstChild.data and \
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   114
            issue1.getElementsByTagName('linenumber')[0].firstChild.data == issue2.getElementsByTagName('linenumber')[0].firstChild.data :
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   115
               if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   116
                   print >>debfile, "Found.\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   117
               issuefound = 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   118
               break				
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   119
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   120
    if issuefound == 0:        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   121
        if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   122
            print >>debfile, "NOT FOUND.\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   123
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   124
    return issuefound 
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   125
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   126
def WriteXml():
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   127
    global totalCount, passedCount, timeval, outfile, errfile, debug, debfile, time_taken, total_time_taken
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   128
    timeval = time.strftime("%a %b %d, %Y at %H:%M:%S", time.localtime())
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   129
    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   130
    if totalCount > 0:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   131
        passedPercent = "%.2f" % (passedCount/totalCount)*100
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   132
    else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   133
        passedPercent = "0"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   134
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   135
    failedcount = totalCount - passedCount
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   136
    ohdr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   137
    ohdr = ohdr + "<?xml-stylesheet type=\"text/xsl\" href=\"hatestresults.xsl\"?>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   138
    ohdr = ohdr+"<testsuite errors=\"0\" failures=\""+str(failedcount)+"\" hostname=\""+platform.node()+"\" name=\"HeaderAnalyser\" tests=\""+str(totalCount)+"\" time=\""+str(round(total_time_taken,3))+"\" timestamp=\""+str(timeval)+"\">\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   139
    ohdr = ohdr+"<properties>\n</properties>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   140
    ohdr = ohdr+ostr+"</testsuite>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   141
    print >>outfile, ohdr
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   142
    outfile.close()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   143
    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   144
    if passedCount == totalCount:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   145
        print >>errfile, "No differencies.\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   146
    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   147
    errfile.close()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   148
    if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   149
        debfile.close()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   150
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   151
def CompareResult(tc):              
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   152
    global ostr, totalCount, passedCount, debug, debfile, errfile
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   153
    if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   154
        print >>debfile, "\n-----------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   155
        print >>debfile, "Testcase "+tc+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   156
        print >>debfile, "-----------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   157
    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   158
    # Read expected results (xml report):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   159
    expfilename = "TC"+os.sep+tc+os.sep+"results"+os.sep+tc+"_expected_results.xml"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   160
    if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   161
        print >>debfile, "Reading expected results from file: "+expfilename+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   162
        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   163
    expected = minidom.parse(expfilename)
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   164
                            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   165
    # Read actual results (xml report):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   166
    actfilename = "TC"+os.sep+tc+os.sep+"results"+os.sep+tc+"_results.xml"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   167
    if not os.path.exists(actfilename):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   168
        print "os.path.exists(actfilename)"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   169
        failed = 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   170
        print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   171
        print >>errfile, "TESTCASE: "+tc+"\n\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   172
        print >>errfile, "Difference: Actual results file missing:\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   173
        print >>errfile, "Filename: "+actfilename+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   174
        print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   175
        ostr = ostr+"  <testcase classname=\"HeaderAnalyser\" name=\""+tc+"\" time=\""+str(round(time_taken,3))+"\"\">\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   176
        ostr = ostr+"    <failure message=\"Failed\" type=\"Failed\">Failed</failure>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   177
        ostr = ostr+"    <expresults>"+os.pardir+os.sep+expfilename+"</expresults>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   178
        ostr = ostr+"    <actresults>"+os.pardir+os.sep+actfilename+"</actresults>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   179
        ostr = ostr+"  </testcase>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   180
        totalCount += 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   181
        return
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   182
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   183
    if debug == 1 :
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   184
        print >>debfile, "Reading actual results from file: "+actfilename+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   185
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   186
    actual = minidom.parse(actfilename)               
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   187
    ostr = ostr + "  <testcase classname=\"HeaderAnalyser\" name=\""+tc+"\" time=\""+str(round(time_taken,3))+"\">\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   188
       
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   189
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   190
    totalCount += 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   191
    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   192
    failed = 0 
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   193
    headerfound = 0 
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   194
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   195
    for expHeader in expected.getElementsByTagName('headerfile'):   
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   196
        headerfound = 0 
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   197
        expHeaderFilename = expHeader.getElementsByTagName('filename')[0].firstChild.data
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   198
        expHeaderCompareFilename = expHeader.getElementsByTagName('comparefilename')[0].firstChild.data
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
        tmpIndex = expHeaderFilename.lower().rindex('\\') # index where the header name begins
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   203
        expFile = expHeaderFilename[ tmpIndex+1 : len(expHeaderFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   204
       
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   205
       
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   206
        tmpIndex = expHeaderCompareFilename.lower().rindex('\\') # index of last backslash.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   207
        expCompareFile = expHeaderCompareFilename[ tmpIndex+1 : len(expHeaderCompareFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   208
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   209
        if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   210
            print >>debfile, "********************************\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   211
            print >>debfile, "EXP FILE: "+expFile+" -->\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   212
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   213
        for actHeader in actual.getElementsByTagName('headerfile'):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   214
            actHeaderFilename = actHeader.getElementsByTagName('filename')[0].firstChild.data
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   215
            actHeaderCompareFilename = actHeader.getElementsByTagName('comparefilename')[0].firstChild.data
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   216
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   217
            # Strip off the paths from the filenames:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   218
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   219
            tmpIndex = actHeaderFilename.lower().rindex(os.sep)  # index of last backslash.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   220
            actFile = actHeaderFilename[ tmpIndex+1 : len(actHeaderFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   221
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   222
            tmpIndex = actHeaderCompareFilename.lower().rindex(os.sep)  # index of last backslash.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   223
            actCompareFile = actHeaderCompareFilename[ tmpIndex+1 : len(actHeaderCompareFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   224
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   225
            if expFile == actFile and expCompareFile == actCompareFile:   
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   226
                if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   227
                    print >>debfile, "Found.\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   228
                    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   229
                for iss1 in expHeader.getElementsByTagName('issue'):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   230
                    if CheckIssues(iss1, actHeader.getElementsByTagName('issue')) == 0:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   231
                        failed = 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   232
                        print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   233
                        print >>errfile, "TESTCASE: "+tc+"\n\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   234
                        print >>errfile, "Difference: Issue missing from actual results:\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   235
                        print >>errfile, "Filename: "+expFile+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   236
                        if iss1.getElementsByTagName('cause')[0].firstChild != None:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   237
                            print >>errfile, "Issue: "+iss1.getElementsByTagName('cause')[0].firstChild.data+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   238
                        else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   239
                            print >>errfile, "Issue: \n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   240
                        print >>errfile, "Description: "+iss1.getElementsByTagName('identitydescription')[0].firstChild.data +" "+ iss1.getElementsByTagName('typestring')[0].firstChild.data+" \n"                     
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   241
                        print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   242
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   243
                headerfound = 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   244
                break
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   245
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   246
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   247
        if headerfound == 0:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   248
            if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   249
                print >>debfile, "NOT FOUND.\n"
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: Header results 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 iss1.getElementsByTagName('cause')[0].firstChild != None:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   256
                print >>errfile, "Issue: "+iss1.getElementsByTagName('cause')[0].firstChild.data+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   257
            else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   258
                print >>errfile, "Issue: \n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   259
            print >>errfile, "Description: "+iss1.getElementsByTagName('identitydescription')[0].firstChild.data +" "+ iss1.getElementsByTagName('typestring')[0].firstChild.data+" \n"                     
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   260
            print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   261
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   262
    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   263
    for actHeader in actual.getElementsByTagName('headerfile'):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   264
        actHeaderFilename = actHeader.getElementsByTagName('filename')[0].firstChild.data
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   265
        actHeaderCompareFilename = actHeader.getElementsByTagName('comparefilename')[0].firstChild.data
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   266
        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   267
        # Strip off the paths from the filenames:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   268
        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   269
        tmpIndex = actHeaderFilename.lower().rindex(os.sep)  # index of last backslash.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   270
        actFile = actHeaderFilename[ tmpIndex+1 : len(actHeaderFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   271
        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   272
        tmpIndex = actHeaderCompareFilename.lower().rindex(os.sep)  # index of last backslash.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   273
        actCompareFile = actHeaderCompareFilename[ tmpIndex+1 : len(actHeaderCompareFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   274
        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   275
        if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   276
            print >>debfile, "********************************\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   277
            print >>debfile, "ACT FILE: "+actFile+" -->\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   278
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   279
        headerfound = 0 
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   280
        for expHeader in expected.getElementsByTagName('headerfile'):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   281
           expHeaderFilename = expHeader.getElementsByTagName('filename')[0].firstChild.data
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   282
           expHeaderCompareFilename = expHeader.getElementsByTagName('comparefilename')[0].firstChild.data
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   283
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   284
           # Strip off the paths from the filenames:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   285
           tmpIndex = expHeaderFilename.lower().rindex('\\') # index where the header name begins
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   286
           expFile = expHeaderFilename[ tmpIndex+1 : len(expHeaderFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   287
       
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   288
           tmpIndex = expHeaderCompareFilename.lower().rindex('\\') # index of last backslash.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   289
           expCompareFile = expHeaderCompareFilename[ tmpIndex+1 : len(expHeaderCompareFilename) ].lower()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   290
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   291
           if actFile == expFile and actCompareFile == expCompareFile:   
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   292
               if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   293
                   print >>debfile, "Found.\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   294
                   
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   295
               for iss2 in actHeader.getElementsByTagName('issue'):
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   296
                   if CheckIssues(iss2, expHeader.getElementsByTagName('issue')) == 0:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   297
                       failed = 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   298
                       print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   299
                       print >>errfile, "TESTCASE: "+tc+"\n\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   300
                       print >>errfile, "Difference: Issue missing from expected results:\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   301
                       print >>errfile, "Filename: "+actFile+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   302
                       if iss1.getElementsByTagName('cause')[0].firstChild != None:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   303
                           print >>errfile, "Issue: "+iss1.getElementsByTagName('cause')[0].firstChild.data+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   304
                       else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   305
                           print >>errfile, "Issue: \n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   306
                       print >>errfile, "Description: "+iss1.getElementsByTagName('identitydescription')[0].firstChild.data +" "+ iss1.getElementsByTagName('typestring')[0].firstChild.data+" \n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   307
                       print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   308
                       
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   309
               headerfound = 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   310
               break
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   311
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   312
        if headerfound == 0:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   313
            if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   314
                print >>debfile, "NOT FOUND.\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   315
            
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   316
            failed = 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   317
            print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   318
            print >>errfile, "TESTCASE: "+tc+"\n\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   319
            print >>errfile, "Difference: Header results missing from expected results:\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   320
            print >>errfile, "Filename: "+actFile+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   321
            if iss1.getElementsByTagName('cause')[0].firstChild != None:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   322
                print >>errfile, "Issue: "+iss1.getElementsByTagName('cause')[0].firstChild.data+"\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   323
            else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   324
                print >>errfile, "Issue: \n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   325
            print >>errfile, "Description: "+iss1.getElementsByTagName('identitydescription')[0].firstChild.data +" "+ iss1.getElementsByTagName('typestring')[0].firstChild.data+" \n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   326
            print >>errfile, "--------------------------------------------\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   327
        
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   328
    if failed == 0:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   329
        passedCount += 1
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   330
        ostr = ostr+"    <expresults>"+os.pardir+os.sep+expfilename+"</expresults>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   331
        ostr = ostr+"    <actresults>"+os.pardir+os.sep+actfilename+"</actresults>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   332
        ostr = ostr+"  </testcase>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   333
    else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   334
        ostr = ostr+"    <failure message=\"Failed\" type=\"Failed\">Failed</failure>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   335
        ostr = ostr+"    <expresults>"+os.pardir+os.sep+expfilename+"</expresults>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   336
        ostr = ostr+"    <actresults>"+os.pardir+os.sep+actfilename+"</actresults>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   337
        ostr = ostr+"  </testcase>\n"
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   338
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   339
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   340
if len(sys.argv) == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   341
    Usage()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   342
if sys.argv[1] in usage:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   343
    Usage()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   344
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   345
if sys.argv[1] == "-build":
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   346
    HABuild()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   347
    
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   348
ostr = ""
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   349
if debug == 1:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   350
    debfile = open("log/hatestdebug.txt","w") # Debug information is printed to this file.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   351
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   352
passedCount = 0 
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   353
totalCount = 0 
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   354
time_taken = 0
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   355
total_time_taken = 0
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   356
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   357
outfile = open("results/"+ sys.argv[1],"w") # Test execution results are printed here.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   358
errfile = open("log/hatestdiff.txt","w")  # Differences of not passed test cases are printed here.
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   359
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   360
if len(sys.argv) == 2:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   361
    RunAll()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   362
else:
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   363
    RunTC()
a0eee409ff14 Updates to CompatibilityAnalyser
shrivatsa
parents:
diff changeset
   364