mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
fixes for specialized ZAM operations needing to check whether record fields exist
This commit is contained in:
parent
db018253fe
commit
47bf6af6a5
7 changed files with 123 additions and 13 deletions
|
@ -0,0 +1,7 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
runtime error in <...>/regress-missing-fields.zeek, line 11: field value missing ($orig_h)
|
||||
runtime error in <...>/regress-missing-fields.zeek, line 29: field value missing ($v1)
|
||||
runtime error in <...>/regress-missing-fields.zeek, line 39: field value missing ($v3)
|
||||
runtime error in <...>/regress-missing-fields.zeek, line 49: field value missing ($v4)
|
||||
runtime error in <...>/regress-missing-fields.zeek, line 64: field value missing ($vv1)
|
||||
runtime error in <...>/regress-missing-fields.zeek, line 73: field value missing ($vv2)
|
75
testing/btest/opt/regress-missing-fields.zeek
Normal file
75
testing/btest/opt/regress-missing-fields.zeek
Normal file
|
@ -0,0 +1,75 @@
|
|||
# @TEST-DOC: Regression test for specialized operations checking for missing record fields
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -O ZAM -b %INPUT >error-messages 2>&1
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff error-messages
|
||||
|
||||
@load base/utils/conn-ids.zeek
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local id: conn_id; # not initialized!
|
||||
print id_string(id);
|
||||
}
|
||||
|
||||
# Testing for ZAM specialized operation for adding multiple record fields.
|
||||
type R1: record {
|
||||
v1: count &optional;
|
||||
v2: count &optional;
|
||||
v3: count &optional;
|
||||
v4: count &optional;
|
||||
};
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local l1: R1;
|
||||
local l2: R1;
|
||||
|
||||
# Both LHS and RHS are uninitialized, so use the same fields
|
||||
# because we don't presuppose which one generates the error first.
|
||||
l2$v1 += l1$v1;
|
||||
l2$v2 += l1$v2; # We never get here
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local l1 = R1($v1 = 1);
|
||||
local l2: R1;
|
||||
|
||||
# Should report v3, since v1 is good-to-go.
|
||||
l2$v3 += l1$v1;
|
||||
l2$v2 += l1$v2; # We never get here
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local l1: R1;
|
||||
local l2 = R1($v1 = 1);
|
||||
|
||||
# Should report v4, since v1 is good-to-go.
|
||||
l2$v1 += l1$v4;
|
||||
l2$v2 += l1$v2; # We never get here
|
||||
}
|
||||
|
||||
# Testing for ZAM specialized operation for assigning multiple record fields.
|
||||
type R2: record {
|
||||
vv1: vector of count &optional;
|
||||
vv2: vector of count &optional;
|
||||
};
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local l1: R2;
|
||||
local l2: R2;
|
||||
|
||||
l2$vv1 = l1$vv1;
|
||||
l2$vv2 = l1$vv2; # We don't get here
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local l1 = R2($vv1 = vector());
|
||||
local l2: R2;
|
||||
|
||||
l2$vv1 = l1$vv1;
|
||||
l2$vv2 = l1$vv2; # We should get here, but then fail
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue