determinism for concurrent Zeek test suite invocations; split out deprecations

This commit is contained in:
Vern Paxson 2021-03-18 16:17:25 -07:00
parent ef3eaed3fb
commit a808e166a4
14 changed files with 156 additions and 61 deletions

View file

@ -0,0 +1,12 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
reference capture
4, 10
6, 8
7, 7
reference double capture
4
2, 10, 47
4
2, 8, 47
3
1, 7, 47

View file

@ -1,43 +1,42 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
4, 10
6, 8
7, 7
shallow copy
4, 10
5, 8
6, 7
deep copy
4, 10
5, 9
6, 8
mixed copy, case 1
4, 10
5, 8
6, 7
mixed copy, case 2
4, 10
5, 9
6, 8
4
2, 10, 47
4
2, 8, 47
3
1, 7, 47
double shallow copy
4
2, 10, 47
5
3, 8, 47
6
4, 7, 47
double deep copy, case 1
4
2, 10, 47
5
3, 9, 47
6
4, 8, 47
double deep copy, case 2
4
2, 10, 91
5
3, 9, 91
6
4, 9, 91
double deep copy, case 3
4
2, 10, 91
5

View file

@ -0,0 +1,27 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
hello :-)
peer added
receiver got ping: function 2
inside: 1 | outside: 12 | global: 100
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: 12 | 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: 12 | 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: 12 | global: 100
83

View file

@ -0,0 +1,32 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
hello :)
peer added
begin: 100 | base_step: 50
sender got pong: function 2
inside: 1 | outside: 12 | global: 10
77
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: 12 | 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: 12 | 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

View file

@ -1,6 +1,6 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
warning in <...>/uninitialized-local3.zeek, line 33: possibly used without definition (x4)
expression error in <...>/uninitialized-local3.zeek, line 33: value used but not set (x4)
warning in <...>/uninitialized-local3.zeek, line 38: possibly used without definition (x4)
expression error in <...>/uninitialized-local3.zeek, line 38: value used but not set (x4)
x$a (x <...>/uninitialized-local3.zeek, line 20) possibly used without being set
x$e (x <...>/uninitialized-local3.zeek, line 20) possibly used without being set
x$e (x <...>/uninitialized-local3.zeek, line 24) possibly used without being set

View file

@ -1,7 +1,7 @@
#
# In "normal" test mode, connection uids should be determistic.
#
# @TEST-EXEC: zeek -b -C -r $TRACES/wikipedia.trace %INPUT >output
# @TEST-EXEC: zeek -b -D -C -r $TRACES/wikipedia.trace %INPUT >output
# @TEST-EXEC: btest-diff output
#
# Without a seed, they should differ each time:

View file

@ -0,0 +1,47 @@
# @TEST-EXEC: zeek -b %INPUT >out
# @TEST-EXEC: btest-diff out
type mutable_aggregate: record { x: count; };
function reference_capture() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() { print ++a, --b$x; };
f();
++a;
--b$x;
f();
return f;
}
function reference_capture_double() : function() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() : function() {
local c = mutable_aggregate($x=88);
print ++a;
local f2 = function() { print a -= 2, --b$x, c$x += 3; };
c$x = c$x / 2;
return f2;
};
f()();
++a;
--b$x;
f()();
return f;
}
event zeek_init()
{
print "reference capture";
local rc = reference_capture();
rc();
print "reference double capture";
local rc2 = reference_capture_double();
rc2()();
}

View file

@ -3,19 +3,6 @@
type mutable_aggregate: record { x: count; };
function reference_capture() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() { print ++a, --b$x; };
f();
++a;
--b$x;
f();
return f;
}
function shallow_copy_capture() : function()
{
local a = 3;
@ -68,25 +55,6 @@ function mixed_copy_capture_b() : function()
return f;
}
function reference_capture_double() : function() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() : function() {
local c = mutable_aggregate($x=88);
print ++a;
local f2 = function() { print a -= 2, --b$x, c$x += 3; };
c$x = c$x / 2;
return f2;
};
f()();
++a;
--b$x;
f()();
return f;
}
function shallow_copy_capture_double() : function() : function()
{
local a = 3;
@ -167,33 +135,35 @@ function deep_copy3_capture_double() : function() : function()
event zeek_init()
{
local rc = reference_capture();
rc();
print "shallow copy";
local scc = shallow_copy_capture();
scc();
print "deep copy";
local dcc = deep_copy_capture();
dcc();
print "mixed copy, case 1";
local mcca = mixed_copy_capture_a();
mcca();
print "mixed copy, case 2";
local mccb = mixed_copy_capture_b();
mccb();
local rc2 = reference_capture_double();
rc2()();
print "double shallow copy";
local scc2 = shallow_copy_capture_double();
scc2()();
print "double deep copy, case 1";
local dcc2_1 = deep_copy1_capture_double();
dcc2_1()();
print "double deep copy, case 2";
local dcc2_2 = deep_copy2_capture_double();
dcc2_2()();
print "double deep copy, case 3";
local dcc2_3 = deep_copy3_capture_double();
dcc2_3()();
}

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT
#
# @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-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
#
# @TEST-EXEC: btest-bg-wait 45
# @TEST-EXEC: btest-diff recv/recv.out

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT
#
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out 2>recv.error"
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out"
# @TEST-EXEC: btest-bg-run recv "zeek -D -B broker -b ../recv.zeek >recv.out 2>recv.error"
# @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
#
# @TEST-EXEC: btest-bg-wait 20
# @TEST-EXEC: btest-diff recv/recv.error

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT
#
# @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-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
#
# @TEST-EXEC: btest-bg-wait 45
# @TEST-EXEC: btest-diff recv/recv.out

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT
#
# @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-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
#
# @TEST-EXEC: btest-bg-wait 20
# @TEST-EXEC: btest-diff recv/recv.out

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT
#
# @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-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
#
# @TEST-EXEC: btest-bg-wait 45
# @TEST-EXEC: btest-diff recv/recv.out

View file

@ -30,5 +30,13 @@ event zeek_init()
print x3;
local x4: count;
print x4; # note, no execution after this point due to error
# note, no execution after this point due to error
# We use this slightly baroque expression because compiled code
# may have x4 genuinely uninitialized, and we want deterministic
# output in that case.
if ( x4 > 5 )
print T;
else
print T;
}