From: Han-Wen Nienhuys Date: Sun, 21 Jan 2007 14:28:32 +0000 (+0100) Subject: parse SCM cov files separately X-Git-Tag: release/2.11.13-1~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5441f3f6ae9fc12f957db7c3a7aa226966534495;p=lilypond.git parse SCM cov files separately --- diff --git a/buildscripts/coverage.py b/buildscripts/coverage.py index 380e9e3075..a3b68dd58d 100644 --- a/buildscripts/coverage.py +++ b/buildscripts/coverage.py @@ -96,7 +96,7 @@ def read_gcov (f): return ls -def get_chunks (ls, file): +def get_c_chunks (ls, file): chunks = [] chunk = [] @@ -115,6 +115,35 @@ def get_chunks (ls, file): return chunks +def get_scm_chunks (ls, file): + chunks = [] + chunk = [] + + def new_chunk (): + nums = [n-1 for (n, l) in chunk] + chunks.append (Chunk ((min (nums), max (nums)+1), + last_c, ls, file)) + chunk = [] + + last_c = -1 + for (c, n, l) in ls: + + if l.startswith ('(define'): + new_chunk () + last_c = + continue + + if not (c == last_c or c < 0): + + + if chunk and last_c >= 0: + + chunk.append ((n,l)) + if c >= 0: + last_c = c + + return chunks + def widen_chunk (ch, ls): a -= 1 b += 1 @@ -129,7 +158,13 @@ def extract_chunks (file): print s return [] - return get_chunks (ls, file) + cs = [] + if 'scm' in file: + cs = get_scm_chunks (ls, file) + else: + cs = get_c_chunks (ls, file) + return cs + def filter_uncovered (chunks): def interesting (c): @@ -173,7 +208,13 @@ def main (): if options.uncovered or options.hotspots: chunks = [] for a in args: - chunks += extract_chunks ('%s.gcov' % a) + name = a + if name.endswith ('scm'): + name += '.cov' + else: + name += '.gcov' + + chunks += extract_chunks (name) if options.uncovered: chunks = filter_uncovered (chunks)