zeek/testing/btest/spicy/import-from.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

57 lines
949 B
Text

# @TEST-REQUIRES: have-spicy
#
# @TEST-EXEC: mkdir -p a/b/c && mv y.spicy a/b/c
# @TEST-EXEC: spicyz -d -o test.hlto ssh.spicy ./ssh.evt
# @TEST-EXEC: zeek -r ${TRACES}/ssh/single-conn.trace test.hlto %INPUT >output
# @TEST-EXEC: btest-diff output
event ssh::test(x: string, y: string)
{
print x, y;
}
# @TEST-START-FILE ssh.spicy
module SSH;
public type Banner = unit {
%port = 22/tcp;
magic : /SSH-/;
version : /[^-]*/;
dash : /-/;
software: /[^\r\n]*/;
on %done {}
};
# @TEST-END-FILE
# @TEST-START-FILE x.spicy
module X;
public function x() : string {
return "Foo::x";
}
# @TEST-END-FILE
# @TEST-START-FILE y.spicy
module Y;
public function y() : string {
return "Foo::y";
}
# @TEST-END-FILE
# @TEST-START-FILE ssh.evt
protocol analyzer spicy::SSH over TCP:
parse with SSH::Banner;
import X;
import Y from a.b.c;
on SSH::Banner -> event ssh::test(X::x(), Y::y());
# @TEST-END-FILE