mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 04:58:21 +00:00
Merge remote-tracking branch 'origin/master' into topic/johanna/config-cluster
This commit is contained in:
commit
da58f9d4a6
83 changed files with 894 additions and 695 deletions
|
@ -1 +0,0 @@
|
|||
1502645128.235998 Broker::STATUS peer-added 127.0.0.1 XXX handshake successful
|
|
@ -1,2 +1,2 @@
|
|||
peer added, handshake successful
|
||||
Something receiver, 1
|
||||
receiver got event, 1
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
1502645286.464675 Broker::STATUS peer-added 127.0.0.1 XXX handshake successful
|
|
@ -1,2 +1,2 @@
|
|||
peer added, handshake successful
|
||||
Something receiver, 2
|
||||
receiver got event, 2
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
1524513026.795171 Broker::STATUS peer-added 127.0.0.1 XXX received handshake from remote core
|
||||
1524513033.340316 Broker::STATUS connection-terminated 127.0.0.1 XXX lost remote peer
|
||||
1524513035.437373 Broker::STATUS peer-added 127.0.0.1 XXX received handshake from remote core
|
||||
1524513041.743002 Broker::STATUS connection-terminated 127.0.0.1 XXX lost remote peer
|
|
@ -1,6 +1,4 @@
|
|||
peer added, received handshake from remote core
|
||||
Something sender, 1
|
||||
peer lost, lost remote peer
|
||||
peer added, received handshake from remote core
|
||||
Something sender, 2
|
||||
peer lost, lost remote peer
|
||||
|
|
|
@ -10,3 +10,25 @@ in operator (PASS)
|
|||
& operator (FAIL)
|
||||
| operator (PASS)
|
||||
| operator (FAIL)
|
||||
/i pattern modifier (PASS)
|
||||
/i pattern modifier (PASS)
|
||||
/i double-quote escape (FAIL)
|
||||
/i double-quote escape (PASS)
|
||||
case-sensitive pattern (FAIL)
|
||||
case-sensitive pattern (FAIL)
|
||||
case-sensitive pattern (PASS)
|
||||
/i pattern disjunction (PASS)
|
||||
/i pattern disjunction (FAIL)
|
||||
/i pattern disjunction (PASS)
|
||||
/i pattern disjunction (PASS)
|
||||
/i pattern concatenation (PASS)
|
||||
/i pattern concatenation (FAIL)
|
||||
/i pattern concatenation (FAIL)
|
||||
/i pattern concatenation (PASS)
|
||||
/i pattern concatenation (PASS)
|
||||
/i pattern concatenation (FAIL)
|
||||
/i pattern character class (FAIL)
|
||||
/i pattern character class (PASS)
|
||||
(?i:...) pattern construct (PASS)
|
||||
(?i:...) pattern construct (FAIL)
|
||||
(?i:...) pattern construct (PASS)
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
Input::EVENT_NEW, cat |, input0
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input0
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay0
|
||||
Input::EVENT_NEW, cat |, input1
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input1
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay01
|
||||
Input::EVENT_NEW, cat |, input2
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input2
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay012
|
||||
Input::EVENT_NEW, cat |, input3
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input3
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay0123
|
||||
Input::EVENT_NEW, cat |, input4
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input4
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay01234
|
||||
Input::EVENT_NEW, cat |, input0, hello
|
||||
Input::EVENT_NEW, cat |, input0, there\x01\x02\x03\x04\x05\x01\x02\x03yay0
|
||||
Input::EVENT_NEW, cat |, input1, hello
|
||||
Input::EVENT_NEW, cat |, input1, there\x01\x02\x03\x04\x05\x01\x02\x03yay01
|
||||
Input::EVENT_NEW, cat |, input4, hello
|
||||
Input::EVENT_NEW, cat |, input4, there\x01\x02\x03\x04\x05\x01\x02\x03yay01234
|
||||
Input::EVENT_NEW, cat |, input2, hello
|
||||
Input::EVENT_NEW, cat |, input2, there\x01\x02\x03\x04\x05\x01\x02\x03yay012
|
||||
Input::EVENT_NEW, cat |, input3, hello
|
||||
Input::EVENT_NEW, cat |, input3, there\x01\x02\x03\x04\x05\x01\x02\x03yay0123
|
||||
|
|
|
@ -1,153 +1,25 @@
|
|||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, 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=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
DSF"DFKJ"SDFKLh304yrsdkfj@#(*U$34jfDJup3UF
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
q3r3057fdf
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdfs\d
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
dfsdf
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdf
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
3rw43wRRERLlL#RWERERERE.
|
||||
done
|
||||
|
|
|
@ -1,27 +1,9 @@
|
|||
Input::EVENT_NEW
|
||||
..:
|
||||
F
|
||||
Input::EVENT_NEW
|
||||
bro
|
||||
F
|
||||
Input::EVENT_NEW
|
||||
out
|
||||
F
|
||||
Input::EVENT_NEW
|
||||
stderr.bro
|
||||
F
|
||||
Input::EVENT_NEW
|
||||
stderr output contained nonexistant
|
||||
T
|
||||
Input::EVENT_NEW
|
||||
stderr output contained nonexistant
|
||||
T
|
||||
Input::EVENT_NEW
|
||||
stderr output contained nonexistant
|
||||
T
|
||||
done
|
||||
End of Data event
|
||||
input
|
||||
Process finished event
|
||||
input
|
||||
Exit code != 0
|
||||
Input::EVENT_NEW line output (stderr=F): ../mydir:
|
||||
Input::EVENT_NEW line output (stderr=F): a
|
||||
Input::EVENT_NEW line output (stderr=F): b
|
||||
Input::EVENT_NEW line output (stderr=F): c
|
||||
Input::EVENT_NEW line output (stderr=T): <stderr output contained nonexistant>
|
||||
Input::EVENT_NEW line output (stderr=T): <stderr output contained nonexistant>
|
||||
Input::EVENT_NEW line output (stderr=T): <stderr output contained nonexistant>
|
||||
End of Data event, input
|
||||
Process finished event, input, T
|
||||
|
|
|
@ -1,153 +1,25 @@
|
|||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdfkh:KH;fdkncv;ISEUp34:Fkdj;YVpIODhfDF
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
DSF"DFKJ"SDFKLh304yrsdkfj@#(*U$34jfDJup3UF
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
q3r3057fdf
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdfs\d
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
dfsdf
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdf
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, 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 (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
3rw43wRRERLlL#RWERERERE.
|
||||
done
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Rule added, worker-2:2, 4
|
||||
Rule added, worker-2:3, 5
|
||||
1
|
||||
Rule destroyed, worker-2:3, 5, 0
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
|
||||
# @TEST-EXEC: btest-bg-run recv "bro -B broker -b ../recv.bro >recv.out"
|
||||
# @TEST-EXEC: btest-bg-run send "bro -B broker -b ../send.bro >send.out"
|
||||
#
|
||||
# @TEST-EXEC: sleep 6 && kill $(cat recv/.pid) && sleep 1 && echo 0 >recv/.exitcode
|
||||
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file recv/got-event 30 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: kill $(cat recv/.pid)
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-pid $(cat recv/.pid) 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: echo 0 >recv/.exitcode
|
||||
|
||||
# @TEST-EXEC: btest-bg-run recv2 "bro -B broker -b ../recv.bro >recv2.out"
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-wait 25
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
||||
# @TEST-EXEC: btest-diff send/send.out
|
||||
# @TEST-EXEC: btest-diff recv/recv.out
|
||||
# @TEST-EXEC: btest-diff recv2/recv2.out
|
||||
#
|
||||
# @TEST-EXEC: cat send/broker.log | awk '/Broker::STATUS/ { $5="XXX"; print; }' >send/broker.filtered.log
|
||||
# @TEST-EXEC: cat recv/broker.log | awk '/Broker::STATUS/ { $5="XXX"; print; }' >recv/broker.filtered.log
|
||||
# @TEST-EXEC: cat recv2/broker.log | grep -v "lost remote peer" | awk '/Broker::STATUS/ { $5="XXX"; print; }' >recv2/broker.filtered.log
|
||||
# @TEST-EXEC: btest-diff send/broker.filtered.log
|
||||
# @TEST-EXEC: btest-diff recv/broker.filtered.log
|
||||
# @TEST-EXEC: btest-diff recv2/broker.filtered.log
|
||||
|
||||
@TEST-START-FILE send.bro
|
||||
|
||||
|
@ -24,42 +21,34 @@ redef Broker::default_connect_retry=1secs;
|
|||
redef Broker::default_listen_retry=1secs;
|
||||
redef exit_only_after_terminate = T;
|
||||
|
||||
event self_terminate()
|
||||
global peers = 0;
|
||||
const test_topic = "bro/test/my_topic";
|
||||
|
||||
event my_event(i: count)
|
||||
{
|
||||
terminate();
|
||||
print "sender got event", i;
|
||||
}
|
||||
|
||||
event do_terminate()
|
||||
{
|
||||
schedule 2sec { self_terminate() };
|
||||
}
|
||||
|
||||
event print_something(i: int)
|
||||
{
|
||||
print "Something sender", i;
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Broker::subscribe("bro/event/my_topic");
|
||||
Broker::auto_publish("bro/event/my_topic", print_something);
|
||||
Broker::auto_publish("bro/event/my_topic", do_terminate);
|
||||
Broker::peer("127.0.0.1");
|
||||
|
||||
schedule 3secs { print_something(1) };
|
||||
schedule 12secs { print_something(2) };
|
||||
schedule 13secs { do_terminate() };
|
||||
}
|
||||
{
|
||||
Broker::subscribe(test_topic);
|
||||
Broker::peer("127.0.0.1");
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "peer lost", msg;
|
||||
}
|
||||
{
|
||||
print "peer lost", msg;
|
||||
|
||||
if ( peers == 2 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "peer added", msg;
|
||||
}
|
||||
{
|
||||
++peers;
|
||||
print "peer added", msg;
|
||||
Broker::publish(test_topic, my_event, peers);
|
||||
}
|
||||
|
||||
@TEST-END-FILE
|
||||
|
||||
|
@ -70,31 +59,33 @@ redef Broker::default_connect_retry=1secs;
|
|||
redef Broker::default_listen_retry=1secs;
|
||||
redef exit_only_after_terminate = T;
|
||||
|
||||
event do_terminate()
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
const test_topic = "bro/test/my_topic";
|
||||
|
||||
event print_something(i: int)
|
||||
{
|
||||
print "Something receiver", i;
|
||||
}
|
||||
event my_event(i: count)
|
||||
{
|
||||
print "receiver got event", i;
|
||||
|
||||
if ( i == 1 )
|
||||
# In the first case, terminate via `kill` from btest command.
|
||||
system("touch got-event");
|
||||
else
|
||||
terminate();
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
Broker::subscribe("bro/event/my_topic");
|
||||
Broker::listen("127.0.0.1");
|
||||
}
|
||||
{
|
||||
Broker::subscribe(test_topic);
|
||||
Broker::listen("127.0.0.1");
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
# In the 2nd run, this may be lost at termination, so don't output.
|
||||
#print "peer lost", msg;
|
||||
}
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "peer added", msg;
|
||||
}
|
||||
{
|
||||
print "peer added", msg;
|
||||
}
|
||||
|
||||
@TEST-END-FILE
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro -m %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -m %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 60
|
||||
|
@ -19,6 +18,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global n = 0;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#
|
||||
# @TEST-EXEC: bro -m %INPUT>out
|
||||
# @TEST-EXEC: btest-bg-run manager-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro -m %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -m runnumber=1 %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m runnumber=2 %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 60
|
||||
|
@ -24,6 +23,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global hll_data: event(data: opaque of cardinality);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#
|
||||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro bro -m -b %INPUT
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 8 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got6 8 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 60
|
||||
|
||||
|
@ -48,7 +48,12 @@ event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
|||
print outfile, s;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 16 )
|
||||
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 6 )
|
||||
system("touch got6");
|
||||
else if ( try == 16 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
#
|
||||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro bro -m -b %INPUT
|
||||
# @TEST-EXEC: sleep 60
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 60 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got4 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got6 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input4.log input.log
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got8 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input5.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 120
|
||||
|
||||
|
@ -145,7 +145,16 @@ event Input::end_of_data(name: string, source: string)
|
|||
}
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 10 )
|
||||
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 4 )
|
||||
system("touch got4");
|
||||
else if ( try == 6 )
|
||||
system("touch got6");
|
||||
else if ( try == 8 )
|
||||
system("touch got8");
|
||||
else if ( try == 10 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -35,4 +35,33 @@ event new_connection(c: connection)
|
|||
test_case( "& operator", p2 & p1 in "baroob" );
|
||||
test_case( "| operator", p1 | p2 in "lazybarlazy" );
|
||||
test_case( "| operator", p3 | p4 in "xoob" );
|
||||
|
||||
test_case( "/i pattern modifier", /fOO/i in "xFoObar" );
|
||||
test_case( "/i pattern modifier", /fOO/i == "Foo" );
|
||||
|
||||
test_case( "/i double-quote escape", /"fOO"/i in "xFoObar" );
|
||||
test_case( "/i double-quote escape", /"fOO"/i in "xfOObar" );
|
||||
|
||||
test_case( "case-sensitive pattern", /fOO/ in "xFoObar" );
|
||||
test_case( "case-sensitive pattern", /fOO/ == "Foo" );
|
||||
test_case( "case-sensitive pattern", /fOO/ == "fOO" );
|
||||
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bez" );
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bEz" );
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bar" );
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bAr" );
|
||||
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "barbez" );
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "barbEz" );
|
||||
test_case( "/i pattern concatenation", /BAR/i & /bez/ == "barbEz" );
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "bArbez" );
|
||||
test_case( "/i pattern concatenation", /BAR/i & /bez/ == "bArbez" );
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "bArbEz" );
|
||||
|
||||
test_case( "/i pattern character class", /ba[0a-c99S-Z0]/i & /bEz/ == "bArbEz" );
|
||||
test_case( "/i pattern character class", /ba[0a-c99M-S0]/i & /bEz/ == "bArbEz" );
|
||||
|
||||
test_case( "(?i:...) pattern construct", /foo|(?i:bar)/ in "xBAry" );
|
||||
test_case( "(?i:...) pattern construct", /foo|(?i:bar)/ in "xFOoy" );
|
||||
test_case( "(?i:...) pattern construct", /foo|(?i:bar)/ | /foo/i in "xFOoy" );
|
||||
}
|
||||
|
|
|
@ -22,15 +22,47 @@ event bro_init()
|
|||
|
||||
test_case( "equality operator", "foo" == p1 );
|
||||
test_case( "equality operator (order of operands)", p1 == "foo" );
|
||||
|
||||
test_case( "inequality operator", "foobar" != p1 );
|
||||
test_case( "inequality operator (order of operands)", p1 != "foobar" );
|
||||
|
||||
test_case( "in operator", p1 in "foobar" );
|
||||
test_case( "in operator", p2 in "foobar" );
|
||||
test_case( "!in operator", p3 !in "foobar" );
|
||||
|
||||
test_case( "& operator", p1 & p2 in "baroob" );
|
||||
test_case( "& operator", p2 & p1 in "baroob" );
|
||||
|
||||
test_case( "| operator", p1 | p2 in "lazybarlazy" );
|
||||
test_case( "| operator", p3 | p4 in "xoob" );
|
||||
|
||||
}
|
||||
test_case( "/i pattern modifier", /fOO/i in "xFoObar" );
|
||||
test_case( "/i pattern modifier", /fOO/i == "Foo" );
|
||||
|
||||
test_case( "/i double-quote escape", /"fOO"/i in "xFoObar" );
|
||||
test_case( "/i double-quote escape", /"fOO"/i in "xfOObar" );
|
||||
|
||||
test_case( "case-sensitive pattern", /fOO/ in "xFoObar" );
|
||||
test_case( "case-sensitive pattern", /fOO/ == "Foo" );
|
||||
test_case( "case-sensitive pattern", /fOO/ == "fOO" );
|
||||
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bez" );
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bEz" );
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bar" );
|
||||
test_case( "/i pattern disjunction", /bar/i | /bez/ == "bAr" );
|
||||
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "barbez" );
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "barbEz" );
|
||||
test_case( "/i pattern concatenation", /BAR/i & /bez/ == "barbEz" );
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "bArbez" );
|
||||
test_case( "/i pattern concatenation", /BAR/i & /bez/ == "bArbez" );
|
||||
test_case( "/i pattern concatenation", /bar/i & /bez/ == "bArbEz" );
|
||||
|
||||
test_case( "/i pattern character class", /ba[0a-c99S-Z0]/i & /bEz/ == "bArbEz" );
|
||||
test_case( "/i pattern character class", /ba[0a-c99M-S0]/i & /bEz/ == "bArbEz" );
|
||||
|
||||
test_case( "(?i:...) pattern construct", /foo|(?i:bar)/ in "xBAry" );
|
||||
test_case( "(?i:...) pattern construct", /foo|(?i:bar)/ in "xFOoy" );
|
||||
test_case( "(?i:...) pattern construct", /foo|(?i:bar)/ | /foo/i in "xFOoy" );
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global my_pool_spec: Cluster::PoolSpec =
|
||||
Cluster::PoolSpec(
|
||||
$topic = "bro/cluster/pool/my_pool",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global my_pool_spec: Cluster::PoolSpec =
|
||||
Cluster::PoolSpec(
|
||||
$topic = "bro/cluster/pool/my_pool",
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
#
|
||||
# @TEST-EXEC: btest-bg-run logger-1 BROPATH=$BROPATH:.. CLUSTER_NODE=logger-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run logger-2 BROPATH=$BROPATH:.. CLUSTER_NODE=logger-2 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run manager BROPATH=$BROPATH:.. CLUSTER_NODE=manager bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
# @TEST-EXEC: btest-diff logger-1/test.log
|
||||
|
@ -22,6 +20,10 @@ redef Cluster::nodes = {
|
|||
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0sec;
|
||||
|
||||
module Test;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run logger-1 CLUSTER_NODE=logger-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run manager-1 CLUSTER_NODE=manager-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 CLUSTER_NODE=proxy-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 CLUSTER_NODE=proxy-2 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 CLUSTER_NODE=worker-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 CLUSTER_NODE=worker-2 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -29,6 +26,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global fully_connected: event();
|
||||
|
||||
global peer_count = 0;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -24,6 +22,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global fully_connected: event();
|
||||
|
||||
global peer_count = 0;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global proxy_count = 0;
|
||||
|
||||
event go_away()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -19,6 +18,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global proxy_count = 0;
|
||||
global q = 0;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: sort bro/config.log >bro/config.log.tmp && mv bro/config.log.tmp bro/config.log
|
||||
# @TEST-EXEC: btest-diff bro/config.log
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-canonifier | grep -v ^# | $SCRIPTS/diff-sort" btest-diff bro/config.log
|
||||
|
||||
@load base/frameworks/config
|
||||
@load base/protocols/conn
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile2 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile3 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile4 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
|
@ -103,6 +103,12 @@ event Input::end_of_data(name: string, source:string)
|
|||
|
||||
eolcount += 1;
|
||||
|
||||
if ( eolcount == 4 )
|
||||
if ( eolcount == 1 )
|
||||
system("touch got1");
|
||||
else if ( eolcount == 2 )
|
||||
system("touch got2");
|
||||
else if ( eolcount == 3 )
|
||||
system("touch got3");
|
||||
else if ( eolcount == 4 )
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run controllee BROPATH=$BROPATH:.. bro %INPUT frameworks/control/controllee Broker::default_port=65531/tcp
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: btest-bg-run controller BROPATH=$BROPATH:.. bro %INPUT test-redef frameworks/control/controller Control::host=127.0.0.1 Control::host_port=65531/tcp Control::cmd=configuration_update
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: btest-bg-run controller2 BROPATH=$BROPATH:.. bro %INPUT frameworks/control/controller Control::host=127.0.0.1 Control::host_port=65531/tcp Control::cmd=shutdown
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff controllee/.stdout
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
const test_var = "ORIGINAL VALUE (this should be printed out first)" &redef;
|
||||
|
||||
@TEST-START-FILE test-redef.bro
|
||||
|
@ -23,3 +24,8 @@ event bro_done()
|
|||
{
|
||||
print test_var;
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -75,7 +75,9 @@ event Input::end_of_data(name: string, source: string)
|
|||
print outfile, servers;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 2 )
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
# failing behavior.
|
||||
|
||||
# @TEST-EXEC: btest-bg-run bro bro %INPUT
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/init 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv does-exist.dat does-not-exist.dat
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/next 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv does-not-exist.dat does-not-exist-again.dat
|
||||
# @TEST-EXEC: echo "3 streaming still works" >> does-not-exist-again.dat
|
||||
# @TEST-EXEC: btest-bg-wait -k 3
|
||||
# @TEST-EXEC: btest-bg-wait 5
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff bro/.stdout
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff bro/.stderr
|
||||
|
||||
|
@ -31,9 +31,17 @@ type Val: record {
|
|||
line: string;
|
||||
};
|
||||
|
||||
global line_count = 0;
|
||||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, v: Val)
|
||||
{
|
||||
print fmt("%s: %s", description$name, v$line);
|
||||
++line_count;
|
||||
|
||||
if ( line_count == 4 )
|
||||
system("touch next");
|
||||
if ( line_count == 5 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
event line2(description: Input::EventDescription, tpe: Input::Event, v: Val)
|
||||
|
@ -49,4 +57,5 @@ event bro_init()
|
|||
Input::add_event([$source="../does-not-exist.dat", $name="inputmanual", $reader=Input::READER_ASCII, $mode=Input::MANUAL, $fields=Val, $ev=line, $want_record=T]);
|
||||
Input::add_event([$source="../does-not-exist.dat", $name="input2", $reader=Input::READER_ASCII, $mode=Input::REREAD, $fields=Val, $ev=line2, $want_record=T,
|
||||
$config=table(["fail_on_file_problem"] = "T")]);
|
||||
system("touch init");
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input4.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got4 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input5.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -96,7 +96,15 @@ event Input::end_of_data(name: string, source: string)
|
|||
try = try + 1;
|
||||
print outfile, fmt("Update_finished for %s, try %d", name, try);
|
||||
print outfile, servers;
|
||||
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 4 )
|
||||
system("touch got4");
|
||||
if ( try == 5 )
|
||||
{
|
||||
close(outfile);
|
||||
|
|
|
@ -7,6 +7,7 @@ redef exit_only_after_terminate = T;
|
|||
|
||||
global outfile: file;
|
||||
global processes_finished: count = 0;
|
||||
global lines_received: count = 0;
|
||||
global n: count = 0;
|
||||
global total_processes: count = 0;
|
||||
|
||||
|
@ -20,10 +21,23 @@ type Val: record {
|
|||
s: string;
|
||||
};
|
||||
|
||||
global more_input: function(name_prefix: string);
|
||||
|
||||
function check_terminate_condition()
|
||||
{
|
||||
if ( processes_finished != total_processes )
|
||||
return;
|
||||
|
||||
if ( lines_received != (total_processes - 1) * 2 )
|
||||
return;
|
||||
|
||||
terminate();
|
||||
}
|
||||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
||||
{
|
||||
print outfile, tpe, description$source, description$name;
|
||||
print outfile, s;
|
||||
++lines_received;
|
||||
print outfile, tpe, description$source, description$name, s;
|
||||
}
|
||||
|
||||
event InputRaw::process_finished(name: string, source:string, exit_code:count, signal_exit:bool)
|
||||
|
@ -31,10 +45,18 @@ event InputRaw::process_finished(name: string, source:string, exit_code:count, s
|
|||
print "process_finished", name, source;
|
||||
Input::remove(name);
|
||||
++processes_finished;
|
||||
if ( processes_finished == total_processes )
|
||||
if ( processes_finished == 1 )
|
||||
{
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
}
|
||||
else if ( processes_finished == total_processes )
|
||||
{
|
||||
close(outfile);
|
||||
terminate();
|
||||
check_terminate_condition();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,9 +81,4 @@ event bro_init()
|
|||
$reader=Input::READER_RAW, $mode=Input::STREAM,
|
||||
$name="input", $fields=Val, $ev=line, $want_record=F,
|
||||
$config=config_strings]);
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -38,12 +38,16 @@ global outfile: file;
|
|||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
||||
{
|
||||
print outfile, description;
|
||||
print outfile, description$source, description$reader, description$mode, description$name;
|
||||
print outfile, tpe;
|
||||
print outfile, s;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 8 )
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 8 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: cp input.log input2.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: echo "hi" >> input2.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff out
|
||||
|
@ -24,7 +24,9 @@ event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
|||
{
|
||||
print outfile, s;
|
||||
try = try + 1;
|
||||
if ( try == 3 )
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
{
|
||||
close(outfile);
|
||||
terminate();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# @TEST-EXEC: mkdir mydir && touch mydir/a && touch mydir/b && touch mydir/c
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -9,64 +10,59 @@ type Val: record {
|
|||
is_stderr: bool;
|
||||
};
|
||||
|
||||
global try: count;
|
||||
global try = 0;
|
||||
global n = 0;
|
||||
global outfile: file;
|
||||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string, is_stderr: bool)
|
||||
{
|
||||
print outfile, tpe;
|
||||
local line_output = fmt("%s line output (stderr=%s): ", tpe, is_stderr);
|
||||
|
||||
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";
|
||||
}
|
||||
line_output += "<stderr output contained nonexistant>";
|
||||
else
|
||||
line_output += "<unexpected/weird error localization>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print outfile, s;
|
||||
}
|
||||
print outfile, is_stderr;
|
||||
line_output += s;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 7 )
|
||||
{
|
||||
print outfile, "done";
|
||||
Input::remove("input");
|
||||
}
|
||||
print outfile, line_output;
|
||||
++try;
|
||||
|
||||
if ( n == 2 && try == 7 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
global n = 0;
|
||||
|
||||
event Input::end_of_data(name: string, source:string)
|
||||
{
|
||||
print outfile, "End of Data event";
|
||||
print outfile, name;
|
||||
print outfile, "End of Data event", name;
|
||||
++n;
|
||||
if ( n == 2 )
|
||||
|
||||
if ( n == 2 && try == 7 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
event InputRaw::process_finished(name: string, source:string, exit_code:count, signal_exit:bool)
|
||||
{
|
||||
print outfile, "Process finished event";
|
||||
print outfile, name;
|
||||
if ( exit_code != 0 )
|
||||
print outfile, "Exit code != 0";
|
||||
print outfile, "Process finished event", name, exit_code != 0;
|
||||
++n;
|
||||
if ( n == 2 )
|
||||
|
||||
if ( n == 2 && try == 7 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
|
||||
local config_strings: table[string] of string = {
|
||||
["read_stderr"] = "1"
|
||||
};
|
||||
|
||||
outfile = open("../out");
|
||||
try = 0;
|
||||
Input::add_event([$source="ls .. ../nonexistant ../nonexistant2 ../nonexistant3 |", $reader=Input::READER_RAW, $name="input", $fields=Val, $ev=line, $want_record=F, $config=config_strings, $mode=Input::STREAM]);
|
||||
Input::add_event([$source="ls ../mydir ../nonexistant ../nonexistant2 ../nonexistant3 |",
|
||||
$reader=Input::READER_RAW, $name="input",
|
||||
$fields=Val, $ev=line, $want_record=F,
|
||||
$config=config_strings, $mode=Input::STREAM]);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -37,12 +37,17 @@ global outfile: file;
|
|||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
||||
{
|
||||
print outfile, description;
|
||||
print outfile, description$source, description$reader, description$mode, description$name;
|
||||
print outfile, tpe;
|
||||
print outfile, s;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 8 )
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 8 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input4.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got4 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input5.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -126,7 +126,16 @@ event Input::end_of_data(name: string, source: string)
|
|||
print outfile, servers;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 5 )
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 4 )
|
||||
system("touch got4");
|
||||
else if ( try == 5 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -66,8 +66,12 @@ event line(description: Input::TableDescription, tpe: Input::Event, left: Idx, r
|
|||
print outfile, servers;
|
||||
|
||||
try = try + 1;
|
||||
|
||||
if ( try == 3 )
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff event.out
|
||||
|
@ -116,7 +116,9 @@ event Input::end_of_data(name: string, source: string)
|
|||
#print fin_out, servers;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 3 )
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
{
|
||||
print fin_out, "done";
|
||||
print fin_out, servers;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
|
||||
# @TEST-EXEC: btest-bg-run broproc bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait -k 5
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait -k 10
|
||||
|
@ -26,6 +25,10 @@ e@mail.com Intel::EMAIL source1 Phishing email source http://some-data-distribut
|
|||
@TEST-END-FILE
|
||||
|
||||
@load base/frameworks/control
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval=0sec;
|
||||
|
||||
module Intel;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
|
||||
# @TEST-EXEC: cp intel1.dat intel.dat
|
||||
# @TEST-EXEC: btest-bg-run broproc bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file broproc/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp intel2.dat intel.dat
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file broproc/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp intel3.dat intel.dat
|
||||
# @TEST-EXEC: btest-bg-wait 6
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: cat broproc/intel.log > output
|
||||
# @TEST-EXEC: cat broproc/notice.log >> output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
@ -35,6 +33,8 @@ redef Intel::read_files += { "../intel.dat" };
|
|||
redef enum Intel::Where += { SOMEWHERE };
|
||||
|
||||
global runs = 0;
|
||||
global entries_read = 0;
|
||||
|
||||
event do_it()
|
||||
{
|
||||
Intel::seen([$host=1.2.3.4,
|
||||
|
@ -43,8 +43,11 @@ event do_it()
|
|||
$where=SOMEWHERE]);
|
||||
|
||||
++runs;
|
||||
if ( runs < 3 )
|
||||
schedule 3sec { do_it() };
|
||||
|
||||
if ( runs == 1 )
|
||||
system("touch got1");
|
||||
if ( runs == 2 )
|
||||
system("touch got2");
|
||||
}
|
||||
|
||||
global log_lines = 0;
|
||||
|
@ -55,7 +58,17 @@ event Intel::log_intel(rec: Intel::Info)
|
|||
terminate();
|
||||
}
|
||||
|
||||
event bro_init() &priority=-10
|
||||
module Intel;
|
||||
|
||||
event Intel::read_entry(desc: Input::EventDescription, tpe: Input::Event, item: Intel::Item)
|
||||
{
|
||||
schedule 1sec { do_it() };
|
||||
++entries_read;
|
||||
print entries_read;
|
||||
|
||||
if ( entries_read == 1 )
|
||||
event do_it();
|
||||
else if ( entries_read == 3 )
|
||||
event do_it();
|
||||
else if ( entries_read == 5 )
|
||||
event do_it();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/wikipedia.trace %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: cat manager-1/reporter.log | grep -v "reporter/" > manager-reporter.log
|
||||
# @TEST-EXEC: btest-diff manager-reporter.log
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-canonifier | grep -v ^# | $SCRIPTS/diff-sort" btest-diff manager-reporter.log
|
||||
|
||||
|
||||
@TEST-START-FILE cluster-layout.bro
|
||||
|
@ -21,6 +20,10 @@ redef Cluster::nodes = {
|
|||
redef exit_only_after_terminate = T;
|
||||
@endif
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef Log::default_scope_sep="_";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/wikipedia.trace %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff manager-1/http.log
|
||||
|
@ -20,6 +19,9 @@ redef Cluster::nodes = {
|
|||
redef exit_only_after_terminate = T;
|
||||
@endif
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef Log::default_scope_sep="_";
|
||||
|
@ -59,9 +61,12 @@ event bro_init()
|
|||
{
|
||||
if ( Cluster::node == "worker-1" )
|
||||
Broker::subscribe("death");
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
if ( Cluster::node == "manager-1" )
|
||||
schedule 13sec { kill_worker() };
|
||||
schedule 2sec { kill_worker() };
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
|
|
|
@ -11,22 +11,35 @@
|
|||
@load base/frameworks/netcontrol
|
||||
|
||||
redef exit_only_after_terminate = T;
|
||||
global have_peer = F;
|
||||
global did_init = F;
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event NetControl::init()
|
||||
{
|
||||
suspend_processing();
|
||||
local netcontrol_acld = NetControl::create_acld(NetControl::AcldConfig($acld_host=127.0.0.1, $acld_port=Broker::default_port, $acld_topic="bro/event/netcontroltest"));
|
||||
NetControl::activate(netcontrol_acld, 0);
|
||||
}
|
||||
|
||||
event NetControl::init_done()
|
||||
{
|
||||
continue_processing();
|
||||
did_init = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "Broker peer added", endpoint$network;
|
||||
have_peer = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
|
|
|
@ -12,10 +12,16 @@
|
|||
@load base/frameworks/netcontrol
|
||||
|
||||
redef exit_only_after_terminate = T;
|
||||
global have_peer = F;
|
||||
global did_init = F;
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event NetControl::init()
|
||||
{
|
||||
suspend_processing();
|
||||
local netcontrol_acld = NetControl::create_acld(NetControl::AcldConfig($acld_host=127.0.0.1, $acld_port=Broker::default_port, $acld_topic="bro/event/netcontroltest"));
|
||||
NetControl::activate(netcontrol_acld, 0);
|
||||
}
|
||||
|
@ -23,11 +29,18 @@ event NetControl::init()
|
|||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "Broker peer added", endpoint$network;
|
||||
have_peer = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event NetControl::init_done()
|
||||
{
|
||||
continue_processing();
|
||||
did_init = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-pid $(cat worker-1/.pid) 10 || (btest-bg-wait -k 1 && false)
|
||||
|
||||
# @TEST-EXEC: btest-bg-run worker-2 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-2 bro --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||
|
@ -17,6 +18,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
#redef exit_only_after_terminate = T;
|
||||
|
||||
|
@ -51,9 +56,14 @@ event terminate_me() {
|
|||
terminate();
|
||||
}
|
||||
|
||||
global peers_lost = 0;
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
schedule 1sec { terminate_me() };
|
||||
++peers_lost;
|
||||
|
||||
if ( peers_lost == 2 )
|
||||
schedule 2sec { terminate_me() };
|
||||
}
|
||||
|
||||
event NetControl::rule_added(r: NetControl::Rule, p: NetControl::PluginState, msg: string &default="")
|
||||
|
|
|
@ -12,22 +12,35 @@
|
|||
@load base/frameworks/netcontrol
|
||||
|
||||
redef exit_only_after_terminate = T;
|
||||
global have_peer = F;
|
||||
global did_init = F;
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event NetControl::init()
|
||||
{
|
||||
suspend_processing();
|
||||
local netcontrol_broker = NetControl::create_broker(NetControl::BrokerConfig($host=127.0.0.1, $bport=Broker::default_port, $topic="bro/event/netcontroltest"), T);
|
||||
NetControl::activate(netcontrol_broker, 0);
|
||||
}
|
||||
|
||||
event NetControl::init_done()
|
||||
{
|
||||
continue_processing();
|
||||
did_init = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
print "Broker peer added", endpoint$network;
|
||||
have_peer = T;
|
||||
|
||||
if ( did_init && have_peer )
|
||||
continue_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff manager-1/notice.log
|
||||
|
@ -15,6 +14,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef enum Notice::Type += {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef enum Notice::Type += {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/smtp.trace %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff manager-1/openflow.log
|
||||
|
@ -13,6 +12,9 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
#redef exit_only_after_terminate = T;
|
||||
|
||||
|
@ -21,6 +23,18 @@ redef Log::default_rotation_interval = 0secs;
|
|||
|
||||
global of_controller: OpenFlow::Controller;
|
||||
|
||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
continue_processing();
|
||||
}
|
||||
@endif
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
of_controller = OpenFlow::log_new(42);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -16,6 +15,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global n = 0;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
|
@ -15,6 +14,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
event bro_init() &priority=5
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global n = 0;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -15,6 +14,9 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
event bro_init() &priority=5
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -16,6 +15,9 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,5 @@ else
|
|||
sed="sed -E"
|
||||
fi
|
||||
|
||||
# The first sed uses a "basic" regexp, the 2nd a "modern:.
|
||||
sed 's/[0-9]\{10\}\.[0-9]\{2,8\}/XXXXXXXXXX.XXXXXX/g' | \
|
||||
$sed 's/(0\.000000)|([0-9]{10}\.[0-9]{2,8})/XXXXXXXXXX.XXXXXX/g' | \
|
||||
$sed 's/^ *#(open|close).(19|20)..-..-..-..-..-..$/#\1 XXXX-XX-XX-XX-XX-XX/g'
|
||||
|
|
|
@ -143,7 +143,7 @@ run() {
|
|||
chmod 600 travis_key
|
||||
mkdir -p ~/.ssh
|
||||
mv travis_key ~/.ssh/id_rsa
|
||||
ssh-keyscan -H -p 22 -t rsa git.bro.org >> ~/.ssh/known_hosts
|
||||
echo "git.bro.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmlu+EaJfPKTVqoEUzb5JBEdvNiFxO2wm7Vl61dGBl57avakFl8YnRujbA2yxlpC2xnEKD5y++hXxtxRLefyCM=" >> ~/.ssh/known_hosts
|
||||
git clone ssh://git@git.bro.org/bro-testing-private
|
||||
rm ~/.ssh/id_rsa
|
||||
elif [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
|
||||
|
|
24
testing/scripts/wait-for-file
Executable file
24
testing/scripts/wait-for-file
Executable file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Sleeps until a file comes into existence.
|
||||
|
||||
if [[ $# -ne 2 ]]; then
|
||||
>&2 echo "usage: $0 <file to wait for> <max secs to wait>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wait_file=$1
|
||||
max_wait=$2
|
||||
wait_count=0
|
||||
|
||||
while [[ ! -e $wait_file ]]; do
|
||||
let "wait_count += 1"
|
||||
|
||||
if [[ $wait_count -ge $max_wait ]]; then
|
||||
>&2 echo "error: file '$wait_file' does not exist after $max_wait seconds"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
|
24
testing/scripts/wait-for-pid
Executable file
24
testing/scripts/wait-for-pid
Executable file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Sleeps until a process id no longer exists.
|
||||
|
||||
if [[ $# -ne 2 ]]; then
|
||||
>&2 echo "usage: $0 <pid to wait for> <max secs to wait>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wait_pid=$1
|
||||
max_wait=$2
|
||||
wait_count=0
|
||||
|
||||
while kill -0 $wait_pid &> /dev/null; do
|
||||
let "wait_count += 1"
|
||||
|
||||
if [[ $wait_count -ge $max_wait ]]; then
|
||||
>&2 echo "error: process $wait_pid still exists after $max_wait seconds"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue