From 6fd68bc6075852aed4b9df3cca4faeb2c6c0344e Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Wed, 11 Oct 2023 11:58:57 +0200 Subject: [PATCH 1/3] zeekygen/example: Squelch unused function warning --- scripts/zeekygen/example.zeek | 2 +- testing/btest/Baseline/doc.zeekygen.identifier/test.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/zeekygen/example.zeek b/scripts/zeekygen/example.zeek index 360d044b64..681457d402 100644 --- a/scripts/zeekygen/example.zeek +++ b/scripts/zeekygen/example.zeek @@ -173,7 +173,7 @@ export { # This function isn't exported, so it won't appear anywhere in the generated # documentation. So using ``##``-style comments is pointless here. -function function_without_proto(tag: string): string +function function_without_proto(tag: string): string &is_used { # Zeekygen-style comments only apply to entities at global-scope so # Zeekygen doesn't associate the following comments with anything. diff --git a/testing/btest/Baseline/doc.zeekygen.identifier/test.rst b/testing/btest/Baseline/doc.zeekygen.identifier/test.rst index 219c92da8b..b24dc870a3 100644 --- a/testing/btest/Baseline/doc.zeekygen.identifier/test.rst +++ b/testing/btest/Baseline/doc.zeekygen.identifier/test.rst @@ -240,6 +240,7 @@ :source-code: zeekygen/example.zeek 176 184 :Type: :zeek:type:`function` (tag: :zeek:type:`string`) : :zeek:type:`string` + :Attributes: :zeek:attr:`&is_used` .. zeek:type:: ZeekygenExample::PrivateRecord From 6f3e3a10e6bda4acfff94c25e3cbe9df8a1a2760 Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Wed, 11 Oct 2023 12:31:58 +0200 Subject: [PATCH 2/3] zeekygen: Disable zeek_init() handlers causing error output These modules have zeek_init() handlers with actual logic that has side-effects and error outputs. Just disable them during zeekygen runs. --- scripts/zeekygen/__load__.zeek | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/zeekygen/__load__.zeek b/scripts/zeekygen/__load__.zeek index 2cfa93d48b..80a530bc3b 100644 --- a/scripts/zeekygen/__load__.zeek +++ b/scripts/zeekygen/__load__.zeek @@ -21,7 +21,14 @@ @load ./example.zeek -event zeek_init() +event zeek_init() &priority=1000 { + # Disable events in modules that use zeek_init() to do stuff and may + # fail when run under zeekygen. For the purpose of zeekygen, we could + # probably disable all modules, too. + disable_module_events("Control"); + disable_module_events("Management::Agent::Runtime"); + disable_module_events("Management::Controller::Runtime"); + disable_module_events("Management::Node"); terminate(); } From 2cbe76d296b6da13ec1a68d27bf1a036d4ed8a04 Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Wed, 11 Oct 2023 12:19:04 +0200 Subject: [PATCH 3/3] ci/update-zeekygen-docs.sh: Do output stderr by default stderr was only produced when there was a real failure as it had been a bit noisy previously, but has hidden actual problems. Now that there is less noise, just output stderr all the time. --- ci/update-zeekygen-docs.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ci/update-zeekygen-docs.sh b/ci/update-zeekygen-docs.sh index c4722237cb..278588752b 100755 --- a/ci/update-zeekygen-docs.sh +++ b/ci/update-zeekygen-docs.sh @@ -13,7 +13,6 @@ source_dir="$(cd $dir/.. && pwd)" build_dir=$source_dir/build conf_file=$build_dir/zeekygen-test.conf output_dir=$source_dir/doc -zeek_error_file=$build_dir/zeekygen-test-stderr.txt if [ -n "$1" ]; then output_dir=$1 @@ -29,11 +28,10 @@ cd $build_dir export ZEEK_SEED_FILE=$source_dir/testing/btest/random.seed function run_zeek { - ZEEK_ALLOW_INIT_ERRORS=1 zeek -X $conf_file zeekygen >/dev/null 2>$zeek_error_file + ZEEK_ALLOW_INIT_ERRORS=1 zeek -X $conf_file zeekygen >/dev/null if [ $? -ne 0 ]; then - echo "Failed running zeek with zeekygen config file $conf_file" - echo "See stderr in $zeek_error_file" + echo "Failed running zeek with zeekygen config file $conf_file" >&2 exit 1 fi }