adapt to python3
This commit is contained in:
parent
649d4cab66
commit
263f7a280a
|
@ -9,7 +9,7 @@ import os
|
||||||
|
|
||||||
|
|
||||||
def Usage(s):
|
def Usage(s):
|
||||||
print 'Usage: {} -t <cstest_path> [-f <file_name.cs>] [-d <directory>]'.format(s)
|
print('Usage: {} -t <cstest_path> [-f <file_name.cs>] [-d <directory>]'.format(s))
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
def get_report_file(toolpath, filepath, getDetails, cmt_out):
|
def get_report_file(toolpath, filepath, getDetails, cmt_out):
|
||||||
|
@ -19,8 +19,8 @@ def get_report_file(toolpath, filepath, getDetails, cmt_out):
|
||||||
|
|
||||||
# stdout
|
# stdout
|
||||||
failed_tests = []
|
failed_tests = []
|
||||||
# print '---> stdout\n', stdout
|
# print('---> stdout\n', stdout)
|
||||||
# print '---> stderr\n', stderr
|
# print('---> stderr\n', stderr)
|
||||||
matches = re.finditer(r'\[\s+RUN\s+\]\s+(.*)\n\[\s+FAILED\s+\]', stdout)
|
matches = re.finditer(r'\[\s+RUN\s+\]\s+(.*)\n\[\s+FAILED\s+\]', stdout)
|
||||||
for match in matches:
|
for match in matches:
|
||||||
failed_tests.append(match.group(1))
|
failed_tests.append(match.group(1))
|
||||||
|
@ -41,12 +41,12 @@ def get_report_file(toolpath, filepath, getDetails, cmt_out):
|
||||||
counter += 1
|
counter += 1
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
print '\n[-] There are/is {} failed test(s)'.format(len(details))
|
print('\n[-] There are/is {} failed test(s)'.format(len(details)))
|
||||||
if len(details) > 0 and getDetails:
|
if len(details) > 0 and getDetails:
|
||||||
print '[-] Detailed report for {}:\n'.format(filepath)
|
print('[-] Detailed report for {}:\n'.format(filepath))
|
||||||
for c, f, d in details:
|
for c, f, d in details:
|
||||||
print '\t[+] {}: {}\n\t\t{}\n'.format(f, c, d)
|
print('\t[+] {}: {}\n\t\t{}\n'.format(f, c, d))
|
||||||
print '\n'
|
print('\n')
|
||||||
return 0
|
return 0
|
||||||
elif len(details) > 0:
|
elif len(details) > 0:
|
||||||
for c, f, d in details:
|
for c, f, d in details:
|
||||||
|
@ -67,7 +67,7 @@ def get_report_folder(toolpath, folderpath, details, cmt_out):
|
||||||
path = root.split(os.sep)
|
path = root.split(os.sep)
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.split('.')[-1] == 'cs':
|
if f.split('.')[-1] == 'cs':
|
||||||
print '[-] Target:', f,
|
print('[-] Target:', f,)
|
||||||
result *= get_report_file(toolpath, os.sep.join(x for x in path) + os.sep + f, details, cmt_out)
|
result *= get_report_file(toolpath, os.sep.join(x for x in path) + os.sep + f, details, cmt_out)
|
||||||
|
|
||||||
sys.exit(result ^ 1)
|
sys.exit(result ^ 1)
|
||||||
|
|
Loading…
Reference in New Issue