zeek/testing/btest/core/event-groups/hooks-module.zeek
Arne Welzel 2ad609cbbb Reintroduce event groups
This started with reverting commit 52cd02173d
and then rewriting it to be per handler rather than handler identifier
and adding support for hooks as well as adding implicit module groups.
2022-10-25 18:03:26 +02:00

53 lines
941 B
Text

# @TEST-DOC: Very basic testing that hooks in modules are disabled through disable_module_events(), too.
# @TEST-EXEC: zeek %INPUT > output
# @TEST-EXEC: btest-diff output
module HookModule;
export {
global module_hook: hook(c: count);
}
module MyModule;
hook HookModule::module_hook(c: count)
{
print "HookModule::module_hook in MyModule", c;
}
event zeek_done()
{
print "FAIL: zeek_done in MyModule";
}
module MyOtherModule;
hook HookModule::module_hook(c: count)
{
print "HookModule::module_hook in MyOtherModule", c;
}
event zeek_done()
{
print "zeek_done in MyOtherModule";
}
module GLOBAL;
hook HookModule::module_hook(c: count)
{
print "HookModule::module_hook in GLOBAL", c;
}
event zeek_init()
{
hook HookModule::module_hook(1);
print "=== disable_module_events(MyModule)";
disable_module_events("MyModule");
hook HookModule::module_hook(2);
}
event zeek_done()
{
print "zeek_done in global";
}