mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix disappearing unit fields in Spicy type export.
When a Spicy unit type was used in an EVT event definition, it could end up being cleared out at the time the logic for `export` got to see it. Closes #3083. Note: This needs backporting to the legacy plugin.
This commit is contained in:
parent
9f8f7f5471
commit
fd86d8530b
3 changed files with 35 additions and 1 deletions
|
@ -985,7 +985,7 @@ bool GlueCompiler::PopulateEvents() {
|
|||
}
|
||||
}
|
||||
|
||||
ev.unit_type = std::move(uinfo.type.as<::spicy::type::Unit>());
|
||||
ev.unit_type = uinfo.type.as<::spicy::type::Unit>();
|
||||
ev.unit_module_id = uinfo.module_id;
|
||||
ev.unit_module_path = uinfo.module_path;
|
||||
|
||||
|
|
3
testing/btest/Baseline/spicy.export-type-e2e/output
Normal file
3
testing/btest/Baseline/spicy.export-type-e2e/output
Normal file
|
@ -0,0 +1,3 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
[x=71]
|
||||
[x=72]
|
31
testing/btest/spicy/export-type-e2e.zeek
Normal file
31
testing/btest/spicy/export-type-e2e.zeek
Normal file
|
@ -0,0 +1,31 @@
|
|||
# @TEST-REQUIRES: have-spicy
|
||||
#
|
||||
# @TEST-EXEC: spicyz -do export.hlto export.spicy export.evt
|
||||
# @TEST-EXEC: zeek -Cr $TRACES/http/pipelined-requests.trace export.hlto %INPUT >>output
|
||||
# @TEST-EXEC: test '!' -e reporter.log
|
||||
# @TEST-EXEC: btest-diff output
|
||||
#
|
||||
# @TEST-DOC: Test type export end-to-end, with access from the Zeek side. Regression test for #3083.
|
||||
|
||||
# @TEST-START-FILE export.spicy
|
||||
module foo;
|
||||
|
||||
public type X = unit {
|
||||
x: uint8;
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
# @TEST-START-FILE export.evt
|
||||
import foo;
|
||||
|
||||
protocol analyzer FOO over TCP:
|
||||
parse with foo::X,
|
||||
port 1/tcp-40000/tcp;
|
||||
|
||||
export foo::X;
|
||||
|
||||
on foo::X -> event foo::hello(self);
|
||||
# @TEST-END-FILE
|
||||
|
||||
event foo::hello(x: foo::X)
|
||||
{ print x; }
|
Loading…
Add table
Add a link
Reference in a new issue