BTests for testing that event handler coalescence operates as expected

This commit is contained in:
Vern Paxson 2023-11-16 13:03:40 -08:00
parent 3d21d80dac
commit 39e1f71ebf
4 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
my_event
ZAM-code my_event
second instance, higher priority
first instance, lower priority

View file

@ -0,0 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
my_event
ZAM-code my_event ZAM-code my_event
second instance, higher priority
first instance, lower priority

View file

@ -0,0 +1,23 @@
# @TEST-DOC: Ensure that event coalescence works properly.
#
# @TEST-EXEC: zeek -b -O ZAM %INPUT >output
# @TEST-EXEC: btest-diff output
event my_event() &priority=-10
{
print "first instance, lower priority";
}
event my_event() &priority=10
{
print "second instance, higher priority";
}
event zeek_init()
{
# This should print a single event handler body.
print my_event;
# Make sure execution of both handlers happens properly.
event my_event();
}

View file

@ -0,0 +1,23 @@
# @TEST-DOC: Ensure that event coalescence doesn't happen if inlining turned off.
#
# @TEST-EXEC: zeek -b -O ZAM -O no-inline %INPUT >output
# @TEST-EXEC: btest-diff output
event my_event() &priority=-10
{
print "first instance, lower priority";
}
event my_event() &priority=10
{
print "second instance, higher priority";
}
event zeek_init()
{
# This should print two event handler bodies.
print my_event;
# Make sure execution of both handlers happens properly.
event my_event();
}