mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Reimplementation of the @prefixes statement.
Any added prefixes are now used *after* all input files have been parsed to look for a prefixed, flattened version of the input file somewhere in BROPATH and, if found, load it. For example, if "lcl" is in @prefixes, and site.bro is loaded, then a file named "lcl.site.bro" that's in BROPATH would end up being automatically loaded as well. Packages work similarly, e.g. loading "protocols/http" means a file named "lcl.protocols.http.bro" in BROPATH gets loaded automatically.
This commit is contained in:
parent
e39a49833f
commit
d97003892b
6 changed files with 245 additions and 114 deletions
4
testing/btest/Baseline/core.load-prefixes/output
Normal file
4
testing/btest/Baseline/core.load-prefixes/output
Normal file
|
@ -0,0 +1,4 @@
|
|||
loaded lcl2.site.bro
|
||||
loaded lcl.site.bro
|
||||
loaded lcl2.protocols.http.bro
|
||||
loaded lcl.protocols.http.bro
|
25
testing/btest/core/load-prefixes.bro
Normal file
25
testing/btest/core/load-prefixes.bro
Normal file
|
@ -0,0 +1,25 @@
|
|||
# A test of prefix-based @load'ing
|
||||
|
||||
# @TEST-EXEC: bro addprefixes site protocols/http >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
@TEST-START-FILE addprefixes.bro
|
||||
@prefixes += lcl
|
||||
@prefixes += lcl2
|
||||
@TEST-END-FILE
|
||||
|
||||
@TEST-START-FILE lcl.site.bro
|
||||
print "loaded lcl.site.bro";
|
||||
@TEST-END-FILE
|
||||
|
||||
@TEST-START-FILE lcl2.site.bro
|
||||
print "loaded lcl2.site.bro";
|
||||
@TEST-END-FILE
|
||||
|
||||
@TEST-START-FILE lcl.protocols.http.bro
|
||||
print "loaded lcl.protocols.http.bro";
|
||||
@TEST-END-FILE
|
||||
|
||||
@TEST-START-FILE lcl2.protocols.http.bro
|
||||
print "loaded lcl2.protocols.http.bro";
|
||||
@TEST-END-FILE
|
Loading…
Add table
Add a link
Reference in a new issue