mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Improve an input framework test
A race condition could cause unstable output: if the thread reading the file is fast, often you see both "pred" functions execute and then both "line" events execute with both entries already in the table, but if the thread reading the file is slow, you see pred, event, pred, event, with only one entry available in the first event.
This commit is contained in:
parent
a3b1d202a5
commit
e50a8848ae
7 changed files with 123 additions and 182 deletions
|
@ -0,0 +1,52 @@
|
|||
============EVENT============
|
||||
Description
|
||||
source, ../input.log
|
||||
reader, Input::READER_ASCII
|
||||
mode, Input::REREAD
|
||||
name, ssh
|
||||
destination[left = 1], [s=<uninitialized>, ss=TEST]
|
||||
idx, A::Idx
|
||||
val, A::Val
|
||||
want_record, T
|
||||
Type, Input::EVENT_NEW
|
||||
Left, [i=1]
|
||||
Right, [s=<uninitialized>, ss=TEST]
|
||||
============EVENT============
|
||||
Description
|
||||
source, ../input.log
|
||||
reader, Input::READER_ASCII
|
||||
mode, Input::REREAD
|
||||
name, ssh
|
||||
destination[left = 2], [s=<uninitialized>, ss=<uninitialized>]
|
||||
idx, A::Idx
|
||||
val, A::Val
|
||||
want_record, T
|
||||
Type, Input::EVENT_NEW
|
||||
Left, [i=2]
|
||||
Right, [s=<uninitialized>, ss=<uninitialized>]
|
||||
============EVENT============
|
||||
Description
|
||||
source, ../input.log
|
||||
reader, Input::READER_ASCII
|
||||
mode, Input::REREAD
|
||||
name, ssh
|
||||
destination[left = 1], [s=TEST, ss=<uninitialized>]
|
||||
idx, A::Idx
|
||||
val, A::Val
|
||||
want_record, T
|
||||
Type, Input::EVENT_CHANGED
|
||||
Left, [i=1]
|
||||
Right, [s=<uninitialized>, ss=TEST]
|
||||
============EVENT============
|
||||
Description
|
||||
source, ../input.log
|
||||
reader, Input::READER_ASCII
|
||||
mode, Input::REREAD
|
||||
name, ssh
|
||||
destination[left = 2], [s=TEST, ss=TEST]
|
||||
idx, A::Idx
|
||||
val, A::Val
|
||||
want_record, T
|
||||
Type, Input::EVENT_CHANGED
|
||||
Left, [i=2]
|
||||
Right, [s=<uninitialized>, ss=<uninitialized>]
|
|
@ -1,155 +0,0 @@
|
|||
============PREDICATE============
|
||||
Input::EVENT_NEW
|
||||
[i=1]
|
||||
[s=<uninitialized>, ss=TEST]
|
||||
============PREDICATE============
|
||||
Input::EVENT_NEW
|
||||
[i=2]
|
||||
[s=<uninitialized>, ss=<uninitialized>]
|
||||
============EVENT============
|
||||
Description
|
||||
[source=../input.log, reader=Input::READER_ASCII, mode=Input::REREAD, name=ssh, destination={
|
||||
[2] = [s=<uninitialized>, ss=<uninitialized>],
|
||||
[1] = [s=<uninitialized>, ss=TEST]
|
||||
}, idx=A::Idx, val=A::Val, want_record=T, ev=line
|
||||
{
|
||||
print A::outfile, ============EVENT============;
|
||||
print A::outfile, Description;
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, Type;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, Left;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, A::right;
|
||||
return (T);
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
Type
|
||||
Input::EVENT_NEW
|
||||
Left
|
||||
[i=1]
|
||||
Right
|
||||
[s=<uninitialized>, ss=TEST]
|
||||
============EVENT============
|
||||
Description
|
||||
[source=../input.log, reader=Input::READER_ASCII, mode=Input::REREAD, name=ssh, destination={
|
||||
[2] = [s=<uninitialized>, ss=<uninitialized>],
|
||||
[1] = [s=<uninitialized>, ss=TEST]
|
||||
}, idx=A::Idx, val=A::Val, want_record=T, ev=line
|
||||
{
|
||||
print A::outfile, ============EVENT============;
|
||||
print A::outfile, Description;
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, Type;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, Left;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, A::right;
|
||||
return (T);
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
Type
|
||||
Input::EVENT_NEW
|
||||
Left
|
||||
[i=2]
|
||||
Right
|
||||
[s=<uninitialized>, ss=<uninitialized>]
|
||||
==========SERVERS============
|
||||
{
|
||||
[2] = [s=<uninitialized>, ss=<uninitialized>],
|
||||
[1] = [s=<uninitialized>, ss=TEST]
|
||||
}
|
||||
============PREDICATE============
|
||||
Input::EVENT_CHANGED
|
||||
[i=1]
|
||||
[s=TEST, ss=<uninitialized>]
|
||||
============PREDICATE============
|
||||
Input::EVENT_CHANGED
|
||||
[i=2]
|
||||
[s=TEST, ss=TEST]
|
||||
============EVENT============
|
||||
Description
|
||||
[source=../input.log, reader=Input::READER_ASCII, mode=Input::REREAD, name=ssh, destination={
|
||||
[2] = [s=TEST, ss=TEST],
|
||||
[1] = [s=TEST, ss=<uninitialized>]
|
||||
}, idx=A::Idx, val=A::Val, want_record=T, ev=line
|
||||
{
|
||||
print A::outfile, ============EVENT============;
|
||||
print A::outfile, Description;
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, Type;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, Left;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, A::right;
|
||||
return (T);
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
Type
|
||||
Input::EVENT_CHANGED
|
||||
Left
|
||||
[i=1]
|
||||
Right
|
||||
[s=<uninitialized>, ss=TEST]
|
||||
============EVENT============
|
||||
Description
|
||||
[source=../input.log, reader=Input::READER_ASCII, mode=Input::REREAD, name=ssh, destination={
|
||||
[2] = [s=TEST, ss=TEST],
|
||||
[1] = [s=TEST, ss=<uninitialized>]
|
||||
}, idx=A::Idx, val=A::Val, want_record=T, ev=line
|
||||
{
|
||||
print A::outfile, ============EVENT============;
|
||||
print A::outfile, Description;
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, Type;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, Left;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
print A::outfile, A::left;
|
||||
print A::outfile, A::right;
|
||||
return (T);
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
Type
|
||||
Input::EVENT_CHANGED
|
||||
Left
|
||||
[i=2]
|
||||
Right
|
||||
[s=<uninitialized>, ss=<uninitialized>]
|
||||
==========SERVERS============
|
||||
{
|
||||
[2] = [s=TEST, ss=TEST],
|
||||
[1] = [s=TEST, ss=<uninitialized>]
|
||||
}
|
||||
done
|
|
@ -0,0 +1,16 @@
|
|||
============PREDICATE============
|
||||
Input::EVENT_NEW
|
||||
[i=1]
|
||||
[s=<uninitialized>, ss=TEST]
|
||||
============PREDICATE============
|
||||
Input::EVENT_NEW
|
||||
[i=2]
|
||||
[s=<uninitialized>, ss=<uninitialized>]
|
||||
============PREDICATE============
|
||||
Input::EVENT_CHANGED
|
||||
[i=1]
|
||||
[s=TEST, ss=<uninitialized>]
|
||||
============PREDICATE============
|
||||
Input::EVENT_CHANGED
|
||||
[i=2]
|
||||
[s=TEST, ss=TEST]
|
|
@ -0,0 +1,11 @@
|
|||
==========SERVERS============
|
||||
{
|
||||
[2] = [s=<uninitialized>, ss=<uninitialized>],
|
||||
[1] = [s=<uninitialized>, ss=TEST]
|
||||
}
|
||||
==========SERVERS============
|
||||
{
|
||||
[2] = [s=TEST, ss=TEST],
|
||||
[1] = [s=TEST, ss=<uninitialized>]
|
||||
}
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue