mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/johanna/gh-375-remove-brofile-cache'
* origin/topic/johanna/gh-375-remove-brofile-cache: Remove the BroFile cache Fixes GH-375
This commit is contained in:
commit
dafc44e8b9
18 changed files with 62 additions and 321 deletions
|
@ -1,4 +0,0 @@
|
|||
opened
|
||||
write 0
|
||||
write 3
|
||||
write 6
|
|
@ -1,4 +0,0 @@
|
|||
opened
|
||||
write 1
|
||||
write 4
|
||||
write 7
|
|
@ -1,4 +0,0 @@
|
|||
opened
|
||||
write 2
|
||||
write 5
|
||||
write 8
|
|
@ -1,6 +0,0 @@
|
|||
opened
|
||||
write 0
|
||||
opened
|
||||
write 3
|
||||
opened
|
||||
write 6
|
|
@ -1,6 +0,0 @@
|
|||
opened
|
||||
write 1
|
||||
opened
|
||||
write 4
|
||||
opened
|
||||
write 7
|
|
@ -1,6 +0,0 @@
|
|||
opened
|
||||
write 2
|
||||
opened
|
||||
write 5
|
||||
opened
|
||||
write 8
|
|
@ -1,49 +0,0 @@
|
|||
# This checks that the interactions between open-file caching and
|
||||
# cloning works ok. In the first case, all files can fit
|
||||
# in the cache, but get cloned before every write. In the
|
||||
# second case, files are eventually forced out of the cache; later writing
|
||||
# requires re-opening.
|
||||
|
||||
# @TEST-EXEC: zeek -b %INPUT "test_file_prefix=one"
|
||||
# @TEST-EXEC: btest-diff one0
|
||||
# @TEST-EXEC: btest-diff one1
|
||||
# @TEST-EXEC: btest-diff one2
|
||||
# @TEST-EXEC: zeek -b %INPUT "test_file_prefix=two" "max_files_in_cache=2"
|
||||
# @TEST-EXEC: btest-diff two0
|
||||
# @TEST-EXEC: btest-diff two1
|
||||
# @TEST-EXEC: btest-diff two2
|
||||
|
||||
const test_file_prefix = "" &redef;
|
||||
global file_table: table[string] of file;
|
||||
global iterations: vector of count = vector(0,1,2,3,4,5,6,7,8);
|
||||
|
||||
function write_to_file(c: count)
|
||||
{
|
||||
local f: file;
|
||||
# Take turns writing across three output files.
|
||||
local filename = fmt("%s%s", test_file_prefix, c % 3 );
|
||||
|
||||
if ( filename in file_table )
|
||||
f = file_table[filename];
|
||||
else
|
||||
{
|
||||
f = open(filename);
|
||||
file_table[filename] = f;
|
||||
}
|
||||
|
||||
# This when block is a trick to get the frame cloned
|
||||
# and thus serialize the local file value
|
||||
when ( local s = fmt("write %d", c) )
|
||||
print f, s;
|
||||
}
|
||||
|
||||
event file_opened(f: file)
|
||||
{
|
||||
print f, "opened";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
for ( i in iterations )
|
||||
write_to_file(iterations[i]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue