Skip to content

Commit

Permalink
updating the test script to work with python 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaramaarao committed Aug 31, 2020
1 parent 75ab6d0 commit 06a6093
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/tools/check_compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"""

import re
import sys
import argparse
from collections import namedtuple
from os.path import basename
Expand Down Expand Up @@ -101,7 +102,8 @@ def getLogErrors(log):
elif terminatedError.search(line):
terminated = True
else:
print line,
sys.stdout.write (line)
sys.stdout.write (" ")
return terminated, errorList

def getFileSet(source, logErrors):
Expand Down Expand Up @@ -166,14 +168,14 @@ def checkErrorsMatch(terminated, logErrors, sourceErrors, compiler):
for e in logErrors:
if not removeMatch(e, sourceErrors, compiler):
fail = True
print "Unexpected:", e.sev, e.file, e.lineno, e.text
print ("Unexpected:", e.sev, e.file, e.lineno, e.text)
for e in sourceErrors:
fail = True
print "Missed:", e.sev, e.file, e.lineno, e.text
print ("Missed:", e.sev, e.file, e.lineno, e.text)
if fail or terminated:
print "FAIL"
print ("FAIL")
else:
print "PASS"
print ("PASS")

def removeMatch(e, errors, compiler):
"""
Expand Down Expand Up @@ -204,12 +206,12 @@ def dumpErrorSet(errors, title):
:param title: optional title
"""
if title:
print title
print (title)
if len(errors) == 0:
print " (none)"
print (" (none)")
else:
for e in errors:
print " ", e.sev, e.file, e.lineno, e.prefix if e.prefix != None else "", e.text if e.text != None else ""
print (" ", e.sev, e.file, e.lineno, e.prefix) if e.prefix != None else "", e.text if e.text != None else ""


if __name__=="__main__":
Expand Down

0 comments on commit 06a6093

Please sign in to comment.