mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +00:00
Merge remote-tracking branch 'origin/master' into topic/bernhard/hyperloglog
Conflicts: src/NetVar.cc src/NetVar.h
This commit is contained in:
commit
2dd0d057e6
28 changed files with 333 additions and 87 deletions
9
testing/btest/Baseline/core.bits_per_uid/128
Normal file
9
testing/btest/Baseline/core.bits_per_uid/128
Normal file
|
@ -0,0 +1,9 @@
|
|||
CUWkUyAuUGXfarKYeMETxOg
|
||||
Ck6kgXLOoSKlnQcgTWjvg4c
|
||||
Cj4u32Pc5bifTEfuqmmG4bh
|
||||
Fj3nTWNjezo6G6xBmyo58Tf
|
||||
F4VAnSiNGSQhKEoCPd4zuQd
|
||||
CFrJExwHcSal5OKnoww6xl4
|
||||
C3PKsZ2Uye21VW0XPVINV8a
|
||||
FaJg8mtdsS86cWjSe4spPPl
|
||||
FvBr89nD30GgGAp3wgtm6qf
|
9
testing/btest/Baseline/core.bits_per_uid/256
Normal file
9
testing/btest/Baseline/core.bits_per_uid/256
Normal file
|
@ -0,0 +1,9 @@
|
|||
CUWkUyAuUGXfarKYeMETxOg
|
||||
Ck6kgXLOoSKlnQcgTWjvg4c
|
||||
Cj4u32Pc5bifTEfuqmmG4bh
|
||||
Fj3nTWNjezo6G6xBmyo58Tf
|
||||
F4VAnSiNGSQhKEoCPd4zuQd
|
||||
CFrJExwHcSal5OKnoww6xl4
|
||||
C3PKsZ2Uye21VW0XPVINV8a
|
||||
FaJg8mtdsS86cWjSe4spPPl
|
||||
FvBr89nD30GgGAp3wgtm6qf
|
9
testing/btest/Baseline/core.bits_per_uid/32
Normal file
9
testing/btest/Baseline/core.bits_per_uid/32
Normal file
|
@ -0,0 +1,9 @@
|
|||
CXWv6p30
|
||||
CCyvnA30
|
||||
CjhGID40
|
||||
F75yAm10
|
||||
FmGk6O30
|
||||
CdfHBz20
|
||||
CCvvfg30
|
||||
Fuh3fj10
|
||||
Ftwuyy30
|
9
testing/btest/Baseline/core.bits_per_uid/64
Normal file
9
testing/btest/Baseline/core.bits_per_uid/64
Normal file
|
@ -0,0 +1,9 @@
|
|||
CUWkUyAuUGXf0
|
||||
CarKYeMETxOg0
|
||||
Ck6kgXLOoSKl0
|
||||
Fj3nTWNjezo60
|
||||
F4VAnSiNGSQh0
|
||||
CnQcgTWjvg4c0
|
||||
Cj4u32Pc5bif0
|
||||
FaJg8mtdsS860
|
||||
FvBr89nD30Gg0
|
9
testing/btest/Baseline/core.bits_per_uid/96
Normal file
9
testing/btest/Baseline/core.bits_per_uid/96
Normal file
|
@ -0,0 +1,9 @@
|
|||
CXWv6p3arKYeMETxOg
|
||||
CjhGID4nQcgTWjvg4c
|
||||
CCvvfg3TEfuqmmG4bh
|
||||
F75yAm1G6xBmyo58Tf
|
||||
FmGk6O3KEoCPd4zuQd
|
||||
CsRx2w45OKnoww6xl4
|
||||
CRJuHdVW0XPVINV8a
|
||||
Fuh3fj1cWjSe4spPPl
|
||||
Ftwuyy3GAp3wgtm6qf
|
1
testing/btest/Baseline/core.global_opaque_val/output
Normal file
1
testing/btest/Baseline/core.global_opaque_val/output
Normal file
|
@ -0,0 +1 @@
|
|||
7b0391feb2e0cd271f1cf39aafb4376f
|
21
testing/btest/core/bits_per_uid.bro
Normal file
21
testing/btest/core/bits_per_uid.bro
Normal file
|
@ -0,0 +1,21 @@
|
|||
# @TEST-EXEC: bro -r $TRACES/ftp/ipv4.trace %INPUT bits_per_uid=32 >32
|
||||
# @TEST-EXEC: btest-diff 32
|
||||
# @TEST-EXEC: bro -r $TRACES/ftp/ipv4.trace %INPUT bits_per_uid=64 >64
|
||||
# @TEST-EXEC: btest-diff 64
|
||||
# @TEST-EXEC: bro -r $TRACES/ftp/ipv4.trace %INPUT bits_per_uid=96 >96
|
||||
# @TEST-EXEC: btest-diff 96
|
||||
# @TEST-EXEC: bro -r $TRACES/ftp/ipv4.trace %INPUT bits_per_uid=128 >128
|
||||
# @TEST-EXEC: btest-diff 128
|
||||
# @TEST-EXEC: bro -r $TRACES/ftp/ipv4.trace %INPUT bits_per_uid=256 >256
|
||||
# @TEST-EXEC: btest-diff 256
|
||||
# @TEST-EXEC: cmp 128 256
|
||||
|
||||
event new_connection(c: connection)
|
||||
{
|
||||
print c$uid;
|
||||
}
|
||||
|
||||
event file_new(f: fa_file)
|
||||
{
|
||||
print f$id;
|
||||
}
|
12
testing/btest/core/global_opaque_val.bro
Normal file
12
testing/btest/core/global_opaque_val.bro
Normal file
|
@ -0,0 +1,12 @@
|
|||
# @TEST-EXEC: bro -b %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
global test = md5_hash_init();
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
md5_hash_update(test, "one");
|
||||
md5_hash_update(test, "two");
|
||||
md5_hash_update(test, "three");
|
||||
print md5_hash_finish(test);
|
||||
}
|
101
testing/btest/core/leaks/bloomfilter.bro
Normal file
101
testing/btest/core/leaks/bloomfilter.bro
Normal file
|
@ -0,0 +1,101 @@
|
|||
# Needs perftools support.
|
||||
#
|
||||
# @TEST-GROUP: leaks
|
||||
#
|
||||
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
||||
#
|
||||
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro bro -m -b -r $TRACES/wikipedia.trace %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
||||
function test_basic_bloom_filter()
|
||||
{
|
||||
# Basic usage with counts.
|
||||
local bf_cnt = bloomfilter_basic_init(0.1, 1000);
|
||||
bloomfilter_add(bf_cnt, 42);
|
||||
bloomfilter_add(bf_cnt, 84);
|
||||
bloomfilter_add(bf_cnt, 168);
|
||||
print bloomfilter_lookup(bf_cnt, 0);
|
||||
print bloomfilter_lookup(bf_cnt, 42);
|
||||
print bloomfilter_lookup(bf_cnt, 168);
|
||||
print bloomfilter_lookup(bf_cnt, 336);
|
||||
bloomfilter_add(bf_cnt, 0.5); # Type mismatch
|
||||
bloomfilter_add(bf_cnt, "foo"); # Type mismatch
|
||||
|
||||
# Alternative constructor.
|
||||
local bf_dbl = bloomfilter_basic_init2(4, 10);
|
||||
bloomfilter_add(bf_dbl, 4.2);
|
||||
bloomfilter_add(bf_dbl, 3.14);
|
||||
print bloomfilter_lookup(bf_dbl, 4.2);
|
||||
print bloomfilter_lookup(bf_dbl, 3.14);
|
||||
|
||||
# Basic usage with strings.
|
||||
local bf_str = bloomfilter_basic_init(0.9, 10);
|
||||
bloomfilter_add(bf_str, "foo");
|
||||
bloomfilter_add(bf_str, "bar");
|
||||
print bloomfilter_lookup(bf_str, "foo");
|
||||
print bloomfilter_lookup(bf_str, "bar");
|
||||
print bloomfilter_lookup(bf_str, "bazzz"), "fp"; # FP
|
||||
print bloomfilter_lookup(bf_str, "quuux"), "fp"; # FP
|
||||
bloomfilter_add(bf_str, 0.5); # Type mismatch
|
||||
bloomfilter_add(bf_str, 100); # Type mismatch
|
||||
|
||||
# Edge cases.
|
||||
local bf_edge0 = bloomfilter_basic_init(0.000000000001, 1);
|
||||
local bf_edge1 = bloomfilter_basic_init(0.00000001, 100000000);
|
||||
local bf_edge2 = bloomfilter_basic_init(0.9999999, 1);
|
||||
local bf_edge3 = bloomfilter_basic_init(0.9999999, 100000000000);
|
||||
|
||||
# Invalid parameters.
|
||||
local bf_bug0 = bloomfilter_basic_init(-0.5, 42);
|
||||
local bf_bug1 = bloomfilter_basic_init(1.1, 42);
|
||||
|
||||
# Merging
|
||||
local bf_cnt2 = bloomfilter_basic_init(0.1, 1000);
|
||||
bloomfilter_add(bf_cnt2, 42);
|
||||
bloomfilter_add(bf_cnt, 100);
|
||||
local bf_merged = bloomfilter_merge(bf_cnt, bf_cnt2);
|
||||
print bloomfilter_lookup(bf_merged, 42);
|
||||
print bloomfilter_lookup(bf_merged, 84);
|
||||
print bloomfilter_lookup(bf_merged, 100);
|
||||
print bloomfilter_lookup(bf_merged, 168);
|
||||
|
||||
#empty filter tests
|
||||
local bf_empty = bloomfilter_basic_init(0.1, 1000);
|
||||
local bf_empty_merged = bloomfilter_merge(bf_merged, bf_empty);
|
||||
print bloomfilter_lookup(bf_empty_merged, 42);
|
||||
}
|
||||
|
||||
function test_counting_bloom_filter()
|
||||
{
|
||||
local bf = bloomfilter_counting_init(3, 32, 3);
|
||||
bloomfilter_add(bf, "foo");
|
||||
print bloomfilter_lookup(bf, "foo"); # 1
|
||||
bloomfilter_add(bf, "foo");
|
||||
print bloomfilter_lookup(bf, "foo"); # 2
|
||||
bloomfilter_add(bf, "foo");
|
||||
print bloomfilter_lookup(bf, "foo"); # 3
|
||||
bloomfilter_add(bf, "foo");
|
||||
print bloomfilter_lookup(bf, "foo"); # still 3
|
||||
|
||||
|
||||
bloomfilter_add(bf, "bar");
|
||||
bloomfilter_add(bf, "bar");
|
||||
print bloomfilter_lookup(bf, "bar"); # 2
|
||||
print bloomfilter_lookup(bf, "foo"); # still 3
|
||||
|
||||
# Merging
|
||||
local bf2 = bloomfilter_counting_init(3, 32, 3);
|
||||
bloomfilter_add(bf2, "baz");
|
||||
bloomfilter_add(bf2, "baz");
|
||||
bloomfilter_add(bf2, "bar");
|
||||
local bf_merged = bloomfilter_merge(bf, bf2);
|
||||
print bloomfilter_lookup(bf_merged, "foo");
|
||||
print bloomfilter_lookup(bf_merged, "bar");
|
||||
print bloomfilter_lookup(bf_merged, "baz");
|
||||
}
|
||||
|
||||
event new_connection(c: connection)
|
||||
{
|
||||
test_basic_bloom_filter();
|
||||
test_counting_bloom_filter();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue