Install Zeek's btest tooling with the distribution

This creates $PREFIX/share/btest in the install tree, with the
following folders:

- scripts/ for the canonifiers
- data/ for random.seed
- data/pcaps for the test pcaps

The pcaps can be skipped by configuring with --disable-btest-pcaps.
This commit is contained in:
Christian Kreibich 2021-03-10 18:06:31 -08:00
parent 6a0eae28a2
commit 463d159bfc
4 changed files with 29 additions and 1 deletions

View file

@ -531,6 +531,9 @@ if ( GooglePerftools_INCLUDE_DIR )
set(ZEEK_CONFIG_GooglePerftools_INCLUDE_DIR ${GooglePerftools_INCLUDE_DIR}) set(ZEEK_CONFIG_GooglePerftools_INCLUDE_DIR ${GooglePerftools_INCLUDE_DIR})
endif () endif ()
set(ZEEK_CONFIG_BTEST_TOOLS_DIR ${ZEEK_ROOT_DIR}/share/btest)
install(DIRECTORY DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in
${CMAKE_CURRENT_BINARY_DIR}/zeek-config @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/zeek-config @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin)
@ -568,6 +571,7 @@ endif ()
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(scripts) add_subdirectory(scripts)
add_subdirectory(man) add_subdirectory(man)
add_subdirectory(testing)
include(CheckOptionalBuildSources) include(CheckOptionalBuildSources)
@ -600,6 +604,12 @@ if (CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType) string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType)
endif () endif ()
if ( INSTALL_BTEST_PCAPS )
set(_install_btest_tools_msg "all")
else ()
set(_install_btest_tools_msg "no pcaps")
endif ()
message( message(
"\n====================| Zeek Build Summary |====================" "\n====================| Zeek Build Summary |===================="
"\n" "\n"
@ -621,6 +631,7 @@ message(
"\nZeekControl: ${INSTALL_ZEEKCTL}" "\nZeekControl: ${INSTALL_ZEEKCTL}"
"\nAux. Tools: ${INSTALL_AUX_TOOLS}" "\nAux. Tools: ${INSTALL_AUX_TOOLS}"
"\nBTest: ${INSTALL_BTEST}" "\nBTest: ${INSTALL_BTEST}"
"\nBTest tooling: ${_install_btest_tools_msg}"
"\nzkg: ${INSTALL_ZKG}" "\nzkg: ${INSTALL_ZKG}"
"\n" "\n"
"\nlibmaxminddb: ${USE_GEOIP}" "\nlibmaxminddb: ${USE_GEOIP}"

5
configure vendored
View file

@ -65,6 +65,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--disable-auxtools don't build or install auxiliary tools --disable-auxtools don't build or install auxiliary tools
--disable-archiver don't build or install zeek-archiver tool --disable-archiver don't build or install zeek-archiver tool
--disable-btest don't install BTest --disable-btest don't install BTest
--disable-btest-pcaps don't install Zeek's BTest input pcaps
--disable-python don't try to build python bindings for Broker --disable-python don't try to build python bindings for Broker
--disable-broker-tests don't try to build Broker unit tests --disable-broker-tests don't try to build Broker unit tests
--disable-zkg don't install zkg --disable-zkg don't install zkg
@ -161,6 +162,7 @@ append_cache_entry ENABLE_JEMALLOC BOOL false
append_cache_entry BUILD_SHARED_LIBS BOOL true append_cache_entry BUILD_SHARED_LIBS BOOL true
append_cache_entry INSTALL_AUX_TOOLS BOOL true append_cache_entry INSTALL_AUX_TOOLS BOOL true
append_cache_entry INSTALL_BTEST BOOL true append_cache_entry INSTALL_BTEST BOOL true
append_cache_entry INSTALL_BTEST_PCAPS BOOL true
append_cache_entry INSTALL_ZEEK_ARCHIVER BOOL true append_cache_entry INSTALL_ZEEK_ARCHIVER BOOL true
append_cache_entry INSTALL_ZEEKCTL BOOL true append_cache_entry INSTALL_ZEEKCTL BOOL true
append_cache_entry INSTALL_ZKG BOOL true append_cache_entry INSTALL_ZKG BOOL true
@ -289,6 +291,9 @@ while [ $# -ne 0 ]; do
--disable-btest) --disable-btest)
append_cache_entry INSTALL_BTEST BOOL false append_cache_entry INSTALL_BTEST BOOL false
;; ;;
--disable-btest-pcaps)
append_cache_entry INSTALL_BTEST_PCAPS BOOL false
;;
--disable-python) --disable-python)
append_cache_entry DISABLE_PYTHON_BINDINGS BOOL true append_cache_entry DISABLE_PYTHON_BINDINGS BOOL true
;; ;;

8
testing/CMakeLists.txt Normal file
View file

@ -0,0 +1,8 @@
install(DIRECTORY scripts/ DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}/scripts
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN "diff-*")
install(FILES btest/random.seed DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}/data)
if ( INSTALL_BTEST_PCAPS )
install(DIRECTORY btest/Traces/ DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}/data/pcaps)
endif ()

View file

@ -16,6 +16,7 @@ zeek_dist=@ZEEK_DIST@
binpac_root=@ZEEK_CONFIG_BINPAC_ROOT_DIR@ binpac_root=@ZEEK_CONFIG_BINPAC_ROOT_DIR@
caf_root=@ZEEK_CONFIG_CAF_ROOT_DIR@ caf_root=@ZEEK_CONFIG_CAF_ROOT_DIR@
broker_root=@ZEEK_CONFIG_BROKER_ROOT_DIR@ broker_root=@ZEEK_CONFIG_BROKER_ROOT_DIR@
btest_tools_dir=@ZEEK_CONFIG_BTEST_TOOLS_DIR@
add_path() { add_path() {
# $1: existing path # $1: existing path
@ -38,7 +39,7 @@ include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_LibKrb5_INCLUDE_DIR@")
include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_GooglePerftools_INCLUDE_DIR@") include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_GooglePerftools_INCLUDE_DIR@")
usage="\ usage="\
Usage: zeek-config [--version] [--build_type] [--prefix] [--lib_dir] [--script_dir] [--site_dir] [--plugin_dir] [--config_dir] [--python_dir] [--include_dir] [--cmake_dir] [--zeekpath] [--zeek_dist] [--binpac_root] [--caf_root] [--broker_root]" Usage: zeek-config [--version] [--build_type] [--prefix] [--btest_tools_dir] [--lib_dir] [--script_dir] [--site_dir] [--plugin_dir] [--config_dir] [--python_dir] [--include_dir] [--cmake_dir] [--zeekpath] [--zeek_dist] [--binpac_root] [--caf_root] [--broker_root]"
if [ $# -eq 0 ] ; then if [ $# -eq 0 ] ; then
echo "${usage}" 1>&2 echo "${usage}" 1>&2
@ -64,6 +65,9 @@ while [ $# -ne 0 ]; do
--bropath) # For compatibility with legacy Bro plugins. --bropath) # For compatibility with legacy Bro plugins.
echo $zeekpath echo $zeekpath
;; ;;
--btest_tools_dir)
echo $btest_tools_dir
;;
--build_type) --build_type)
echo $build_type echo $build_type
;; ;;