Improve reliability of missing-file-initially.bro test

This test has failed numerous times on Travis CI.  Fixes to make this
test more reliable:  create the does-not-exist.dat file atomically, and
increase wait time after starting bro in order to give all input
streams a chance to try to read the input file.

Also added the input stream name to the test output, in order to make
output easier to understand if the test fails again.
This commit is contained in:
Daniel Thayer 2018-04-23 12:23:34 -05:00
parent 135fa9dc69
commit e16cc13667
2 changed files with 11 additions and 8 deletions

View file

@ -1,5 +1,5 @@
now it does input: now it does
and more! input: and more!
now it does inputstream: now it does
and more! inputstream: and more!
Streaming still works inputstream: Streaming still works

View file

@ -4,8 +4,11 @@
# failing behavior. # failing behavior.
# @TEST-EXEC: btest-bg-run bro bro %INPUT # @TEST-EXEC: btest-bg-run bro bro %INPUT
# @TEST-EXEC: sleep 2; cp does-exist.dat does-not-exist.dat # @TEST-EXEC: sleep 10
# @TEST-EXEC: sleep 2; mv does-not-exist.dat does-not-exist-again.dat; echo "Streaming still works" >> does-not-exist-again.dat # @TEST-EXEC: mv does-exist.dat does-not-exist.dat
# @TEST-EXEC: sleep 2
# @TEST-EXEC: mv does-not-exist.dat does-not-exist-again.dat
# @TEST-EXEC: echo "Streaming still works" >> does-not-exist-again.dat
# @TEST-EXEC: btest-bg-wait -k 3 # @TEST-EXEC: btest-bg-wait -k 3
# @TEST-EXEC: btest-diff bro/.stdout # @TEST-EXEC: btest-diff bro/.stdout
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff bro/.stderr # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff bro/.stderr
@ -30,7 +33,7 @@ type Val: record {
event line(description: Input::EventDescription, tpe: Input::Event, v: Val) event line(description: Input::EventDescription, tpe: Input::Event, v: Val)
{ {
print v$line; print fmt("%s: %s", description$name, v$line);
} }
event line2(description: Input::EventDescription, tpe: Input::Event, v: Val) event line2(description: Input::EventDescription, tpe: Input::Event, v: Val)