3
# This script removes branch and/or line coverage data for lines that
4
# contain a particular substring.
6
# In the interest of "fairness" it removes all branch or coverage data
7
# when a match is found -- not just negative data. It is therefore
8
# likely that running this script will actually reduce the total number
9
# of lines and branches that are marked as covered (in absolute terms).
11
# This script intentionally avoids checking for errors. Any exceptions
12
# will trigger make to fail.
14
# Author: Ryan Lortie <desrt@desrt.ca>
18
line_suppress = ['g_assert_not_reached']
19
branch_suppress = ['g_assert', 'g_return_if_fail', 'g_clear_object', 'g_clear_pointer', 'g_return_val_if_fail', 'G_DEFINE_TYPE']
21
def check_suppress(suppressions, source, data):
22
line, _, rest = data.partition(',')
25
assert line < len(source)
27
for suppression in suppressions:
28
if suppression in source[line]:
34
for line in sys.stdin:
37
keyword, _, rest = line.partition(':')
41
source = file(rest).readlines()
43
# Branch coverage data
44
elif keyword == 'BRDA':
45
if check_suppress(branch_suppress, source, rest):
50
if check_suppress(line_suppress, source, rest):