fix stderr test. ls behaves differently on errors on linux...

This commit is contained in:
Bernhard Amann 2013-05-27 23:07:37 -07:00
parent 08656c976b
commit f1745ff488
2 changed files with 18 additions and 6 deletions

View file

@ -1,6 +1,6 @@
Process finished event Process finished event
input input
1 Exit code != 0
Input::EVENT_NEW Input::EVENT_NEW
..: ..:
F F
@ -14,13 +14,13 @@ Input::EVENT_NEW
stderr.bro stderr.bro
F F
Input::EVENT_NEW Input::EVENT_NEW
ls: ../nonexistant: No such file or directory stderr output contained nonexistant
T T
Input::EVENT_NEW Input::EVENT_NEW
ls: ../nonexistant2: No such file or directory stderr output contained nonexistant
T T
Input::EVENT_NEW Input::EVENT_NEW
ls: ../nonexistant3: No such file or directory stderr output contained nonexistant
T T
done done
End of Data event End of Data event

View file

@ -15,7 +15,18 @@ global outfile: file;
event line(description: Input::EventDescription, tpe: Input::Event, s: string, is_stderr: bool) event line(description: Input::EventDescription, tpe: Input::Event, s: string, is_stderr: bool)
{ {
print outfile, tpe; print outfile, tpe;
print outfile, s; if ( is_stderr )
{
# work around localized error messages. and if some localization does not include the filename... well... that would be bad :)
if ( strstr(s, "nonexistant") > 0 )
{
print outfile, "stderr output contained nonexistant";
}
}
else
{
print outfile, s;
}
print outfile, is_stderr; print outfile, is_stderr;
try = try + 1; try = try + 1;
@ -38,7 +49,8 @@ event InputRaw::process_finished(name: string, source:string, exit_code:count, s
{ {
print outfile, "Process finished event"; print outfile, "Process finished event";
print outfile, name; print outfile, name;
print outfile, exit_code; if ( exit_code != 0 )
print outfile, "Exit code != 0";
} }
event bro_init() event bro_init()