diff --git a/src/input/readers/Raw.cc b/src/input/readers/Raw.cc index fa1b09da7c..59899f32fc 100644 --- a/src/input/readers/Raw.cc +++ b/src/input/readers/Raw.cc @@ -79,6 +79,9 @@ bool Raw::CloseInput() InternalError(Fmt("Trying to close closed file for stream %s", fname.c_str())); return false; } +#ifdef DEBUG + Debug(DBG_INPUT, "Raw reader starting close"); +#endif delete in; @@ -90,6 +93,10 @@ bool Raw::CloseInput() in = NULL; file = NULL; +#ifdef DEBUG + Debug(DBG_INPUT, "Raw reader finished close"); +#endif + return true; } @@ -128,7 +135,7 @@ bool Raw::DoInit(string path, ReaderMode mode, int num_fields, const Field* cons execute = true; fname = path.substr(0, fname.length() - 1); - if ( (mode != MODE_MANUAL) && (mode != MODE_STREAM) ) + if ( (mode != MODE_MANUAL) ) { Error(Fmt("Unsupported read mode %d for source %s in execution mode", mode, fname.c_str())); @@ -254,8 +261,14 @@ bool Raw::DoHeartbeat(double network_time, double current_time) case MODE_REREAD: case MODE_STREAM: +#ifdef DEBUG + Debug(DBG_INPUT, "Starting Heartbeat update"); +#endif Update(); // call update and not DoUpdate, because update // checks disabled. +#ifdef DEBUG + Debug(DBG_INPUT, "Finished with heartbeat update"); +#endif break; default: assert(false); diff --git a/testing/btest/Baseline/scripts.base.frameworks.input.executestreamraw/out b/testing/btest/Baseline/scripts.base.frameworks.input.executestreamraw/out deleted file mode 100644 index bb69da3267..0000000000 --- a/testing/btest/Baseline/scripts.base.frameworks.input.executestreamraw/out +++ /dev/null @@ -1,145 +0,0 @@ -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW -sdfkh:KH;fdkncv;ISEUp34:Fkdj;YVpIODhfDF -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW -DSF"DFKJ"SDFKLh304yrsdkfj@#(*U$34jfDJup3UF -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW -q3r3057fdf -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW -sdfs\d -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW - -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW -dfsdf -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW -sdf -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW -3rw43wRRERLlL#RWERERERE. -[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=, want_record=F, ev=line -{ -print A::outfile, A::description; -print A::outfile, A::tpe; -print A::outfile, A::s; -A::try = A::try + 1; -if (9 == A::try) -{ -print A::outfile, done; -close(A::outfile); -Input::remove(input); -} - -}] -Input::EVENT_NEW - -done diff --git a/testing/btest/scripts/base/frameworks/input/executestreamraw.bro b/testing/btest/scripts/base/frameworks/input/executestreamraw.bro deleted file mode 100644 index d97a7b26a0..0000000000 --- a/testing/btest/scripts/base/frameworks/input/executestreamraw.bro +++ /dev/null @@ -1,58 +0,0 @@ -# -# @TEST-EXEC: cp input1.log input.log -# @TEST-EXEC: btest-bg-run bro bro -b %INPUT -# @TEST-EXEC: sleep 3 -# @TEST-EXEC: cat input2.log >> input.log -# @TEST-EXEC: sleep 3 -# @TEST-EXEC: cat input3.log >> input.log -# @TEST-EXEC: btest-bg-wait -k 3 -# @TEST-EXEC: btest-diff out - -@TEST-START-FILE input1.log -sdfkh:KH;fdkncv;ISEUp34:Fkdj;YVpIODhfDF -@TEST-END-FILE - -@TEST-START-FILE input2.log -DSF"DFKJ"SDFKLh304yrsdkfj@#(*U$34jfDJup3UF -q3r3057fdf -@TEST-END-FILE - -@TEST-START-FILE input3.log -sdfs\d - -dfsdf -sdf -3rw43wRRERLlL#RWERERERE. - -@TEST-END-FILE - -@load frameworks/communication/listen - -module A; - -type Val: record { - s: string; -}; - -global try: count; -global outfile: file; - -event line(description: Input::EventDescription, tpe: Input::Event, s: string) { - print outfile, description; - print outfile, tpe; - print outfile, s; - try = try + 1; - - if ( try == 9 ) { - print outfile, "done"; - close(outfile); - Input::remove("input"); - } -} - -event bro_init() -{ - outfile = open ("../out"); - try = 0; - Input::add_event([$source="tail -f ../input.log |", $reader=Input::READER_RAW, $mode=Input::STREAM, $name="input", $fields=Val, $ev=line]); -}