forked from townforge/townforge
52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
#!/usr/bin/env python
|
|
|
|
from __future__ import print_function
|
|
import sys
|
|
import re
|
|
|
|
USAGE = 'usage: check_missing_functional_tests.py <rootdir>'
|
|
try:
|
|
rootdir = sys.argv[1]
|
|
except:
|
|
print(USAGE)
|
|
sys.exit(1)
|
|
|
|
sys.path.insert(0, rootdir + '/utils/python-rpc')
|
|
|
|
modules = [
|
|
{
|
|
'name': 'daemon',
|
|
'path': rootdir + '/utils/python-rpc/framework/daemon.py',
|
|
'ignore': []
|
|
},
|
|
{
|
|
'name': 'wallet',
|
|
'path': rootdir + '/utils/python-rpc/framework/wallet.py',
|
|
'ignore': []
|
|
}
|
|
]
|
|
|
|
functional_test_path = rootdir + '/tests/functional_tests/cc.py'
|
|
functional_test_lines = []
|
|
for line in open(functional_test_path).readlines():
|
|
functional_test_lines.append(line)
|
|
|
|
error = False
|
|
for module in modules:
|
|
for line in open(module['path']).readlines():
|
|
if 'def cc_' in line:
|
|
match = re.search('.*def (cc_.*)\(.*', line)
|
|
name = match.group(1)
|
|
if name in module['ignore']:
|
|
continue
|
|
pattern = name + "("
|
|
found = 0
|
|
for l in functional_test_lines:
|
|
if pattern in l:
|
|
found += 1
|
|
if found == 0:
|
|
print('Error: %s API method %s does not seem to be tested in %s' % (module['name'], name, functional_test_path))
|
|
error = True
|
|
|
|
sys.exit(1 if error else 0)
|