zeek/testing/btest/spicy/replaces-conflicts.evt
Arne Welzel bae15230bb btest/spicy: Make replaces-conflicts trigger replaces code path
The current test attempts to instantiate two spicy::SSH_1 protocol
analyzers in the .evt file. The intention likely was to use two
distinct protocol analyzer both trying to replace the builtin SSH
analyzer.

Coincidentally, fixing this happens to workaround TSAN errors tickled
by the FatalError() call while loading the .hlto with two identically
named analyzers.

    $ cat .tmp/spicy.replaces-conflicts/output
    error: redefinition of protocol analyzer spicy::SSH_1
    ThreadSanitizer: main thread finished with ignores enabled
      One of the following ignores was not ended (in order of probability)
      Ignore was enabled at:
        #0 __llvm_gcov_init __linker___d192e45c25d5ee23-484d3e0fc2caf5b4.cc (ssh.hlto+0x34036) (BuildId: 091934ca4da885e7)
        #1 __llvm_gcov_init __linker___d192e45c25d5ee23-484d3e0fc2caf5b4.cc (ssh.hlto+0x34036) (BuildId: 091934ca4da885e7)
        ...

I was tempted to replace FatalError() with Error() and rely on
zeek-setup.cc's early exiting on any reporter errors, but this
seems easier for now.

Relates to #3865.
2024-08-06 11:52:52 +02:00

42 lines
797 B
Text

# @TEST-REQUIRES: have-spicy
#
# @TEST-EXEC: spicyz -d -o ssh.hlto ssh.spicy %INPUT
# @TEST-EXEC-FAIL: zeek ssh.hlto >output 2>&1
# @TEST-EXEC: btest-diff output
# @TEST-START-FILE ssh.spicy
module SSH;
import zeek;
public type Banner = unit {};
# @TEST-END-FILE
protocol analyzer spicy::SSH_1 over TCP:
parse with SSH::Banner,
replaces SSH;
protocol analyzer spicy::SSH_2 over UDP:
parse with SSH::Banner,
replaces SSH;
# @TEST-START-NEXT
file analyzer spicy::SSH_1:
parse with SSH::Banner,
replaces MD5;
file analyzer spicy::SSH_2:
parse with SSH::Banner,
replaces MD5;
# @TEST-START-NEXT
packet analyzer spicy::SSH_1:
parse with SSH::Banner,
replaces Ethernet;
packet analyzer spicy::SSH_2:
parse with SSH::Banner,
replaces Ethernet;