Merge remote-tracking branch 'origin/master' into topic/vladg/kerberos

This commit is contained in:
Vlad Grigorescu 2014-11-04 13:12:12 -05:00
commit 0bd45d54c8
36 changed files with 253 additions and 58 deletions

View file

@ -0,0 +1,11 @@
[zero, one, , , , five, , seven]
vec[0] = zero.exe
vec[1] = one.exe
vec[2] = <not set>
vec[3] = <not set>
vec[4] = <not set>
vec[5] = five.exe
vec[6] = <not set>
vec[7] = seven.exe
vec[8] = <not set>
vec[9] = <not set>

View file

@ -0,0 +1,38 @@
error in /Users/jsiwek/Projects/bro/bro/testing/btest/.tmp/language.when-unitialized-rhs/when-unitialized-rhs.bro, line 9: value used but not set (crashMe)
error in /Users/jsiwek/Projects/bro/bro/testing/btest/.tmp/language.when-unitialized-rhs/when-unitialized-rhs.bro, line 14: value used but not set (x)
1
2
3
4
5
6
7
8
9
10
2nd when stmt executing, 999
1st when stmt executing, not anymore you don't
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

View file

@ -0,0 +1,17 @@
# @TEST-EXEC: bro -b %INPUT >out
# @TEST-EXEC: btest-diff out
local ten = "0123456789";
local vec: vector of string = { "zero", "one" };
local n = 0;
vec[5] = "five";
vec[7] = "seven";
print vec;
vec = vec + ".exe";
for ( c in ten )
{
local is_set: bool = (n in vec);
print fmt("vec[%s] = %s", n, is_set ? vec[n] : "<not set>");
++n;
}

View file

@ -0,0 +1,32 @@
# @TEST-EXEC: bro -b -r $TRACES/wikipedia.trace %INPUT >out 2>&1
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
global crashMe: function(): string;
global x: int;
event bro_init()
{
when( local result = crashMe() )
{
print "1st when stmt executing", result;
}
when( local other_result = x )
{
print "2nd when stmt executing", other_result;
}
}
global conn_count = 0;
event new_connection(c: connection)
{
++conn_count;
print conn_count;
if ( conn_count == 10 )
{
x = 999;
crashMe = function(): string { return "not anymore you don't"; };
}
}

View file

@ -8,13 +8,25 @@
event bro_init()
{
local h1: addr = 127.0.0.1;
local h: addr = 127.0.0.1;
when ( local h1name = lookup_addr(h1) )
when ( local hname = lookup_addr(h) )
{
print "lookup successful";
terminate();
}
timeout 10sec
{
print "timeout (1)";
}
local to = 5sec;
# Just checking that timeouts can use arbitrary expressions...
when ( local hname2 = lookup_addr(h) ) {}
timeout to {}
when ( local hname3 = lookup_addr(h) ) {}
timeout to + 2sec {}
print "done";
}