tools: Report OverflowErrors in url coverage report.

This commit is contained in:
Steve Howell
2016-08-18 08:10:15 -07:00
committed by Tim Abbott
parent 27c7319b50
commit 125dcad379

View File

@@ -233,8 +233,18 @@ def write_instrumentation_reports():
fn = os.path.join(var_dir, 'url_coverage.txt') fn = os.path.join(var_dir, 'url_coverage.txt')
with open(fn, 'w') as f: with open(fn, 'w') as f:
for call in calls: for call in calls:
try:
line = ujson.dumps(call) line = ujson.dumps(call)
f.write(line + '\n') f.write(line + '\n')
except OverflowError:
print('''
A JSON overflow error was encountered while
producing the URL coverage report. Sometimes
this indicates that a test is passing objects
into methods like client_post(), which is
unnecessary and leads to false positives.
''')
print(call)
print('URL coverage report is in %s' % (fn,)) print('URL coverage report is in %s' % (fn,))
print('Try running: ./tools/analyze-url-coverage') print('Try running: ./tools/analyze-url-coverage')