mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
BTests for testing that event handler coalescence operates as expected
This commit is contained in:
parent
3d21d80dac
commit
39e1f71ebf
4 changed files with 56 additions and 0 deletions
5
testing/btest/Baseline/opt.coalescence/output
Normal file
5
testing/btest/Baseline/opt.coalescence/output
Normal 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
|
5
testing/btest/Baseline/opt.no-coalescence/output
Normal file
5
testing/btest/Baseline/opt.no-coalescence/output
Normal 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
|
23
testing/btest/opt/coalescence.zeek
Normal file
23
testing/btest/opt/coalescence.zeek
Normal 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();
|
||||||
|
}
|
23
testing/btest/opt/no-coalescence.zeek
Normal file
23
testing/btest/opt/no-coalescence.zeek
Normal 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();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue