Commit a742e9d5 authored by Daniel Smith's avatar Daniel Smith

Initial commit

Pipeline #1341 canceled with stages
import os
import argparse
import re
failedTests = {} # Typing.dict()
totalCount = 0
def findFailedTests(logfile: str):
global totalCount
pattern = re.compile(r'[0-9]{1,}(?<!0) failed')
with open(logfile) as log:
logtext =
with open("{0}_failures.txt".format(logfile[:-4]), mode='w+') as outfile:
for match in pattern.finditer(logtext):
tstnameindex = 0
tstnameindex = logtext.rfind("********* Start testing of ", 0, match.span()[0]) + 27
tstname = logtext[tstnameindex:
logtext.find("*********", tstnameindex)-1]
print("{0}: {1}".format(tstname, # Print the test name and count failed.
outfile.writelines("{0}: {1}\r\n".format(tstname,
if int(re.match(r'[0-9]{0,}', > 9:
outfile.writelines("Too many fail cases. Not printing the failures here. See the original log for failure details.")
print("Too many fail cases. Not printing the failures here. See the original log for failure details.")
logsnip = logtext[tstnameindex : logtext.find("********* Finished testing of ", tstnameindex)]
for failcasematch in re.finditer('FAIL! : ', logsnip):
failcasestring = logsnip[failcasematch.span()[0] : logsnip.find('\n', logsnip.find("Loc: ", failcasematch.span()[0]))]
totalCount += 1
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--logdir',dest='logDir', type=str,
required=True, help='The full path to a directory of logs')
args = parser.parse_args()
logfiles = os.listdir(args.logDir)
for logfile in logfiles:
findFailedTests(os.path.join(args.logDir, logfile))
print("total failed test applications: {0}".format(totalCount))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment