A set of new/changed tests regarding the new policy script organisation.

* test-all.bro renamed to test-all-policy.bro because it lists
      only the optional scripts now.

    * A new test that checks that the default config loads everything
      in base/*/

    * A new test that runs bare mode but loads all optional policy
      scripts (which fails horribly right now ...)

    * A new loaded_scripts test for the bare mode.
This commit is contained in:
Robin Sommer 2011-08-08 18:25:27 -07:00
parent f506b5682f
commit 1289e115c1
13 changed files with 44 additions and 19 deletions

View file

@ -1,4 +1,9 @@
1.6-dev-1061 | 2011-08-08 18:25:27 -0700
* A set of new/changed tests regarding the new policy script
organisation. (Robin Sommer)
1.6-dev-1058 | 2011-08-08 16:15:18 -0700 1.6-dev-1058 | 2011-08-08 16:15:18 -0700
* Reorganisation of the scripts that Bro loads by default. (Seth * Reorganisation of the scripts that Bro loads by default. (Seth

View file

@ -1 +1 @@
1.6-dev-1058 1.6-dev-1061

View file

@ -2,18 +2,17 @@
# #
# This is rarely makes sense, and is for testing only. # This is rarely makes sense, and is for testing only.
# #
# Note that we have unit test that makes sure that all policy files shipped are # Note that we have a unit test that makes sure that all policy files shipped are
# actually loaded here. If we have files that are part of the distribution yet # actually loaded here. If we have files that are part of the distribution yet
# can't be loaded here, these must still be listed here with their load command # can't be loaded here, these must still be listed here with their load command
# commented out. # commented out.
# The base/ scripts are all loaded by default and not included here. # The base/ scripts are all loaded by default and not included here.
# @load test-all.bro
# @load frameworks/communication/listen-clear.bro # @load frameworks/communication/listen-clear.bro
# @load frameworks/communication/listen-ssl.bro # @load frameworks/communication/listen-ssl.bro
# @load frameworks/control/controllee # @load frameworks/control/controllee.bro
# @load frameworks/control/controller # @load frameworks/control/controller.bro
@load frameworks/dpd/detect-protocols.bro @load frameworks/dpd/detect-protocols.bro
@load frameworks/dpd/packet-segment-logging.bro @load frameworks/dpd/packet-segment-logging.bro
@load frameworks/software/version-changes.bro @load frameworks/software/version-changes.bro
@ -27,6 +26,7 @@
@load misc/trim-trace-file.bro @load misc/trim-trace-file.bro
@load protocols/conn/known-hosts.bro @load protocols/conn/known-hosts.bro
@load protocols/conn/known-services.bro @load protocols/conn/known-services.bro
# @load protocols/conn/scan.bro
@load protocols/dns/auth-addl.bro @load protocols/dns/auth-addl.bro
@load protocols/dns/detect-external-names.bro @load protocols/dns/detect-external-names.bro
@load protocols/ftp/detect.bro @load protocols/ftp/detect.bro
@ -50,4 +50,4 @@
@load tuning/defaults/remove-high-volume-notices.bro @load tuning/defaults/remove-high-volume-notices.bro
@load tuning/defaults/warnings.bro @load tuning/defaults/warnings.bro
@load tuning/track-all-assets.bro @load tuning/track-all-assets.bro
@load site/local # @load hot.conn.bro

View file

@ -2,4 +2,4 @@
# #
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks # @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
# #
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -m -r $TRACES/wikipedia.trace test-all # @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -m -r $TRACES/wikipedia.trace test-all-policy

View file

@ -0,0 +1,7 @@
# Makes sures test-all-policy.bro (which loads *all* other policy scripts)
# compiles correctly even in bare mode.
#
# @TEST-EXEC: bro -b %INPUT >output
# @TEST-EXEC: btest-diff output
@load test-all-policy

View file

@ -0,0 +1,6 @@
# Makes sures test-all-policy.bro (which loads *all* other policy scripts) compiles correctly.
#
# @TEST-EXEC: bro %INPUT >output
# @TEST-EXEC: btest-diff output
@load test-all-policy

View file

@ -1,6 +0,0 @@
# Makes sures test-all.bro (which loads *all* other scripts) compiles correctly.
#
# @TEST-EXEC: bro %INPUT >output
# @TEST-EXEC: btest-diff output
@load test-all

View file

@ -0,0 +1,11 @@
# Makes sure that all base/* scripts are loaded by default via init-default.bro;
# and that all scripts loaded there in there actually exist.
@TEST-EXEC: test -d $DIST/scripts/base
@TEST-EXEC: test -e $DIST/scripts/base/init-default.bro
@TEST-EXEC: ( cd $DIST/scripts/base && find . -name '*.bro' ) | sort >"all scripts found"
@TEST-EXEC: bro misc/loaded-scripts
@TEST-EXEC: cat loaded_scripts.log | egrep -v '/build/|/loaded-scripts.bro' | awk 'NR>1{print $2}' | sed 's#/./#/#g' >loaded_scripts.log.tmp
@TEST-EXEC: cat loaded_scripts.log.tmp | sed -e ':a' -e '$!N' -e 's/^\(.*\).*\n\1.*/\1/' -e 'ta' >prefix
@TEST-EXEC: cat loaded_scripts.log.tmp | sed "s#`cat prefix`#./#g" | sort >init-default.bro
@TEST-EXEC: diff -u "all scripts found" init-default.bro 1>&2

View file

@ -0,0 +1,8 @@
# Makes sure that all policy/* scripts are loaded in test-all-policy.bro; and that
# all scripts loaded there actually exist.
@TEST-EXEC: test -e $DIST/scripts/test-all-policy.bro
@TEST-EXEC: test -d $DIST/scripts
@TEST-EXEC: ( cd $DIST/scripts/policy && find . -name '*.bro' ) | sort >"all scripts found"
@TEST-EXEC: cat $DIST/scripts/test-all-policy.bro | grep '@load' | sed 'sm^\( *# *\)\{0,\}@load *m./mg' | sort >test-all-policy.bro
@TEST-EXEC: diff -u "all scripts found" test-all-policy.bro 1>&2

View file

@ -1,6 +0,0 @@
# Makes sure that all policy scripts are loading in testing.bro; and that all
# scripts loaded there actually exist.
@TEST-EXEC: ( cd $DIST/policy && find . -name '*.bro' ) | sort >"all scripts found"
@TEST-EXEC: cat $DIST/policy/test-all.bro | grep '@load' | sed 'sm^\( *# *\)\{0,\}@load *m./mg' | sort >test-all.bro
@TEST-EXEC: diff -u "all scripts found" test-all.bro 1>&2