Lines Matching +full:results +full:- +full:coverage
3 # Script to find coverage info after running tests.
8 # -Flfs.c -Flfs_util.c -slines
12 # SPDX-License-Identifier: BSD-3-Clause
41 # also accept +-∞ and +-inf
44 elif re.match('^\s*-\s*(?:∞|inf)\s*$', x):
45 x = -m.inf
54 elif self.x == -m.inf:
55 return '-∞'
66 none = '%7s' % '-'
70 diff_none = '%7s' % '-'
76 diff = new - old
79 elif diff == -m.inf:
80 return '%7s' % '-∞'
92 return -m.inf
98 return (new-old) / old
104 return self.__class__(self.x - other.x)
127 none = '%11s %7s' % ('-', '-')
133 else '-∞%' if t == -m.inf
136 diff_none = '%11s' % '-'
152 return new - old
158 return self.__class__(self.a - other.a, self.b - other.b)
177 # coverage results
203 def openio(path, mode='r', buffering=-1):
204 # allow '-' for stdin/stdout
205 if path == '-':
218 results = []
220 # get coverage info through gcov's json output
221 # note, gcov-path may contain extra args
222 cmd = GCOV_PATH + ['-b', '-t', '--json-format', path]
237 sys.exit(-1)
239 # collect line/branch coverage
271 results.append(CovResult(
287 results.append(CovResult(
297 return results
300 def fold(Result, results, *, argument
310 sys.exit(-1)
315 for r in results:
318 results = results_
320 # organize results into conflicts
322 for r in results:
335 def table(Result, results, diff_results=None, *, argument
352 results = fold(Result, results, by=by)
359 for r in results}
444 else '-∞%' if t == -m.inf
450 else '-∞%' if t == -m.inf
476 r = next(iter(fold(Result, results, by=[])), None)
489 # find the best widths, note that column 0 contains the names and column -1
492 ((max(it.chain([w], (len(l[i]) for l in lines)))+1+4-1)//4)*4-1
495 range(len(lines[0])-1))]
499 print('%-*s %s%s' % (
502 for w, x in zip(widths[1:], line[1:-1])),
503 line[-1]))
506 def annotate(Result, results, *, argument
515 for path in co.OrderedDict.fromkeys(r.file for r in results).keys():
517 results = fold(Result, results, by=['file', 'line'])
518 table = {r.line: r for r in results if r.file == path}
528 if last is not None and line - last.stop <= args['context']:
536 line-args['context'],
561 line = line[:-1]
565 line = '%-*s // %s hits%s' % (
598 results = collect(gcda_paths, **args)
600 results = []
608 results.append(CovResult(
619 results = fold(CovResult, results, by=by, defines=defines)
622 results.sort()
625 results.sort(
631 # write results to CSV
639 for r in results:
646 # find previous results?
679 annotate(CovResult, results, **args)
682 table(CovResult, results,
691 # catch lack of coverage
693 r.lines.a < r.lines.b for r in results):
696 r.branches.a < r.branches.b for r in results):
704 description="Find coverage info after running tests.",
711 '-v', '--verbose',
715 '-q', '--quiet',
717 help="Don't show anything, useful with -o.")
719 '-o', '--output',
720 help="Specify CSV file to store results.")
722 '-u', '--use',
725 '-d', '--diff',
728 '-a', '--all',
732 '-p', '--percent',
736 '-b', '--by',
741 '-f', '--field',
747 '-D', '--define',
751 help="Only include results where this field is this value.")
756 namespace.sort.append((value, True if option == '-S' else False))
758 '-s', '--sort',
763 '-S', '--reverse-sort',
768 '-Y', '--summary',
772 '-F', '--source',
778 '--everything',
782 '--hits',
784 help="Show total hits instead of coverage.")
786 '-A', '--annotate',
788 help="Show source files annotated with coverage info.")
790 '-L', '--lines',
794 '-B', '--branches',
798 '-c', '--context',
803 '-W', '--width',
808 '--color',
813 '-e', '--error-on-lines',
817 '-E', '--error-on-branches',
821 '--gcov-path',