mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
test/builtin-plugins: Add plugin using ZEEK_VERSION_NUMBER
This commit is contained in:
parent
9971121509
commit
83dd7cf580
8 changed files with 71 additions and 1 deletions
|
@ -695,7 +695,7 @@ include_plugins_debian11_task:
|
||||||
folder: /tmp/ccache
|
folder: /tmp/ccache
|
||||||
fingerprint_script: echo builtin-plugins-ccache-$ZEEK_CCACHE_EPOCH-$CIRRUS_TASK_NAME-$CIRRUS_OS
|
fingerprint_script: echo builtin-plugins-ccache-$ZEEK_CCACHE_EPOCH-$CIRRUS_TASK_NAME-$CIRRUS_OS
|
||||||
reupload_on_changes: true
|
reupload_on_changes: true
|
||||||
build_script: ZEEK_CI_CONFIGURE_FLAGS="${ZEEK_CI_CONFIGURE_FLAGS} --include-plugins='/zeek/testing/builtin-plugins/Files/protocol-plugin;/zeek/testing/builtin-plugins/Files/py-lib-plugin'" ./ci/build.sh
|
build_script: ZEEK_CI_CONFIGURE_FLAGS="${ZEEK_CI_CONFIGURE_FLAGS} --include-plugins='/zeek/testing/builtin-plugins/Files/protocol-plugin;/zeek/testing/builtin-plugins/Files/py-lib-plugin;/zeek/testing/builtin-plugins/Files/zeek-version-plugin'" ./ci/build.sh
|
||||||
test_script:
|
test_script:
|
||||||
- cd testing/builtin-plugins && ../../auxil/btest/btest -d -b -j ${ZEEK_CI_BTEST_JOBS}
|
- cd testing/builtin-plugins && ../../auxil/btest/btest -d -b -j ${ZEEK_CI_BTEST_JOBS}
|
||||||
on_failure:
|
on_failure:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
Zeek::PyLib - Plugin embedding Python, whoosh. (built-in)
|
Zeek::PyLib - Plugin embedding Python, whoosh. (built-in)
|
||||||
Demo::Foo - A Foo test analyzer (built-in)
|
Demo::Foo - A Foo test analyzer (built-in)
|
||||||
|
Demo::Version - Tries to use ZEEK_VERSION_NUMBER (built-in)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
project(Zeek-Plugin-Demo-Version)
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
|
if ( NOT ZEEK_DIST )
|
||||||
|
message(FATAL_ERROR "ZEEK_DIST not set")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${ZEEK_DIST}/cmake)
|
||||||
|
|
||||||
|
include(ZeekPlugin)
|
||||||
|
|
||||||
|
zeek_plugin_begin(Demo Version)
|
||||||
|
zeek_plugin_cc(src/Plugin.cc)
|
||||||
|
zeek_plugin_end()
|
|
@ -0,0 +1 @@
|
||||||
|
0.1.0
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
#include "Plugin.h"
|
||||||
|
|
||||||
|
#include <zeek/Reporter.h>
|
||||||
|
#include <zeek/zeek-config.h>
|
||||||
|
|
||||||
|
namespace btest::plugin::Demo_Version
|
||||||
|
{
|
||||||
|
Plugin plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace btest::plugin::Demo_Version;
|
||||||
|
|
||||||
|
zeek::plugin::Configuration Plugin::Configure()
|
||||||
|
{
|
||||||
|
zeek::plugin::Configuration config;
|
||||||
|
config.name = "Demo::Version";
|
||||||
|
config.description = "Tries to use ZEEK_VERSION_NUMBER";
|
||||||
|
config.version.major = 1;
|
||||||
|
config.version.minor = 0;
|
||||||
|
config.version.patch = 0;
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Plugin::InitPostScript()
|
||||||
|
{
|
||||||
|
#ifndef ZEEK_VERSION_NUMBER
|
||||||
|
#error "ZEEK_VERSION_NUMBER is not defined"
|
||||||
|
#endif
|
||||||
|
zeek::reporter->Info("All good ZEEK_VERSION_NUMBER=%d\n", ZEEK_VERSION_NUMBER);
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <zeek/plugin/Plugin.h>
|
||||||
|
|
||||||
|
namespace btest::plugin::Demo_Version
|
||||||
|
{
|
||||||
|
|
||||||
|
class Plugin : public zeek::plugin::Plugin
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
// Overridden from zeek::plugin::Plugin.
|
||||||
|
zeek::plugin::Configuration Configure() override;
|
||||||
|
|
||||||
|
void InitPostScript() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Plugin plugin;
|
||||||
|
|
||||||
|
}
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
# @TEST-EXEC: zeek -N Zeek::PyLib >>out
|
# @TEST-EXEC: zeek -N Zeek::PyLib >>out
|
||||||
# @TEST-EXEC: zeek -N Demo::Foo >>out
|
# @TEST-EXEC: zeek -N Demo::Foo >>out
|
||||||
|
# @TEST-EXEC: zeek -N Demo::Version >>out
|
||||||
# @TEST-EXEC: btest-diff out
|
# @TEST-EXEC: btest-diff out
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue