zeek/testing/btest/language/when.bro
2014-10-31 10:38:23 -05:00

32 lines
614 B
Text

# @TEST-SERIALIZE: comm
# @TEST-EXEC: btest-bg-run test1 bro %INPUT
# @TEST-EXEC: btest-bg-wait 10
# @TEST-EXEC: mv test1/.stdout out
# @TEST-EXEC: btest-diff out
@load frameworks/communication/listen
event bro_init()
{
local h: addr = 127.0.0.1;
when ( local hname = lookup_addr(h) )
{
print "lookup successful";
terminate();
}
timeout 10sec
{
print "timeout (1)";
}
local to = 5sec;
# Just checking that timeouts can use arbitrary expressions...
when ( local hname2 = lookup_addr(h) ) {}
timeout to {}
when ( local hname3 = lookup_addr(h) ) {}
timeout to + 2sec {}
print "done";
}