From: Brian Warner Date: Wed, 4 Aug 2010 07:11:31 +0000 (-0700) Subject: coverage tools: ignore errors, display lines-uncovered in elisp mode. Fix Makefile... X-Git-Tag: allmydata-tahoe-1.8.0b2~25 X-Git-Url: https://git.rkrishnan.org/quickstart.html?a=commitdiff_plain;h=818089644adffef2a4ad12afa1f1ff11f475a585;p=tahoe-lafs%2Ftahoe-lafs.git coverage tools: ignore errors, display lines-uncovered in elisp mode. Fix Makefile paths. --- diff --git a/Makefile b/Makefile index 42753b0b..723d656d 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,7 @@ quicktest: # quicktest-coverage" to do a unit test run with coverage-gathering enabled, # then use "make coverate-output-text" for a brief report, or "make # coverage-output" for a pretty HTML report. Also see "make .coverage.el" and -# misc/coding_helpers/coverage.el for emacs integration. +# misc/coding_tools/coverage.el for emacs integration. quicktest-coverage: rm -f .coverage @@ -134,7 +134,7 @@ quicktest-coverage: coverage-output: rm -rf coverage-html - coverage html -d coverage-html + coverage html -i -d coverage-html $(COVERAGE_OMIT) cp .coverage coverage-html/coverage.data @echo "now point your browser at coverage-html/index.html" @@ -154,7 +154,7 @@ coverage-output: .PHONY: repl test-darcs-boringfile test-clean clean find-trailing-spaces .coverage.el: .coverage - $(PYTHON) misc/coding_helpers/coverage2el.py + $(PYTHON) misc/coding_tools/coverage2el.py # 'upload-coverage' is meant to be run with an UPLOAD_TARGET=host:/dir setting ifdef UPLOAD_TARGET diff --git a/misc/coding_tools/coverage.el b/misc/coding_tools/coverage.el index bad490fd..8d69d5d7 100644 --- a/misc/coding_tools/coverage.el +++ b/misc/coding_tools/coverage.el @@ -84,7 +84,8 @@ 'face '(:box "red") ) ) - (message "Added annotations") + (message (format "Added annotations: %d uncovered lines" + (safe-length uncovered-code-lines))) ) ) (message "unable to find coverage for this file")) diff --git a/misc/coding_tools/coverage2el.py b/misc/coding_tools/coverage2el.py index ed94bd0f..7d03a273 100644 --- a/misc/coding_tools/coverage2el.py +++ b/misc/coding_tools/coverage2el.py @@ -1,5 +1,5 @@ -from coverage import coverage, summary +from coverage import coverage, summary, misc class ElispReporter(summary.SummaryReporter): def report(self): @@ -21,7 +21,10 @@ class ElispReporter(summary.SummaryReporter): out.write("(let ((results (make-hash-table :test 'equal)))\n") for cu in self.code_units: f = cu.filename - (fn, executable, missing, mf) = self.coverage.analysis(cu) + try: + (fn, executable, missing, mf) = self.coverage.analysis(cu) + except misc.NoSource: + continue code_linenumbers = executable uncovered_code = missing covered_linenumbers = sorted(set(executable) - set(missing))