mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
regression test for spurious table expires
This commit is contained in:
parent
c9a6593969
commit
6fa7e68422
2 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
expire, new, 42
|
28
testing/btest/language/spurious-table-expires.zeek
Normal file
28
testing/btest/language/spurious-table-expires.zeek
Normal file
|
@ -0,0 +1,28 @@
|
|||
# @TEST-EXEC: zeek -b -r $TRACES/wikipedia.trace %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
# Default timer expiration interval is very conservative (10sec) and never runs for short pcaps.
|
||||
redef table_expire_interval = 0.01sec;
|
||||
|
||||
function f(t: table[string] of count, k: string): interval
|
||||
{
|
||||
print "expire", k, t[k];
|
||||
return 0.0sec;
|
||||
}
|
||||
|
||||
global t: table[string] of count &create_expire=0.1sec &expire_func=f;
|
||||
|
||||
# Populate the initial table with two entries.
|
||||
event zeek_init() &priority=5
|
||||
{
|
||||
t["a"] = 10;
|
||||
t["b"] = 20;
|
||||
}
|
||||
|
||||
# Replace global t, deleting all entries. In a DEBUG build, table continued
|
||||
# to exist and its entries spuriously expired over time.
|
||||
event zeek_init()
|
||||
{
|
||||
t = table() &create_expire=0.1sec &expire_func=f;
|
||||
t["new"] = 42;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue