More descriptive trace messages for the matchings of start and sub strings.

llvm-svn: 112000
This commit is contained in:
Johnny Chen 2010-08-24 23:48:10 +00:00
parent 3669c80de9
commit c7c9fcfbd6
1 changed files with 9 additions and 4 deletions

View File

@ -250,16 +250,21 @@ class TestBase(unittest2.TestCase):
output = self.res.GetOutput()
matched = output.startswith(startstr) if startstr else True
if not matched and startstr and trace:
print >> sys.stderr, "Startstr not matched:", startstr
if startstr and trace:
print >> sys.stderr, "Expecting start string:", startstr
print >> sys.stderr, "Matched" if matched else "Not matched"
print >> sys.stderr
if substrs:
for str in substrs:
matched = output.find(str) > 0
if trace:
print >> sys.stderr, "Expecting sub string:", str
print >> sys.stderr, "Matched" if matched else "Not matched"
if not matched:
if trace:
print >> sys.stderr, "Substring not matched:", str
break
if trace:
print >> sys.stderr
self.assertTrue(matched, msg if msg else CMD_MSG(cmd))