From 75dfb90312313a05d40da464e42a847f9565e874 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 3 Jan 2007 21:10:15 +0100 Subject: [PATCH] coverage.py improvements. --- buildscripts/coverage.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/buildscripts/coverage.py b/buildscripts/coverage.py index f4397e10e0..415c7100ff 100644 --- a/buildscripts/coverage.py +++ b/buildscripts/coverage.py @@ -79,9 +79,28 @@ def is_exception_chunk (ch): return True return False +def widen_chunk (ch, ls): + nums = [n-1 for (n, l) in ch] + (a, b) = (min (nums), max (nums)+1) + a -= 1 + b += 1 + + return [(n, l) for (c, n, l) in ls[a:b]] + + +def is_inspection_chunk (ch): + for (n,l) in ch: + for stat in ('::print',): + if stat in l: + return True + return False + def print_chunk (ch, lines): nums = [n-1 for (n, l) in ch] - for (c, n, l) in lines[min (nums):max (nums)+1]: + (a, b) = (min (nums), max (nums)+1) + a -= 1 + b += 1 + for (c, n, l) in lines[a:b]: sys.stdout.write ('%8s:%8d:%s' % (c,n,l)) @@ -93,8 +112,9 @@ def extract_uncovered (file): return cs = get_chunks (ls) + cs = [widen_chunk(c, ls) for c in cs] cs = [c for c in cs if not is_exception_chunk (c)] - print '\n'.join (['%d' % x for (a,x,b) in ls]) + cs = [c for c in cs if not is_inspection_chunk (c)] for c in cs: print 'Uncovered chunk in', file print_chunk (c, ls) -- 2.39.5