summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhuth <derickhuth@gmail.com>2014-11-07 14:32:10 -0700
committerdhuth <derickhuth@gmail.com>2014-11-07 14:32:10 -0700
commit5db772d7ba5c5a6cab3b9f9da0bd4eb42cc331b7 (patch)
treedd31e6b2b28f921922cf937691f7e6db38c8d84d
parent4d2a15ca46c935cfcde952092cc3e4642f86b2a7 (diff)
downloadchill-5db772d7ba5c5a6cab3b9f9da0bd4eb42cc331b7.tar.gz
chill-5db772d7ba5c5a6cab3b9f9da0bd4eb42cc331b7.tar.bz2
chill-5db772d7ba5c5a6cab3b9f9da0bd4eb42cc331b7.zip
Coverage
-rw-r--r--test-chill/testchill/__main__.py2
-rw-r--r--test-chill/testchill/gcov.py39
2 files changed, 12 insertions, 29 deletions
diff --git a/test-chill/testchill/__main__.py b/test-chill/testchill/__main__.py
index bd68e16..3e03e11 100644
--- a/test-chill/testchill/__main__.py
+++ b/test-chill/testchill/__main__.py
@@ -317,7 +317,7 @@ def add_global_args(arg_parser):
arg_parser.add_argument('-w', '--working-dir', dest='wd', default=os.getcwd(), help='The working directory. (Defaults to the current directory)', metavar='working-directory')
arg_parser.add_argument('-R', '--rose-home', dest='rose_dir', default=os.getenv('ROSEHOME'), help='Rose home directory. (Defaults to ROSEHOME)', metavar='rose-home')
arg_parser.add_argument('-C', '--chill-home', dest='chill_dir', default=os.getenv('CHILLHOME'), help='Chill home directory. (Defaults to CHILLHOME)', metavar='chill-home')
- arg_parser.add_argument('-O', '--omega-home', dest='omega_dir', default=os.getenv('OMEGAHOME'), help='Omega home directory. (Defaults to OMEGAHOME)', metavar='omega-home')
+ arg_parser.add_argument('-O', '--omega-home', dest='omega_dir', default=os.joinpath(os.getcwd(), '../omega'), help='Omega home directory. (Defaults to ../omega)', metavar='omega-home')
arg_parser.add_argument('-b', '--binary-dir', dest='bin_dir', default=None, help='Binary directory.', metavar='bin-dir')
@util.callonce
diff --git a/test-chill/testchill/gcov.py b/test-chill/testchill/gcov.py
index c989151..668c00e 100644
--- a/test-chill/testchill/gcov.py
+++ b/test-chill/testchill/gcov.py
@@ -3,7 +3,6 @@ import functools
import itertools
import os
import os.path
-import pickle
import sys
from . import util
@@ -187,13 +186,13 @@ class GcovSet(object):
cov = self.coverage_by_program[prog_name]
cov.merge(Gcov.parse(cov.srcdir, process_name))
- def unexecuted_lines(self):
- covlist = sorted(self.coverage_by_program.values(), key=lambda c: c.srcdir)
- for src, grp in itertools.groupby(covlist, lambda c: c.srcdir):
- files = functools.reduce(lambda a, c: a | c, grp).files.values()
- file_lines = iter((f.src_file_name, iter(l for l in f.lines if l.count() == 0)) for f in files)
- yield src, file_lines
-
+ #def unexecuted_lines(self):
+ # covlist = sorted(self.coverage_by_program.values(), key=lambda c: c.srcdir)
+ # for src, grp in itertools.groupby(covlist, lambda c: c.srcdir):
+ # files = functools.reduce(lambda a, c: a | c, grp).files.values()
+ # file_lines = iter((f.src_file_name, iter(l for l in f.lines if l.count() == 0)) for f in files)
+ # yield src, file_lines
+ #
#def pretty_print(self, outfile=sys.stdout, width=60, stats=['unexecuted', 'unexecuted.bysrc']):
# print('='*width, file=outfile)
# print(' CODE COVERAGE', file=outfile)
@@ -216,26 +215,10 @@ class GcovSet(object):
def _get_coverage_by_file(self):
return functools.reduce(lambda a,b: a|b, self.coverage_by_program.values()).files
+ def _get_filenames(self):
+ return self.coverage_by_file.keys()
+
coverage_by_file = property(_get_coverage_by_file)
-
-
-def load(filename = 'coverage.pickle'):
- with open(filename) as f:
- return pickle.load(f)
-
-
-def lines(covset, filename, predicate=None):
- if predicate is None:
- predicate = lambda l: True
- for line in filter(predicate, covset.coverage_by_file[filename].lines):
- yield line.lineno, line.count(), line.code
-
-
-def nonexecuted(covset, filename):
- return lines(covset, filename, lambda line: line.count() == 0)
-
-
-def commented(covset, filename):
- return lines(covset, filename, lambda line: line.count() is None)
+ filenames = property(_get_filenames)