mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Add a Broxygen coverage test.
This commit is contained in:
parent
e58865af22
commit
25e28c04f0
5 changed files with 53 additions and 0 deletions
|
@ -1,2 +1,14 @@
|
|||
@load test-all-policy.bro
|
||||
|
||||
# Scripts which are commented out in test-all-policy.bro.
|
||||
@load protocols/ssl/notary.bro
|
||||
@load frameworks/communication/listen.bro
|
||||
@load frameworks/control/controllee.bro
|
||||
@load frameworks/control/controller.bro
|
||||
|
||||
@load ./example.bro
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
received termination signal
|
|
@ -1 +1,2 @@
|
|||
The '' control command is unknown.
|
||||
WARNING: No Site::local_nets have been defined. It's usually a good idea to define your local networks.
|
||||
|
|
35
testing/btest/coverage/broxygen.sh
Normal file
35
testing/btest/coverage/broxygen.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
# This check piggy-backs on the test-all-policy.bro test, assuming that every
|
||||
# loadable script is referenced there. The only additional check here is
|
||||
# that the broxygen package should even load scripts that are commented
|
||||
# out in test-all-policy.bro because the broxygen package is only loaded
|
||||
# when generated documentation and will terminate has soon as bro_init
|
||||
# is handled, even if a script will e.g. put Bro into listen mode or otherwise
|
||||
# cause it to not terminate after scripts are parsed.
|
||||
|
||||
# @TEST-EXEC: bash %INPUT $DIST/scripts/test-all-policy.bro $DIST/scripts/broxygen/__load__.bro
|
||||
|
||||
error_count=0
|
||||
|
||||
error_msg()
|
||||
{
|
||||
error_count=$((error_count+1))
|
||||
echo "$@" 1>&2;
|
||||
}
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
print "incorrect arguments"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
all_loads=$(egrep "#[[:space:]]*@load.*" $1 | sed 's/#[[:space:]]*@load[[:space:]]*//g')
|
||||
broxygen_loads=$(egrep "@load.*" $2 | sed 's/@load[[:space:]]*//g')
|
||||
|
||||
for f in $all_loads; do
|
||||
echo "$broxygen_loads" | grep -q $f || error_msg "$f not loaded in broxygen/__load__.bro"
|
||||
done
|
||||
|
||||
if [ $error_count -gt 0 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -1,6 +1,10 @@
|
|||
# This test is mostly just checking that there's no errors that result
|
||||
# from loading all scripts and generated docs for each.
|
||||
|
||||
# This must be serialized with communication tests because it does load
|
||||
# listen.bro in order to document it.
|
||||
|
||||
# @TEST-SERIALIZE: comm
|
||||
# @TEST-EXEC: bro -X broxygen.config broxygen
|
||||
# @TEST-EXEC: btest-diff .stdout
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue