Merge remote-tracking branch 'origin/topic/jsiwek/brofiler'

* origin/topic/jsiwek/brofiler:
  Fix mktemp portability issue affecting test coverage. (addresses #752)

Closes #752.
This commit is contained in:
Robin Sommer 2012-01-27 10:38:14 -08:00
commit c607785cec
5 changed files with 32 additions and 9 deletions

21
CHANGES
View file

@ -1,4 +1,25 @@
2.0-36 | 2012-01-27 10:38:14 -0800
* New "Brofiler" mode that tracks and records script statements
executed during runtime. (Jon Siwek)
Use the BROFILER_FILE environment variable to point to a file in
which statement usage statistics from Bro script-layer can be
output.
Script statements that should be ignored can be marked with a "#
@no-test" comment. For example:
print "don't cover"; # @no-test
if ( F )
{ # @no-test
...
}
* Integrated coverage measurement into test-suite. (Jon Siwek)
2.0-20 | 2012-01-25 16:34:51 -0800
* BiF cleanup (Matthias Vallentin)

View file

@ -1 +1 @@
2.0-20
2.0-36

View file

@ -12,8 +12,8 @@ make-brief:
@for repo in $(DIRS); do (cd $$repo && make brief ); done
coverage:
@cp btest/coverage.log `mktemp brocov.tmp.XXX`
@for f in external/*/coverage.log; do cp $$f `mktemp brocov.tmp.XXX`; done
@test -f btest/coverage.log && cp btest/coverage.log `mktemp brocov.tmp.XXX` || true
@for f in external/*/coverage.log; do test -f $$f && cp $$f `mktemp brocov.tmp.XXX` || true; done
@echo "Complete test suite code coverage:"
@./scripts/coverage-calc "brocov.tmp.*" coverage.log `pwd`/../scripts
@rm -f brocov.tmp.*

View file

@ -2,14 +2,16 @@
DIAG=diag.log
BTEST=../../aux/btest/btest
all:
all: cleanup
# Showing all tests.
@rm -f $(DIAG)
@rm -f .tmp/script-coverage*
@$(BTEST) -f $(DIAG)
@../scripts/coverage-calc ".tmp/script-coverage*" coverage.log `pwd`/../../scripts
brief:
brief: cleanup
# Brief output showing only failed tests.
@rm -f $(DIAG)
@$(BTEST) -b -f $(DIAG)
@../scripts/coverage-calc ".tmp/script-coverage*" coverage.log `pwd`/../../scripts
cleanup:
@rm -f $(DIAG)
@rm -f .tmp/script-coverage*

View file

@ -4,4 +4,4 @@
# when collecting Bro script coverage statistics so that two independent
# Bro processing don't try to write those usage statistics to the same file.
BRO_PROFILER_FILE=`mktemp -t script-coverage` $BTEST_PATH/btest-bg-run $@
BRO_PROFILER_FILE=`mktemp $TMPDIR/script-coverage.XXXX` $BTEST_PATH/btest-bg-run $@