mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fix bug in serialization test
This commit is contained in:
parent
bdc8e0e6c4
commit
e6464dae79
6 changed files with 58 additions and 12 deletions
|
@ -970,12 +970,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<function_ingredients> ingredients;
|
std::unique_ptr<function_ingredients> ingredients;
|
||||||
|
|
||||||
// I prefer a shared pointer here to copying. Despite the
|
|
||||||
// list being quite small most of the time, there is much
|
|
||||||
// copying that happens.
|
|
||||||
// 1 - when a function is created
|
|
||||||
// 2 - when that function is called (to create the closure)
|
|
||||||
// 2 - when a closure is cloned / serialized
|
|
||||||
id_list outer_ids;
|
id_list outer_ids;
|
||||||
std::string my_name;
|
std::string my_name;
|
||||||
};
|
};
|
||||||
|
|
|
@ -173,7 +173,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return the broker representaton, or an error if the serialization
|
* @return the broker representaton, or an error if the serialization
|
||||||
* failed.
|
* failed.
|
||||||
*/
|
*/
|
||||||
static broker::expected<broker::data> Serialize(const Frame* target, const id_list selection);
|
static broker::expected<broker::data> Serialize(const Frame* target, const id_list selection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,3 +3,24 @@ peer added
|
||||||
receiver got ping: function 2
|
receiver got ping: function 2
|
||||||
inside: 1 | outside: 11 | global: 100
|
inside: 1 | outside: 11 | global: 100
|
||||||
77
|
77
|
||||||
|
receiver got ping: function 1
|
||||||
|
begin: 100 | base_step: 2
|
||||||
|
begin: 100 | base_step: 2 | step: 76
|
||||||
|
178
|
||||||
|
receiver got ping: function 2
|
||||||
|
inside: 3 | outside: 11 | global: 100
|
||||||
|
79
|
||||||
|
receiver got ping: function 1
|
||||||
|
begin: 100 | base_step: 4
|
||||||
|
begin: 100 | base_step: 4 | step: 76
|
||||||
|
180
|
||||||
|
receiver got ping: function 2
|
||||||
|
inside: 5 | outside: 11 | global: 100
|
||||||
|
81
|
||||||
|
receiver got ping: function 1
|
||||||
|
begin: 100 | base_step: 6
|
||||||
|
begin: 100 | base_step: 6 | step: 76
|
||||||
|
182
|
||||||
|
receiver got ping: function 2
|
||||||
|
inside: 7 | outside: 11 | global: 100
|
||||||
|
83
|
||||||
|
|
|
@ -5,4 +5,27 @@ sender got pong: function 2
|
||||||
inside: 1 | outside: 11 | global: 10
|
inside: 1 | outside: 11 | global: 10
|
||||||
77
|
77
|
||||||
begin: 100 | base_step: 50
|
begin: 100 | base_step: 50
|
||||||
|
sender got pong: function 1
|
||||||
|
begin: 178 | base_step: 2
|
||||||
|
begin: 178 | base_step: 2 | step: 76
|
||||||
|
256
|
||||||
|
begin: 100 | base_step: 50
|
||||||
|
sender got pong: function 2
|
||||||
|
inside: 3 | outside: 11 | global: 10
|
||||||
|
79
|
||||||
|
begin: 100 | base_step: 50
|
||||||
|
sender got pong: function 1
|
||||||
|
begin: 180 | base_step: 4
|
||||||
|
begin: 180 | base_step: 4 | step: 76
|
||||||
|
260
|
||||||
|
begin: 100 | base_step: 50
|
||||||
|
sender got pong: function 2
|
||||||
|
inside: 5 | outside: 11 | global: 10
|
||||||
|
81
|
||||||
|
begin: 100 | base_step: 50
|
||||||
|
sender got pong: function 1
|
||||||
|
begin: 182 | base_step: 6
|
||||||
|
begin: 182 | base_step: 6 | step: 76
|
||||||
|
264
|
||||||
|
begin: 100 | base_step: 50
|
||||||
peer lost
|
peer lost
|
||||||
|
|
|
@ -6,3 +6,10 @@ expect [8, 16, 24]
|
||||||
[8, 16, 24]
|
[8, 16, 24]
|
||||||
thunder
|
thunder
|
||||||
buster
|
buster
|
||||||
|
11
|
||||||
|
12
|
||||||
|
11
|
||||||
|
0, dog
|
||||||
|
1, cat
|
||||||
|
2, fish
|
||||||
|
lookup successful
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# @TEST-PORT: BROKER_PORT
|
# @TEST-PORT: BROKER_PORT
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out"
|
|
||||||
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out"
|
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out"
|
||||||
|
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out"
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-wait 20
|
# @TEST-EXEC: btest-bg-wait 45
|
||||||
# @TEST-EXEC: btest-diff send/send.out
|
|
||||||
# @TEST-EXEC: btest-diff recv/recv.out
|
# @TEST-EXEC: btest-diff recv/recv.out
|
||||||
|
# @TEST-EXEC: btest-diff send/send.out
|
||||||
|
|
||||||
@TEST-START-FILE send.zeek
|
@TEST-START-FILE send.zeek
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ event pong(msg: string, f: myfunctype)
|
||||||
@TEST-START-FILE recv.zeek
|
@TEST-START-FILE recv.zeek
|
||||||
|
|
||||||
redef exit_only_after_terminate = T;
|
redef exit_only_after_terminate = T;
|
||||||
const events_to_recv = 3;
|
const events_to_recv = 7;
|
||||||
type myfunctype: function(c: count) : function(d: count) : count;
|
type myfunctype: function(c: count) : function(d: count) : count;
|
||||||
# type myfunctype: function(c: count);
|
# type myfunctype: function(c: count);
|
||||||
|
|
||||||
|
@ -148,13 +148,14 @@ global n = 0;
|
||||||
event ping(msg: string, f: myfunctype)
|
event ping(msg: string, f: myfunctype)
|
||||||
{
|
{
|
||||||
print fmt("receiver got ping: %s", msg);
|
print fmt("receiver got ping: %s", msg);
|
||||||
terminate();
|
|
||||||
++n;
|
++n;
|
||||||
local adder = f(n);
|
local adder = f(n);
|
||||||
print adder(76);
|
print adder(76);
|
||||||
|
|
||||||
if ( n == events_to_recv )
|
if ( n == events_to_recv )
|
||||||
|
{
|
||||||
terminate();
|
terminate();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
local e = Broker::make_event(pong, msg, f);
|
local e = Broker::make_event(pong, msg, f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue