coverage compare tool
This commit is contained in:
parent
2e5b2022fd
commit
c56cb9079b
1 changed files with 37 additions and 0 deletions
37
gcovr-json-diff.py
Executable file
37
gcovr-json-diff.py
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
#! /usr/bin/python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
file_a = sys.argv[1]
|
||||||
|
json_a = json.load(open(file_a))
|
||||||
|
|
||||||
|
file_b = sys.argv[2]
|
||||||
|
json_b = json.load(open(file_b))
|
||||||
|
|
||||||
|
lines_a = dict()
|
||||||
|
|
||||||
|
for file_ in json_a['files']:
|
||||||
|
filename = file_['file']
|
||||||
|
|
||||||
|
covered_lines_a = [ x['line_number'] for x in file_['lines'] if x['count'] > 0]
|
||||||
|
|
||||||
|
lines_a[filename] = covered_lines_a
|
||||||
|
|
||||||
|
lines_b = dict()
|
||||||
|
|
||||||
|
for file_ in json_b['files']:
|
||||||
|
filename = file_['file']
|
||||||
|
|
||||||
|
covered_lines_b = [ x['line_number'] for x in file_['lines'] if x['count'] > 0]
|
||||||
|
|
||||||
|
lines_b[filename] = covered_lines_b
|
||||||
|
|
||||||
|
# see what has been covered in set b and not in a
|
||||||
|
for file_ in lines_b:
|
||||||
|
if file_ not in lines_a:
|
||||||
|
print(f'File {file_} only in set {file_b}')
|
||||||
|
|
||||||
|
for line in lines_b[file_]:
|
||||||
|
if not line in lines_a[file_]:
|
||||||
|
print(f'Line {line} in {file_} is only covered in {file_b}')
|
Loading…
Add table
Reference in a new issue