fix some stupid, not that easy to find bugs.

Functionality seems to work completely again - including all tests passing.
This commit is contained in:
Bernhard Amann 2012-03-18 10:50:10 -07:00
parent 3286d013c9
commit bf597012f8
9 changed files with 690 additions and 314 deletions

View file

@ -0,0 +1,41 @@
#
# @TEST-EXEC: bro -b %INPUT >out
# @TEST-EXEC: btest-diff out
@TEST-START-FILE input.log
#separator \x09
#path ssh
#fields i b
#types int bool
1 T
@TEST-END-FILE
redef InputAscii::empty_field = "EMPTY";
module A;
type Idx: record {
i: int;
};
type Val: record {
b: bool;
};
global destination: table[int] of Val = table();
const one_to_32: vector of count = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32};
event bro_init()
{
for ( i in one_to_32 ) {
Input::add_table([$source="input.log", $name=fmt("input%d", i), $idx=Idx, $val=Val, $destination=destination, $want_record=F]);
Input::remove(fmt("input%d", i));
}
}
event Input::update_finished(name: string, source: string) {
print name;
print source;
print destination;
}

View file

@ -92,9 +92,13 @@ global try: count;
event line(description: Input::TableDescription, tpe: Input::Event, left: Idx, right: Val) {
print outfile, "============EVENT============";
#print outfile, description;
print outfile, "Description";
print outfile, description;
print outfile, "Type";
print outfile, tpe;
print outfile, "Left";
print outfile, left;
print outfile, "Right";
print outfile, right;
}

View file

@ -1,100 +0,0 @@
#
# @TEST-EXEC: bro %INPUT >out
# @TEST-EXEC: btest-diff out
@TEST-START-FILE input.log
#separator \x09
#path ssh
#fields i b
#types int bool
1 T
2 T
3 F
4 F
5 F
6 F
7 T
@TEST-END-FILE
redef InputAscii::empty_field = "EMPTY";
module A;
type Idx: record {
i: int;
};
type Val: record {
b: bool;
};
global destination1: table[int] of Val = table();
global destination2: table[int] of Val = table();
global done: bool = F;
event bro_init()
{
# first read in the old stuff into the table...
Input::create_stream(A::INPUT, [$source="input.log", $autostart=F]);
Input::add_tablefilter(A::INPUT, [$name="input", $idx=Idx, $val=Val, $destination=destination1, $want_record=F,
$pred(typ: Input::Event, left: Idx, right: bool) = { return right; }
]);
Input::add_tablefilter(A::INPUT, [$name="input2",$idx=Idx, $val=Val, $destination=destination2]);
Input::force_update(A::INPUT);
}
event Input::update_finished(name: string, source: string) {
if ( done == T ) {
return;
}
done = T;
if ( 1 in destination1 ) {
print "VALID";
}
if ( 2 in destination1 ) {
print "VALID";
}
if ( !(3 in destination1) ) {
print "VALID";
}
if ( !(4 in destination1) ) {
print "VALID";
}
if ( !(5 in destination1) ) {
print "VALID";
}
if ( !(6 in destination1) ) {
print "VALID";
}
if ( 7 in destination1 ) {
print "VALID";
}
print "MARK";
if ( 2 in destination2 ) {
print "VALID";
}
if ( 2 in destination2 ) {
print "VALID";
}
if ( 3 in destination2 ) {
print "VALID";
}
if ( 4 in destination2 ) {
print "VALID";
}
if ( 5 in destination2 ) {
print "VALID";
}
if ( 6 in destination2 ) {
print "VALID";
}
if ( 7 in destination2 ) {
print "VALID";
}
}