cthulhu/test/harness/trace2html-coverage-patch.txt

61 lines
2.1 KiB
Plaintext

*** trace2html.py 2006-03-15 20:06:47.000000000 -0500
--- trace2html.py 2007-05-22 08:40:13.000000000 -0400
***************
*** 1,4 ****
! #! python
# (C) Copyright 2006 Olivier Grisel
# Author: Olivier Grisel <olivier.grisel@ensta.org>
--- 1,4 ----
! #!/usr/bin/python
# (C) Copyright 2006 Olivier Grisel
# Author: Olivier Grisel <olivier.grisel@ensta.org>
***************
*** 406,411 ****
--- 406,413 ----
# accumulate summary info
sums = {}
+ total_executable_lines = 0
+ total_covered_lines = 0 # really * 100
for filename, count in per_file_counts.iteritems():
# skip some "files" we don't care about...
***************
*** 418,423 ****
--- 420,426 ----
# Get a list of the line numbers which represent executable content
# (returned as a dict for better lookup speed)
lnotab = trace.find_executable_linenos(filename)
+ total_executable_lines += len(lnotab)
source = linecache.getlines(filename)
modulename = trace.fullmodname(filename)
***************
*** 426,435 ****
report_dir, modulename, source, lnotab, count, css_filename)
sums[modulename] = percent
# write the summary
index_filename = os.path.join(report_dir, 'index.html')
! self._writePage(index_filename, 'Coverage Report - All Modules',
self._summary(sums), css_filename)
return os.path.abspath(index_filename)
--- 429,441 ----
report_dir, modulename, source, lnotab, count, css_filename)
sums[modulename] = percent
+ total_covered_lines += (percent * len(lnotab))
# write the summary
index_filename = os.path.join(report_dir, 'index.html')
! self._writePage(index_filename,
! 'Coverage Report - All Modules - %d%s' \
! % (total_covered_lines / total_executable_lines, '%'),
self._summary(sums), css_filename)
return os.path.abspath(index_filename)