extracttests.py: allow that only TP tests are extracted

This commit is contained in:
Daniel Marjamäki 2017-09-22 23:23:36 +02:00
parent 233a6d2fc6
commit b1a4860a0c
1 changed files with 7 additions and 1 deletions

View File

@ -165,7 +165,7 @@ def writeHtmlFile(nodes, functionName, filename, errorsOnly):
if len(sys.argv) <= 1 or '--help' in sys.argv: if len(sys.argv) <= 1 or '--help' in sys.argv:
print('Extract test cases from test file') print('Extract test cases from test file')
print( print(
'Syntax: extracttests.py [--html=folder] [--xml] [--code=folder] path/testfile.cpp') 'Syntax: extracttests.py [--html=folder] [--xml] [--code=folder] [--onlyTP] path/testfile.cpp')
sys.exit(0) sys.exit(0)
# parse command line # parse command line
@ -173,9 +173,12 @@ xml = False
filename = None filename = None
htmldir = None htmldir = None
codedir = None codedir = None
onlyTP = None
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
if arg == '--xml': if arg == '--xml':
xml = True xml = True
elif arg == '--onlyTP':
onlyTP = True
elif arg.startswith('--html='): elif arg.startswith('--html='):
htmldir = arg[7:] htmldir = arg[7:]
elif arg.startswith('--code='): elif arg.startswith('--code='):
@ -284,6 +287,9 @@ if filename is not None:
errors = open(codedir + 'errors.txt', 'w') errors = open(codedir + 'errors.txt', 'w')
for node in e.nodes: for node in e.nodes:
if onlyTP and node['expected'] == '':
continue
testnum = testnum + 1 testnum = testnum + 1
functionName = node['functionName'] functionName = node['functionName']