diff options
author | Stef Walter <stefw@gnome.org> | 2012-11-26 10:32:57 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2012-11-29 14:28:15 +0100 |
commit | f5eb0c766d6d529b2d6b8c8984bc0f953f9b6770 (patch) | |
tree | 612c03b92bd0f9135e85de627c9abba3cf1bd711 | |
parent | e7c196831519330a98b02455b6f86f2e322927f8 (diff) |
Provide intelligent warnings for missing/invalid .gcno files
No gcno file indicates that the the source was not built with
code coverage. If the gcno file exists but predates the source
file, then probably not rebuilt since last change.
-rwxr-xr-x | git-coverage | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/git-coverage b/git-coverage index f9c22f1..102b6ca 100755 --- a/git-coverage +++ b/git-coverage @@ -34,6 +34,9 @@ def match_any_re(regexps, line): return True return False +def warning(string): + print >> sys.stderr, string + # ---------------------------------------------------------------------------- # PATCH PARSING # @@ -248,9 +251,20 @@ class GccCoverage: match = "%s/*%s.gcno" % (directory, base) else: match = "*%s.gcno" % (base, ) + bad_mtime = False + mtime = os.path.getmtime(filename) for gcno in self._gcno_cache: if fnmatch.fnmatch(gcno, match): - matches.append(gcno) + if os.path.getctime(gcno) < mtime: + bad_mtime = True + else: + matches.append(gcno) + + if not matches: + if bad_mtime: + warning("%s: Found old coverage data, likely not built" % filename) + else: + warning("%s: Found no coverage data" % filename) return matches def _find_directory_gcno_compiled_in(self, gcno, filename): |