mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath: Add the Stream record to Log:active_streams to make more dynamic logging possible. Fix portability of printing to files returned by open("/dev/stderr"). Fix mime type diff canonifier to also skip mime_desc columns Unit test tweaks/fixes. Fix memory leak of serialized IDs when compiled with --enable-debug. One tweak to the open() change: make sure we don't try to rotate the special files.
This commit is contained in:
commit
0f663ca813
23 changed files with 211 additions and 70 deletions
23
CHANGES
23
CHANGES
|
@ -1,4 +1,27 @@
|
||||||
|
|
||||||
|
2.1-beta-27 | 2012-08-20 20:06:20 -0700
|
||||||
|
|
||||||
|
* Add the Stream record to Log:active_streams to make more dynamic
|
||||||
|
logging possible. (Seth Hall)
|
||||||
|
|
||||||
|
* Fix portability of printing to files returned by
|
||||||
|
open("/dev/stderr"). (Jon Siwek)
|
||||||
|
|
||||||
|
* Fix mime type diff canonifier to also skip mime_desc columns. (Jon
|
||||||
|
Siwek)
|
||||||
|
|
||||||
|
* Unit test tweaks/fixes. (Jon Siwek)
|
||||||
|
|
||||||
|
- Some baselines for tests in "leaks" group were outdated.
|
||||||
|
|
||||||
|
- Changed a few of the cluster/communication tests to terminate
|
||||||
|
more explicitly instead of relying on btest-bg-wait to kill
|
||||||
|
processes. This makes the tests finish faster in the success case
|
||||||
|
and makes the reason for failing clearer in the that case.
|
||||||
|
|
||||||
|
* Fix memory leak of serialized IDs when compiled with
|
||||||
|
--enable-debug. (Jon Siwek)
|
||||||
|
|
||||||
2.1-beta-21 | 2012-08-16 11:48:56 -0700
|
2.1-beta-21 | 2012-08-16 11:48:56 -0700
|
||||||
|
|
||||||
* Installing a handler for running out of memory in "new". Bro will
|
* Installing a handler for running out of memory in "new". Bro will
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.1-beta-21
|
2.1-beta-27
|
||||||
|
|
|
@ -329,9 +329,9 @@ export {
|
||||||
global run_rotation_postprocessor_cmd: function(info: RotationInfo, npath: string) : bool;
|
global run_rotation_postprocessor_cmd: function(info: RotationInfo, npath: string) : bool;
|
||||||
|
|
||||||
## The streams which are currently active and not disabled.
|
## The streams which are currently active and not disabled.
|
||||||
## This set is not meant to be modified by users! Only use it for
|
## This table is not meant to be modified by users! Only use it for
|
||||||
## examining which streams are active.
|
## examining which streams are active.
|
||||||
global active_streams: set[ID] = set();
|
global active_streams: table[ID] of Stream = table();
|
||||||
}
|
}
|
||||||
|
|
||||||
# We keep a script-level copy of all filters so that we can manipulate them.
|
# We keep a script-level copy of all filters so that we can manipulate them.
|
||||||
|
@ -417,7 +417,7 @@ function create_stream(id: ID, stream: Stream) : bool
|
||||||
if ( ! __create_stream(id, stream) )
|
if ( ! __create_stream(id, stream) )
|
||||||
return F;
|
return F;
|
||||||
|
|
||||||
add active_streams[id];
|
active_streams[id] = stream;
|
||||||
|
|
||||||
return add_default_filter(id);
|
return add_default_filter(id);
|
||||||
}
|
}
|
||||||
|
|
23
src/File.cc
23
src/File.cc
|
@ -138,11 +138,22 @@ BroFile::BroFile(FILE* arg_f, const char* arg_name, const char* arg_access)
|
||||||
BroFile::BroFile(const char* arg_name, const char* arg_access, BroType* arg_t)
|
BroFile::BroFile(const char* arg_name, const char* arg_access, BroType* arg_t)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
f = 0;
|
||||||
name = copy_string(arg_name);
|
name = copy_string(arg_name);
|
||||||
access = copy_string(arg_access);
|
access = copy_string(arg_access);
|
||||||
t = arg_t ? arg_t : base_type(TYPE_STRING);
|
t = arg_t ? arg_t : base_type(TYPE_STRING);
|
||||||
if ( ! Open() )
|
|
||||||
|
if ( streq(name, "/dev/stdin") )
|
||||||
|
f = stdin;
|
||||||
|
else if ( streq(name, "/dev/stdout") )
|
||||||
|
f = stdout;
|
||||||
|
else if ( streq(name, "/dev/stderr") )
|
||||||
|
f = stderr;
|
||||||
|
|
||||||
|
if ( f )
|
||||||
|
is_open = 1;
|
||||||
|
|
||||||
|
else if ( ! Open() )
|
||||||
{
|
{
|
||||||
reporter->Error("cannot open %s: %s", name, strerror(errno));
|
reporter->Error("cannot open %s: %s", name, strerror(errno));
|
||||||
is_open = 0;
|
is_open = 0;
|
||||||
|
@ -342,8 +353,8 @@ int BroFile::Close()
|
||||||
|
|
||||||
FinishEncrypt();
|
FinishEncrypt();
|
||||||
|
|
||||||
// Do not close stdout/stderr.
|
// Do not close stdin/stdout/stderr.
|
||||||
if ( f == stdout || f == stderr )
|
if ( f == stdin || f == stdout || f == stderr )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( is_in_cache )
|
if ( is_in_cache )
|
||||||
|
@ -523,6 +534,10 @@ RecordVal* BroFile::Rotate()
|
||||||
if ( ! is_open )
|
if ( ! is_open )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Do not rotate stdin/stdout/stderr.
|
||||||
|
if ( f == stdin || f == stdout || f == stderr )
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ( okay_to_manage && ! is_in_cache )
|
if ( okay_to_manage && ! is_in_cache )
|
||||||
BringIntoCache();
|
BringIntoCache();
|
||||||
|
|
||||||
|
|
|
@ -2897,11 +2897,6 @@ void RemoteSerializer::GotID(ID* id, Val* val)
|
||||||
(desc && *desc) ? desc : "not set"),
|
(desc && *desc) ? desc : "not set"),
|
||||||
current_peer);
|
current_peer);
|
||||||
|
|
||||||
#ifdef USE_PERFTOOLS_DEBUG
|
|
||||||
// May still be cached, but we don't care.
|
|
||||||
heap_checker->IgnoreObject(id);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Unref(id);
|
Unref(id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ Val::~Val()
|
||||||
|
|
||||||
Unref(type);
|
Unref(type);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Unref(bound_id);
|
delete [] bound_id;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/Val.h
16
src/Val.h
|
@ -347,13 +347,15 @@ public:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// For debugging, we keep a reference to the global ID to which a
|
// For debugging, we keep a reference to the global ID to which a
|
||||||
// value has been bound *last*.
|
// value has been bound *last*.
|
||||||
ID* GetID() const { return bound_id; }
|
ID* GetID() const
|
||||||
|
{
|
||||||
|
return bound_id ? global_scope()->Lookup(bound_id) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
void SetID(ID* id)
|
void SetID(ID* id)
|
||||||
{
|
{
|
||||||
if ( bound_id )
|
delete [] bound_id;
|
||||||
::Unref(bound_id);
|
bound_id = id ? copy_string(id->Name()) : 0;
|
||||||
bound_id = id;
|
|
||||||
::Ref(bound_id);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -401,8 +403,8 @@ protected:
|
||||||
RecordVal* attribs;
|
RecordVal* attribs;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// For debugging, we keep the ID to which a Val is bound.
|
// For debugging, we keep the name of the ID to which a Val is bound.
|
||||||
ID* bound_id;
|
const char* bound_id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path metrics
|
#path metrics
|
||||||
|
#open 2012-07-20-01-50-41
|
||||||
#fields ts metric_id filter_name index.host index.str index.network value
|
#fields ts metric_id filter_name index.host index.str index.network value
|
||||||
#types time enum string addr string subnet count
|
#types time enum string addr string subnet count
|
||||||
1331256494.591966 TEST_METRIC foo-bar 6.5.4.3 - - 4
|
1342749041.601712 TEST_METRIC foo-bar 6.5.4.3 - - 4
|
||||||
1331256494.591966 TEST_METRIC foo-bar 7.2.1.5 - - 2
|
1342749041.601712 TEST_METRIC foo-bar 7.2.1.5 - - 2
|
||||||
1331256494.591966 TEST_METRIC foo-bar 1.2.3.4 - - 6
|
1342749041.601712 TEST_METRIC foo-bar 1.2.3.4 - - 6
|
||||||
|
#close 2012-07-20-01-50-49
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path test.failure
|
#path test.failure
|
||||||
|
#open 2012-07-20-01-50-18
|
||||||
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
||||||
#types time addr port addr port string string
|
#types time addr port addr port string string
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure US
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure US
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure UK
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure UK
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure MX
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure MX
|
||||||
|
#close 2012-07-20-01-50-18
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path test
|
#path test
|
||||||
|
#open 2012-07-20-01-50-18
|
||||||
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
||||||
#types time addr port addr port string string
|
#types time addr port addr port string string
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success unknown
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success unknown
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure US
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure US
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure UK
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure UK
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success BR
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success BR
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 failure MX
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 failure MX
|
||||||
|
#close 2012-07-20-01-50-18
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path test.success
|
#path test.success
|
||||||
|
#open 2012-07-20-01-50-18
|
||||||
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
#fields t id.orig_h id.orig_p id.resp_h id.resp_p status country
|
||||||
#types time addr port addr port string string
|
#types time addr port addr port string string
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success unknown
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success unknown
|
||||||
1331256472.375609 1.2.3.4 1234 2.3.4.5 80 success BR
|
1342749018.970682 1.2.3.4 1234 2.3.4.5 80 success BR
|
||||||
|
#close 2012-07-20-01-50-18
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
ERROR: no such index (a[1]) (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter-error-in-handler/reporter-error-in-handler.bro, line 28)
|
error in /home/jsiwek/bro/testing/btest/.tmp/core.reporter-error-in-handler/reporter-error-in-handler.bro, line 22: no such index (a[2])
|
||||||
|
ERROR: no such index (a[1]) (/home/jsiwek/bro/testing/btest/.tmp/core.reporter-error-in-handler/reporter-error-in-handler.bro, line 28)
|
||||||
1st error printed on script level
|
1st error printed on script level
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
ERROR: no such index (a[2]) (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter-runtime-error/reporter-runtime-error.bro, line 9)
|
error in /home/jsiwek/bro/testing/btest/.tmp/core.reporter-runtime-error/reporter-runtime-error.bro, line 12: no such index (a[1])
|
||||||
|
ERROR: no such index (a[2]) (/home/jsiwek/bro/testing/btest/.tmp/core.reporter-runtime-error/reporter-runtime-error.bro, line 9)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
reporter_info|init test-info|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 8|0.000000
|
reporter_info|init test-info|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 8|0.000000
|
||||||
reporter_warning|init test-warning|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 9|0.000000
|
reporter_warning|init test-warning|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 9|0.000000
|
||||||
reporter_error|init test-error|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 10|0.000000
|
reporter_error|init test-error|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 10|0.000000
|
||||||
reporter_info|done test-info|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 15|0.000000
|
reporter_info|done test-info|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 15|0.000000
|
||||||
reporter_warning|done test-warning|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 16|0.000000
|
reporter_warning|done test-warning|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 16|0.000000
|
||||||
reporter_error|done test-error|/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 17|0.000000
|
reporter_error|done test-error|/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 17|0.000000
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
WARNING: init test-warning (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 9)
|
/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 52: pre test-info
|
||||||
ERROR: init test-error (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 10)
|
warning in /home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 53: pre test-warning
|
||||||
WARNING: done test-warning (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 16)
|
error in /home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 54: pre test-error
|
||||||
ERROR: done test-error (/da/home/robin/bro/master/testing/btest/.tmp/core.reporter/reporter.bro, line 17)
|
WARNING: init test-warning (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 9)
|
||||||
|
ERROR: init test-error (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 10)
|
||||||
|
WARNING: done test-warning (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 16)
|
||||||
|
ERROR: done test-error (/home/jsiwek/bro/testing/btest/.tmp/core.reporter/reporter.bro, line 17)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
error: unknown writer type requested
|
|
@ -9,7 +9,7 @@
|
||||||
# @TEST-EXEC: sleep 1
|
# @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 -r $TRACES/web.trace --pseudo-realtime %INPUT
|
# @TEST-EXEC: btest-bg-run worker-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -m -r $TRACES/web.trace --pseudo-realtime %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m -r $TRACES/web.trace --pseudo-realtime %INPUT
|
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m -r $TRACES/web.trace --pseudo-realtime %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait -k 30
|
# @TEST-EXEC: btest-bg-wait 40
|
||||||
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -40,3 +40,24 @@ event bro_init() &priority=5
|
||||||
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
|
||||||
|
global n = 0;
|
||||||
|
|
||||||
|
event Metrics::log_metrics(rec: Metrics::Info)
|
||||||
|
{
|
||||||
|
n = n + 1;
|
||||||
|
if ( n == 3 )
|
||||||
|
{
|
||||||
|
terminate_communication();
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
|
@ -4,17 +4,19 @@
|
||||||
#
|
#
|
||||||
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run sender HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -m --pseudo-realtime %INPUT ../sender.bro
|
# @TEST-EXEC: btest-bg-run sender HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -b -m --pseudo-realtime %INPUT ../sender.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-run receiver HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -m --pseudo-realtime %INPUT ../receiver.bro
|
# @TEST-EXEC: btest-bg-run receiver HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local bro -b -m --pseudo-realtime %INPUT ../receiver.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 30
|
||||||
# @TEST-EXEC: btest-diff sender/test.log
|
# @TEST-EXEC: btest-diff sender/test.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.failure.log
|
# @TEST-EXEC: btest-diff sender/test.failure.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.success.log
|
# @TEST-EXEC: btest-diff sender/test.success.log
|
||||||
# @TEST-EXEC: cmp receiver/test.log sender/test.log
|
# @TEST-EXEC: ( cd sender && for i in *.log; do cat $i | $SCRIPTS/diff-remove-timestamps >c.$i; done )
|
||||||
# @TEST-EXEC: cmp receiver/test.failure.log sender/test.failure.log
|
# @TEST-EXEC: ( cd receiver && for i in *.log; do cat $i | $SCRIPTS/diff-remove-timestamps >c.$i; done )
|
||||||
# @TEST-EXEC: cmp receiver/test.success.log sender/test.success.log
|
# @TEST-EXEC: cmp receiver/c.test.log sender/c.test.log
|
||||||
|
# @TEST-EXEC: cmp receiver/c.test.failure.log sender/c.test.failure.log
|
||||||
|
# @TEST-EXEC: cmp receiver/c.test.success.log sender/c.test.success.log
|
||||||
|
|
||||||
# This is the common part loaded by both sender and receiver.
|
# This is the common part loaded by both sender and receiver.
|
||||||
module Test;
|
module Test;
|
||||||
|
@ -43,10 +45,10 @@ event bro_init()
|
||||||
|
|
||||||
@TEST-START-FILE sender.bro
|
@TEST-START-FILE sender.bro
|
||||||
|
|
||||||
module Test;
|
|
||||||
|
|
||||||
@load frameworks/communication/listen
|
@load frameworks/communication/listen
|
||||||
|
|
||||||
|
module Test;
|
||||||
|
|
||||||
function fail(rec: Log): bool
|
function fail(rec: Log): bool
|
||||||
{
|
{
|
||||||
return rec$status != "success";
|
return rec$status != "success";
|
||||||
|
@ -68,14 +70,27 @@ event remote_connection_handshake_done(p: event_peer)
|
||||||
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
||||||
disconnect(p);
|
disconnect(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
@TEST-START-FILE receiver.bro
|
@TEST-START-FILE receiver.bro
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
@load base/frameworks/communication
|
||||||
|
|
||||||
redef Communication::nodes += {
|
redef Communication::nodes += {
|
||||||
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
|
@ -10,4 +10,5 @@
|
||||||
# @TEST-EXEC: test -d $DIST/scripts
|
# @TEST-EXEC: test -d $DIST/scripts
|
||||||
# @TEST-EXEC: for script in `find $DIST/scripts -name \*\.bro -not -path '*/site/*'`; do echo $script; if echo "$script" | egrep -q 'communication/listen|controllee'; then rm -rf load_attempt .bgprocs; btest-bg-run load_attempt bro -b $script; btest-bg-wait -k 2; cat load_attempt/.stderr >>allerrors; else bro -b $script 2>>allerrors; fi done || exit 0
|
# @TEST-EXEC: for script in `find $DIST/scripts -name \*\.bro -not -path '*/site/*'`; do echo $script; if echo "$script" | egrep -q 'communication/listen|controllee'; then rm -rf load_attempt .bgprocs; btest-bg-run load_attempt bro -b $script; btest-bg-wait -k 2; cat load_attempt/.stderr >>allerrors; else bro -b $script 2>>allerrors; fi done || exit 0
|
||||||
# @TEST-EXEC: cat allerrors | grep -v "received termination signal" | sort | uniq > unique_errors
|
# @TEST-EXEC: cat allerrors | grep -v "received termination signal" | sort | uniq > unique_errors
|
||||||
# @TEST-EXEC: btest-diff unique_errors
|
# @TEST-EXEC: if [ $(grep -c CURL_INCLUDE_DIR-NOTFOUND $BUILD/CMakeCache.txt) -ne 0 ]; then cp unique_errors unique_errors_no_elasticsearch; fi
|
||||||
|
# @TEST-EXEC: if [ $(grep -c CURL_INCLUDE_DIR-NOTFOUND $BUILD/CMakeCache.txt) -ne 0 ]; then btest-diff unique_errors_no_elasticsearch; else btest-diff unique_errors; fi
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# @TEST-SERIALIZE: comm
|
# @TEST-SERIALIZE: comm
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run sender bro --pseudo-realtime %INPUT ../sender.bro
|
# @TEST-EXEC: btest-bg-run sender bro -b --pseudo-realtime %INPUT ../sender.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-run receiver bro --pseudo-realtime %INPUT ../receiver.bro
|
# @TEST-EXEC: btest-bg-run receiver bro -b --pseudo-realtime %INPUT ../receiver.bro
|
||||||
# @TEST-EXEC: sleep 1
|
# @TEST-EXEC: sleep 1
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 15
|
||||||
# @TEST-EXEC: btest-diff sender/test.log
|
# @TEST-EXEC: btest-diff sender/test.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.failure.log
|
# @TEST-EXEC: btest-diff sender/test.failure.log
|
||||||
# @TEST-EXEC: btest-diff sender/test.success.log
|
# @TEST-EXEC: btest-diff sender/test.success.log
|
||||||
|
@ -41,10 +41,10 @@ event bro_init()
|
||||||
|
|
||||||
@TEST-START-FILE sender.bro
|
@TEST-START-FILE sender.bro
|
||||||
|
|
||||||
module Test;
|
|
||||||
|
|
||||||
@load frameworks/communication/listen
|
@load frameworks/communication/listen
|
||||||
|
|
||||||
|
module Test;
|
||||||
|
|
||||||
function fail(rec: Log): bool
|
function fail(rec: Log): bool
|
||||||
{
|
{
|
||||||
return rec$status != "success";
|
return rec$status != "success";
|
||||||
|
@ -66,14 +66,27 @@ event remote_connection_handshake_done(p: event_peer)
|
||||||
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
Log::write(Test::LOG, [$t=network_time(), $id=cid, $status="failure", $country="MX"]);
|
||||||
disconnect(p);
|
disconnect(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
@TEST-START-FILE receiver.bro
|
@TEST-START-FILE receiver.bro
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
@load base/frameworks/communication
|
||||||
|
|
||||||
redef Communication::nodes += {
|
redef Communication::nodes += {
|
||||||
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
["foo"] = [$host = 127.0.0.1, $connect=T, $request_logs=T]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# @TEST-EXEC: sleep 1
|
# @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-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-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 20
|
||||||
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
# @TEST-EXEC: btest-diff manager-1/metrics.log
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -36,3 +36,24 @@ event bro_init() &priority=5
|
||||||
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
Metrics::add_data(TEST_METRIC, [$host=7.2.1.5], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
|
||||||
|
global n = 0;
|
||||||
|
|
||||||
|
event Metrics::log_metrics(rec: Metrics::Info)
|
||||||
|
{
|
||||||
|
n = n + 1;
|
||||||
|
if ( n == 3 )
|
||||||
|
{
|
||||||
|
terminate_communication();
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# @TEST-EXEC: sleep 1
|
# @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-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-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait -k 10
|
# @TEST-EXEC: btest-bg-wait 20
|
||||||
# @TEST-EXEC: btest-diff manager-1/notice.log
|
# @TEST-EXEC: btest-diff manager-1/notice.log
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -37,6 +37,21 @@ event bro_init() &priority=5
|
||||||
$log=T]);
|
$log=T]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event remote_connection_closed(p: event_peer)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
|
||||||
|
event Notice::log_notice(rec: Notice::Info)
|
||||||
|
{
|
||||||
|
terminate_communication();
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||||
|
|
||||||
event do_metrics(i: count)
|
event do_metrics(i: count)
|
||||||
|
|
|
@ -3,20 +3,27 @@
|
||||||
# A diff canonifier that removes all MIME types because libmagic output
|
# A diff canonifier that removes all MIME types because libmagic output
|
||||||
# can differ between installations.
|
# can differ between installations.
|
||||||
|
|
||||||
BEGIN { FS="\t"; OFS="\t"; column = -1; }
|
BEGIN { FS="\t"; OFS="\t"; type_col = -1; desc_col = -1 }
|
||||||
|
|
||||||
/^#fields/ {
|
/^#fields/ {
|
||||||
for ( i = 2; i < NF; ++i )
|
for ( i = 2; i < NF; ++i )
|
||||||
|
{
|
||||||
if ( $i == "mime_type" )
|
if ( $i == "mime_type" )
|
||||||
column = i-1;
|
type_col = i-1;
|
||||||
|
if ( $i == "mime_desc" )
|
||||||
|
desc_col = i-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
column >= 0 {
|
function remove_mime (n) {
|
||||||
if ( $column != "-" )
|
if ( n >= 0 && $n != "-" )
|
||||||
# Mark that it's set, but ignore content.
|
# Mark that it's set, but ignore content.
|
||||||
$column = "+";
|
$n = "+"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_mime(type_col)
|
||||||
|
remove_mime(desc_col)
|
||||||
|
|
||||||
{
|
{
|
||||||
print;
|
print;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue