zeek/testing/btest/language/expire-redef.zeek
Robin Sommer 789cb376fd GH-239: Rename bro to zeek, bro-config to zeek-config, and bro-path-dev to zeek-path-dev.
This also installs symlinks from "zeek" and "bro-config" to a wrapper
script that prints a deprecation warning.

The btests pass, but this is still WIP. broctl renaming is still
missing.

#239
2019-05-01 21:43:45 +00:00

37 lines
718 B
Text

# @TEST-EXEC: zeek -b %INPUT >output
# @TEST-EXEC: btest-diff output
redef exit_only_after_terminate = T;
const exp_val = -1sec &redef;
global expired: function(tbl: table[int] of string, idx: int): interval;
global data: table[int] of string &write_expire=exp_val &expire_func=expired;
redef table_expire_interval = 1sec;
redef exp_val = 6sec;
global runs = 0;
event do_it()
{
++runs;
print fmt("Run %s", runs);
if ( runs < 2 )
schedule 4sec { do_it() };
else
terminate();
}
function expired(tbl: table[int] of string, idx: int): interval
{
print fmt("Expired: %s --> %s", idx, tbl[idx]);
return 0sec;
}
event zeek_init() &priority=-10
{
data[0] = "some data";
schedule 4sec { do_it() };
}