Skip to content

Commit

Permalink
Fix mktemp portability issue affecting test coverage. (addresses zeek…
Browse files Browse the repository at this point in the history
…#752)

Also update Makefiles to behave better for brief targets and in absence
of external test repos.
  • Loading branch information
jsiwek committed Jan 27, 2012
1 parent f6f9dd9 commit 0065cf6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down
12 changes: 7 additions & 5 deletions testing/btest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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*
2 changes: 1 addition & 1 deletion testing/scripts/btest-bg-run
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@

0 comments on commit 0065cf6

Please sign in to comment.