X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fcoverage.py;h=d44f81fdeeb8a7b0ba7328cf6e35c1b059506b7b;hb=36dcd0546206899ec74e3d756abc6fae7b17d3f6;hp=a06a943d14feb91c8e6c2eb0b263b9b345c0c4d9;hpb=91f01637f31c7d904fd8016b49184e935bf1c8ab;p=lilypond.git diff --git a/buildscripts/coverage.py b/buildscripts/coverage.py index a06a943d14..d44f81fdee 100644 --- a/buildscripts/coverage.py +++ b/buildscripts/coverage.py @@ -1,4 +1,5 @@ -#!/bin/sh +#!/usr/bin/python + import os import glob import re @@ -75,10 +76,17 @@ class Chunk: class SchemeChunk (Chunk): def uncovered_score (self): text = self.text () - if (text.startswith ('(define') + if (text.startswith ('(define ') and not text.startswith ('(define (')): return 0 + if text.startswith ('(use-modules '): + return 0 + + if (text.startswith ('(define-public ') + and not text.startswith ('(define-public (')): + return 0 + return len ([l for (c,n,l) in self.lines() if (c == 0)]) def read_gcov (f): @@ -140,7 +148,7 @@ def get_scm_chunks (ls, file): last_c = -1 for (cov_count, line_number, line) in ls: - if line.startswith ('(define'): + if line.startswith ('('): new_chunk () last_c = -1 @@ -224,7 +232,7 @@ def main (): if options.uncovered: chunks = filter_uncovered (chunks) - chunks = [(c.uncovered_score (), c) for c in chunks] + chunks = [(c.uncovered_score (), c) for c in chunks if c.uncovered_score() > 0] elif options.hotspots: chunks = [((c.coverage_count, -c.length()), c) for c in chunks]