Adding a plugin test that checks that "make install" works.

This commit is contained in:
Robin Sommer 2014-07-22 20:25:31 -07:00
parent 9e74fcaf2a
commit e3adce83ee
4 changed files with 56 additions and 2 deletions

2
cmake

@ -1 +1 @@
Subproject commit fd4076e487565062d236bbe3959a6452a6ca38c7 Subproject commit 8437fd75cf68f45db4d8305d36ba52e41d2eb76a

View file

@ -0,0 +1,7 @@
Demo::Foo - <Insert description> (dynamic, version 1.0)
[Event] plugin_event
[Function] hello_plugin_world
plugin: automatically loaded at startup
calling bif, Hello from the plugin!
plugin: manually loaded

View file

@ -1,4 +1,4 @@
Demo::Foo - Caesar cipher rotating a string's characters by 13 places. (dynamic, version 1.0) Demo::Foo - <Insert description> (dynamic, version 1.0)
[Event] plugin_event [Event] plugin_event
[Function] hello_plugin_world [Function] hello_plugin_world

View file

@ -0,0 +1,47 @@
# @TEST-EXEC: ${DIST}/aux/bro-aux/plugin-support/init-plugin Demo Foo
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: BRO_PLUGIN_INSTALL=`pwd`/test-install make BRO=${DIST}
# @TEST-EXEC: make install
# @TEST-EXEC: BRO_PLUGIN_PATH=`pwd`/test-install bro -NN Demo::Foo >>output
# @TEST-EXEC: BRO_PLUGIN_PATH=`pwd` bro demo/foo -r $TRACES/empty.trace >>output
# @TEST-EXEC: TEST_DIFF_CANONIFIER= btest-diff output
cat >scripts/__load__.bro <<EOF
@load ./demo/foo/base/at-startup.bro
EOF
cat >scripts/demo/foo/__load__.bro <<EOF
@load ./manually.bro
EOF
cat >scripts/demo/foo/manually.bro <<EOF
event bro_init() &priority=-10
{
print "plugin: manually loaded";
}
EOF
mkdir -p scripts/demo/foo/base/
cat >scripts/demo/foo/base/at-startup.bro <<EOF
event bro_init() &priority=10
{
print "plugin: automatically loaded at startup";
print "calling bif", hello_plugin_world();
}
EOF
cat >src/functions.bif <<EOF
function hello_plugin_world%(%): string
%{
return new StringVal("Hello from the plugin!");
%}
EOF
cat >activate.bro <<EOF
@load-plugin Demo::Foo
EOF
cat >src/events.bif <<EOF
event plugin_event%(foo: count%);
EOF