mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
Merge branch 'topic/jgras/expire-redef' of https://github.com/J-Gras/bro
Extended error handling a bit, and increased serialization data format version.
This commit is contained in:
commit
9da02ecae4
12 changed files with 159 additions and 32 deletions
2
testing/btest/Baseline/language.expire-expr-error/output
Normal file
2
testing/btest/Baseline/language.expire-expr-error/output
Normal file
|
@ -0,0 +1,2 @@
|
|||
error in /home/robin/bro/master/testing/btest/.tmp/language.expire-expr-error/expire-expr-error.bro, line 7: no such index (x[kaputt])
|
||||
received termination signal
|
5
testing/btest/Baseline/language.expire-redef/output
Normal file
5
testing/btest/Baseline/language.expire-redef/output
Normal file
|
@ -0,0 +1,5 @@
|
|||
Run 0
|
||||
Run 1
|
||||
Run 2
|
||||
Expired: 0 --> some data
|
||||
Run 3
|
1
testing/btest/Baseline/language.expire-type-error/out
Normal file
1
testing/btest/Baseline/language.expire-type-error/out
Normal file
|
@ -0,0 +1 @@
|
|||
error in /home/robin/bro/master/testing/btest/.tmp/language.expire-type-error/expire-type-error.bro, line 4: expiration interval has wrong type (kaputt)
|
29
testing/btest/language/expire-expr-error.bro
Normal file
29
testing/btest/language/expire-expr-error.bro
Normal file
|
@ -0,0 +1,29 @@
|
|||
# @TEST-EXEC: btest-bg-run broproc bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait -k 5
|
||||
# @TEST-EXEC: cat broproc/.stderr > output
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||
|
||||
global x: table[string] of interval;
|
||||
global data: table[int] of string &create_expire=x["kaputt"];
|
||||
|
||||
@load frameworks/communication/listen
|
||||
|
||||
global runs = 0;
|
||||
event do_it()
|
||||
{
|
||||
print fmt("Run %s", runs);
|
||||
|
||||
++runs;
|
||||
if ( runs < 4 )
|
||||
schedule 1sec { do_it() };
|
||||
}
|
||||
|
||||
|
||||
event bro_init() &priority=-10
|
||||
{
|
||||
data[0] = "some data";
|
||||
schedule 1sec { do_it() };
|
||||
}
|
||||
|
||||
|
||||
|
38
testing/btest/language/expire-redef.bro
Normal file
38
testing/btest/language/expire-redef.bro
Normal file
|
@ -0,0 +1,38 @@
|
|||
# @TEST-EXEC: btest-bg-run broproc bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait -k 5
|
||||
# @TEST-EXEC: cat broproc/.stdout > output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
|
||||
@load frameworks/communication/listen
|
||||
|
||||
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 = 3sec;
|
||||
|
||||
global runs = 0;
|
||||
event do_it()
|
||||
{
|
||||
print fmt("Run %s", runs);
|
||||
|
||||
++runs;
|
||||
if ( runs < 4 )
|
||||
schedule 1sec { do_it() };
|
||||
}
|
||||
|
||||
|
||||
function expired(tbl: table[int] of string, idx: int): interval
|
||||
{
|
||||
print fmt("Expired: %s --> %s", idx, tbl[idx]);
|
||||
return 0sec;
|
||||
}
|
||||
|
||||
event bro_init() &priority=-10
|
||||
{
|
||||
data[0] = "some data";
|
||||
schedule 1sec { do_it() };
|
||||
}
|
6
testing/btest/language/expire-type-error.bro
Normal file
6
testing/btest/language/expire-type-error.bro
Normal file
|
@ -0,0 +1,6 @@
|
|||
# @TEST-EXEC-FAIL: bro -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
||||
global data: table[int] of string &write_expire="kaputt";
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue