zeek/testing/btest/spicy/list-conversion.zeek
Benjamin Bannier 8049d3a002 Speed up Spicy-related tests.
This patch changes invocations of `spicyz` and similar Spicy tools in
tests which perform compilation to use debug mode via passing `-d`. This
in turn leads to Spicy compiling generated C++ code in debug as opposed
to release mode which typically seems to require less CPU time and RAM.
For a local test running with `btest -j 16` and no caching via
`HILTI_CXX_COMPILER_LAUNCER` this sped up running of BTests under
`spicy/` by about 40s on my machine (120s vs 160s).
2023-05-25 14:59:10 +02:00

54 lines
1.2 KiB
Text

# @TEST-REQUIRES: have-spicy
#
# @TEST-EXEC: spicyz -d -o test.hlto listconv.spicy ./listconv.evt
# @TEST-EXEC: zeek -r ${TRACES}/ssh/single-conn.trace test.hlto %INPUT >output
# @TEST-EXEC: btest-diff output
@TEST-START-FILE listconv.spicy
module listconv;
public function bro_convert(a: uint8) : tuple<uint64, uint64> {
return (a, a + 1);
}
public type Test = unit {
a: uint8[5];
b: int16;
c: uint16;
};
@TEST-END-FILE
@TEST-START-FILE listconv.evt
protocol analyzer listconv over TCP:
parse originator with listconv::Test,
port 22/tcp;
on listconv::Test -> event listconv::test($conn,
$is_orig,
[listconv::bro_convert(i) for i in self.a],
self.b,
self.c
);
@TEST-END-FILE
type int_tuple: record {
a: count;
b: count;
};
event listconv::test(x: connection,
is_orig: bool,
a: vector of int_tuple,
b: int,
c: count
) {
print x$id;
print is_orig;
print a;
print b;
print c;
}