diff --git a/testing/btest/Baseline/opt.coalescence/output b/testing/btest/Baseline/opt.coalescence/output new file mode 100644 index 0000000000..90b992b6cc --- /dev/null +++ b/testing/btest/Baseline/opt.coalescence/output @@ -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 diff --git a/testing/btest/Baseline/opt.no-coalescence/output b/testing/btest/Baseline/opt.no-coalescence/output new file mode 100644 index 0000000000..9fa75ea74d --- /dev/null +++ b/testing/btest/Baseline/opt.no-coalescence/output @@ -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 diff --git a/testing/btest/opt/coalescence.zeek b/testing/btest/opt/coalescence.zeek new file mode 100644 index 0000000000..9552c168ba --- /dev/null +++ b/testing/btest/opt/coalescence.zeek @@ -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(); + } diff --git a/testing/btest/opt/no-coalescence.zeek b/testing/btest/opt/no-coalescence.zeek new file mode 100644 index 0000000000..2bd87bd413 --- /dev/null +++ b/testing/btest/opt/no-coalescence.zeek @@ -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(); + }