Improve stability of a &expire_func btest

The order in which &expire_func's get called isn't well-defined, so
separate the output from either to ensure diffs against the Baseline are
always consistent.
This commit is contained in:
Jon Siwek 2020-02-07 15:06:56 -08:00
parent 9754c2c09f
commit a3b1d202a5
5 changed files with 21 additions and 14 deletions

View file

@ -1,4 +1,8 @@
3.1.0-dev.598 | 2020-02-07 15:06:56 -0800
* Improve stability of a &expire_func btest (Jon Siwek, Corelight)
3.1.0-dev.597 | 2020-02-07 15:25:56 -0700
* plugin/Manager: migrate to std::string_view (Max Kellermann)

View file

@ -1 +1 @@
3.1.0-dev.597
3.1.0-dev.598

View file

@ -1,20 +1,11 @@
starting: ashish, 1
starting: ashish, 1
inside table_expire_func: ashish, 2
inside table_expire_func: [ashish, ashish], 2
inside table_expire_func: ashish, 3
inside table_expire_func: [ashish, ashish], 3
inside table_expire_func: ashish, 4
inside table_expire_func: [ashish, ashish], 4
inside table_expire_func: ashish, 5
inside table_expire_func: [ashish, ashish], 5
inside table_expire_func: ashish, 6
inside table_expire_func: [ashish, ashish], 6
inside table_expire_func: ashish, 7
inside table_expire_func: [ashish, ashish], 7
inside table_expire_func: ashish, 8
inside table_expire_func: [ashish, ashish], 8
inside table_expire_func: ashish, 9
inside table_expire_func: [ashish, ashish], 9
inside table_expire_func: ashish, 10
inside table_expire_func: [ashish, ashish], 10

View file

@ -0,0 +1,9 @@
inside table_expire_func: [ashish, ashish], 2
inside table_expire_func: [ashish, ashish], 3
inside table_expire_func: [ashish, ashish], 4
inside table_expire_func: [ashish, ashish], 5
inside table_expire_func: [ashish, ashish], 6
inside table_expire_func: [ashish, ashish], 7
inside table_expire_func: [ashish, ashish], 8
inside table_expire_func: [ashish, ashish], 9
inside table_expire_func: [ashish, ashish], 10

View file

@ -1,11 +1,14 @@
# @TEST-EXEC: zeek -b %INPUT >out
# @TEST-EXEC: btest-diff out
# @TEST-EXEC: btest-diff out2
module Test;
redef exit_only_after_terminate = T;
redef table_expire_interval = .1 secs ;
global out2 = open("out2");
export {
global table_expire_func: function(t: table[string] of count,
s: string): interval;
@ -50,9 +53,9 @@ function table_expire_func2 (tt: table[string, string, string] of count, s: stri
{
tt[s, s2, s3] += 1;
print fmt("inside table_expire_func: [%s, %s], %s", s, s2, tt[s, s2, s3]);
print out2, fmt("inside table_expire_func: [%s, %s], %s", s, s2, tt[s, s2, s3]);
if ( tt[s, s2, s3] < 10 )
if ( tt[s, s2, s3] < 10 )
return .1 secs ;
schedule .1sec { die() };