mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix superfluous/duplicate data getting in to testing coverage log.
This commit is contained in:
parent
713e3ac5d0
commit
0287f7adc2
3 changed files with 13 additions and 8 deletions
|
@ -6,7 +6,7 @@ all:
|
||||||
@cp btest/coverage.log `mktemp brocov.tmp.XXX`
|
@cp btest/coverage.log `mktemp brocov.tmp.XXX`
|
||||||
@for f in external/*/coverage.log; do cp $$f `mktemp brocov.tmp.XXX`; done
|
@for f in external/*/coverage.log; do cp $$f `mktemp brocov.tmp.XXX`; done
|
||||||
@echo "Complete test suite code coverage:"
|
@echo "Complete test suite code coverage:"
|
||||||
@./scripts/coverage-calc "brocov.tmp.*" coverage.log `pwd`
|
@./scripts/coverage-calc "brocov.tmp.*" coverage.log `pwd`/../scripts
|
||||||
@rm -f brocov.tmp.*
|
@rm -f brocov.tmp.*
|
||||||
|
|
||||||
brief:
|
brief:
|
||||||
|
|
|
@ -7,7 +7,7 @@ all:
|
||||||
@rm -f $(DIAG)
|
@rm -f $(DIAG)
|
||||||
@rm -f .tmp/script-coverage*
|
@rm -f .tmp/script-coverage*
|
||||||
@$(BTEST) -f $(DIAG)
|
@$(BTEST) -f $(DIAG)
|
||||||
@../scripts/coverage-calc ".tmp/script-coverage*" coverage.log `pwd`
|
@../scripts/coverage-calc ".tmp/script-coverage*" coverage.log `pwd`/../../scripts
|
||||||
|
|
||||||
brief:
|
brief:
|
||||||
# Brief output showing only failed tests.
|
# Brief output showing only failed tests.
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
# This script aggregates many files containing Bro script coverage information
|
# This script aggregates many files containing Bro script coverage information
|
||||||
# into a single file and reports the overall coverage information. Usage:
|
# into a single file and reports the overall coverage information. Usage:
|
||||||
#
|
#
|
||||||
# coverage-calc <quoted glob of filenames> <output file> <ignored script dir>
|
# coverage-calc <quoted glob of filenames> <output file> <script dir>
|
||||||
#
|
#
|
||||||
# The last argument is used to ignore Bro scripts that are part of the test
|
# The last argument is used to point to a root directory containing all
|
||||||
# suite itself as those should not count towards the coverage calculation.
|
# the Bro distribution's scripts. It's used to cull out test scripts
|
||||||
|
# that are not part of the distribution and which should not count towrads
|
||||||
|
# the coverage calculation.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -15,7 +17,7 @@ import glob
|
||||||
stats = {}
|
stats = {}
|
||||||
inputglob = sys.argv[1]
|
inputglob = sys.argv[1]
|
||||||
outputfile = sys.argv[2]
|
outputfile = sys.argv[2]
|
||||||
ignoredir = os.path.abspath(sys.argv[3])
|
scriptdir = os.path.abspath(sys.argv[3])
|
||||||
|
|
||||||
for filename in glob.glob(inputglob):
|
for filename in glob.glob(inputglob):
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
|
@ -24,10 +26,13 @@ for filename in glob.glob(inputglob):
|
||||||
exec_count = int(parts[0])
|
exec_count = int(parts[0])
|
||||||
location = os.path.normpath(parts[1])
|
location = os.path.normpath(parts[1])
|
||||||
# ignore scripts that don't appear to be part of Bro distribution
|
# ignore scripts that don't appear to be part of Bro distribution
|
||||||
if location.startswith(ignoredir) or not location.startswith("/"):
|
if not location.startswith(scriptdir):
|
||||||
continue
|
continue
|
||||||
desc = parts[2]
|
desc = parts[2]
|
||||||
key = location + desc
|
# keying by location + desc may result in duplicate data
|
||||||
|
# as some descs change as a result of differing configurations
|
||||||
|
# producing record (re)definitions
|
||||||
|
key = location
|
||||||
if key in stats:
|
if key in stats:
|
||||||
stats[key][0] += exec_count
|
stats[key][0] += exec_count
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue