mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
fix up the executeraw test - now it works for the first time and does not always fail
This commit is contained in:
parent
96a7e068f0
commit
4de6d76488
3 changed files with 29 additions and 6 deletions
|
@ -178,6 +178,12 @@ bool Raw::DoInit(string path, int arg_mode, int arg_num_fields, const Field* con
|
||||||
|
|
||||||
bool Raw::GetLine(string& str)
|
bool Raw::GetLine(string& str)
|
||||||
{
|
{
|
||||||
|
if ( in->peek() == std::iostream::traits_type::eof() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( in->eofbit == true || in->failbit == true )
|
||||||
|
return false;
|
||||||
|
|
||||||
while ( getline(*in, str, separator[0]) )
|
while ( getline(*in, str, separator[0]) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -247,6 +253,10 @@ bool Raw::DoUpdate()
|
||||||
Put(fields);
|
Put(fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
Debug(DBG_INPUT, "DoUpdate finished successfully");
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[source=wc -l ../input.log |, reader=Input::READER_RAW, mode=Input::MANUAL, name=input, fields=<no value description>, want_record=F, ev=line
|
||||||
|
{
|
||||||
|
print outfile, description;
|
||||||
|
print outfile, tpe;
|
||||||
|
print outfile, s;
|
||||||
|
close(outfile);
|
||||||
|
}]
|
||||||
|
Input::EVENT_NEW
|
||||||
|
8 ../input.log
|
|
@ -1,5 +1,6 @@
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: bro -b %INPUT >out
|
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||||
|
# @TEST-EXEC: btest-bg-wait -k 1
|
||||||
# @TEST-EXEC: btest-diff out
|
# @TEST-EXEC: btest-diff out
|
||||||
|
|
||||||
@TEST-START-FILE input.log
|
@TEST-START-FILE input.log
|
||||||
|
@ -13,21 +14,24 @@ sdf
|
||||||
3rw43wRRERLlL#RWERERERE.
|
3rw43wRRERLlL#RWERERERE.
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
@load frameworks/communication/listen
|
||||||
|
|
||||||
module A;
|
global outfile: file;
|
||||||
|
|
||||||
type Val: record {
|
type Val: record {
|
||||||
s: string;
|
s: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string) {
|
event line(description: Input::EventDescription, tpe: Input::Event, s: string) {
|
||||||
print description;
|
print outfile, description;
|
||||||
print tpe;
|
print outfile, tpe;
|
||||||
print s;
|
print outfile, s;
|
||||||
|
close(outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
event bro_init()
|
event bro_init()
|
||||||
{
|
{
|
||||||
Input::add_event([$source="wc input.log |", $reader=Input::READER_RAW, $name="input", $fields=Val, $ev=line]);
|
outfile = open ("../out");
|
||||||
|
Input::add_event([$source="wc -l ../input.log |", $reader=Input::READER_RAW, $name="input", $fields=Val, $ev=line]);
|
||||||
Input::remove("input");
|
Input::remove("input");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue