Rewrite the btest for when-statement timeouts

To avoid a memory leak in DNS lookups that's hard to work around and
does not otherwise effect typical operation when Zeek is allowed to
continue to run after zeek_init().
This commit is contained in:
Jon Siwek 2019-12-31 13:04:29 -08:00
parent 09578c6176
commit d917737766
2 changed files with 13 additions and 11 deletions

View file

@ -1,19 +1,21 @@
# @TEST-EXEC: unset ZEEK_DNS_FAKE && unset BRO_DNS_FAKE && zeek -b %INPUT >out # @TEST-EXEC: btest-bg-run zeek zeek -b %INPUT
# @TEST-EXEC: btest-diff out # @TEST-EXEC: btest-bg-wait 10
# @TEST-EXEC: btest-diff zeek/.stdout
redef exit_only_after_terminate=T;
global myset = set("yes");
event zeek_init() event zeek_init()
{ {
local h1: addr = 1.2.3.4; when ( "no" in myset )
when ( local h1name = lookup_addr(h1) )
{ {
print "lookup successful"; print "lookup successful";
terminate();
} }
timeout 3 secs timeout 0.25sec
{ {
print "timeout"; print "timeout";
terminate();
} }
} }