testing/btest/*test: Comment all @TEST lines

This commit is contained in:
Arne Welzel 2025-04-17 15:41:35 +02:00
parent 6617da5bbd
commit 86249db2a3
9 changed files with 46 additions and 46 deletions

View file

@ -18,7 +18,7 @@ fi
python3 find_logs.py "${BROSCRIPTS}" | sort > out python3 find_logs.py "${BROSCRIPTS}" | sort > out
@TEST-START-FILE find_logs.py # @TEST-START-FILE find_logs.py
import os, sys import os, sys
import re import re
@ -70,4 +70,4 @@ for fname in find_scripts():
if idx > 0: if idx > 0:
m = re.match('.*\$path\s*=\s*"?(\w+)"?.*', line[idx:]) m = re.match('.*\$path\s*=\s*"?(\w+)"?.*', line[idx:])
print(m.group(1)) print(m.group(1))
@TEST-END-FILE # @TEST-END-FILE

View file

@ -20,7 +20,7 @@
# calls in some scripts. # calls in some scripts.
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER; redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;
@TEST-START-FILE cluster-layout.zeek # @TEST-START-FILE cluster-layout.zeek
redef Cluster::nodes = { redef Cluster::nodes = {
["manager"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))], ["manager"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
["logger-1"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2"))], ["logger-1"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2"))],
@ -28,7 +28,7 @@ redef Cluster::nodes = {
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT4"))], ["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT4"))],
}; };
@TEST-END-FILE # @TEST-END-FILE
# Make this a single-node cluster-layout so no connection attempts happen # Make this a single-node cluster-layout so no connection attempts happen
# to other nodes. # to other nodes.

View file

@ -4,9 +4,9 @@
# This test will fail if new zeek scripts are added to the scripts/policy/ # This test will fail if new zeek scripts are added to the scripts/policy/
# directory. Correcting that just involves updating # directory. Correcting that just involves updating
# scripts/test-all-policy.zeek to @load the new zeek scripts. # scripts/test-all-policy.zeek to @load the new zeek scripts.
#
@TEST-EXEC: test -e $DIST/scripts/test-all-policy.zeek # @TEST-EXEC: test -e $DIST/scripts/test-all-policy.zeek
@TEST-EXEC: test -d $DIST/scripts # @TEST-EXEC: test -d $DIST/scripts
@TEST-EXEC: ( cd $DIST/scripts/policy && find . -name '*.zeek' ) | sort >"all scripts found" # @TEST-EXEC: ( cd $DIST/scripts/policy && find . -name '*.zeek' ) | sort >"all scripts found"
@TEST-EXEC: cat $DIST/scripts/test-all-policy.zeek | grep '@load' | sed 'sm^\( *# *\)\{0,\}@load *m./mg' | sort >test-all-policy.zeek # @TEST-EXEC: cat $DIST/scripts/test-all-policy.zeek | grep '@load' | sed 'sm^\( *# *\)\{0,\}@load *m./mg' | sort >test-all-policy.zeek
@TEST-EXEC: diff -u "all scripts found" test-all-policy.zeek 1>&2 # @TEST-EXEC: diff -u "all scripts found" test-all-policy.zeek 1>&2

View file

@ -13,13 +13,13 @@
# @TEST-EXEC: btest-bg-wait 30 # @TEST-EXEC: btest-bg-wait 30
# @TEST-EXEC: btest-diff manager-1/x509.log # @TEST-EXEC: btest-diff manager-1/x509.log
@TEST-START-FILE cluster-layout.zeek # @TEST-START-FILE cluster-layout.zeek
redef Cluster::nodes = { redef Cluster::nodes = {
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))], ["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"], ["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"], ["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
}; };
@TEST-END-FILE # @TEST-END-FILE
@load base/protocols/ssl @load base/protocols/ssl
@load base/frameworks/cluster @load base/frameworks/cluster

View file

@ -13,13 +13,13 @@
# @TEST-EXEC: btest-bg-wait 30 # @TEST-EXEC: btest-bg-wait 30
# @TEST-EXEC: btest-diff manager-1/x509.log # @TEST-EXEC: btest-diff manager-1/x509.log
@TEST-START-FILE cluster-layout.zeek # @TEST-START-FILE cluster-layout.zeek
redef Cluster::nodes = { redef Cluster::nodes = {
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))], ["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"], ["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"], ["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
}; };
@TEST-END-FILE # @TEST-END-FILE
@load base/protocols/ssl @load base/protocols/ssl
@load base/frameworks/cluster @load base/frameworks/cluster

View file

@ -7,7 +7,7 @@
# @TEST-EXEC: btest-bg-wait 20 # @TEST-EXEC: btest-bg-wait 20
# @TEST-EXEC: btest-diff zeek/.stdout # @TEST-EXEC: btest-diff zeek/.stdout
@TEST-START-FILE dirtest.zeek # @TEST-START-FILE dirtest.zeek
@load base/utils/dir @load base/utils/dir
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
@ -51,16 +51,16 @@ event zeek_init()
Dir::monitor("../testdir", new_file, .25sec); Dir::monitor("../testdir", new_file, .25sec);
} }
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE testdir/hi # @TEST-START-FILE testdir/hi
123 123
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE testdir/howsitgoing # @TEST-START-FILE testdir/howsitgoing
abc abc
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE testdir/bye # @TEST-START-FILE testdir/bye
!@# !@#
@TEST-END-FILE # @TEST-END-FILE

View file

@ -2,7 +2,7 @@
# @TEST-EXEC: btest-bg-wait 15 # @TEST-EXEC: btest-bg-wait 15
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff zeek/.stdout # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff zeek/.stdout
@TEST-START-FILE exectest.zeek # @TEST-START-FILE exectest.zeek
@load base/utils/exec @load base/utils/exec
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
@ -59,9 +59,9 @@ event zeek_init()
$read_files=set("out3", "out4")]); $read_files=set("out3", "out4")]);
} }
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE somescript.sh # @TEST-START-FILE somescript.sh
#! /usr/bin/env bash #! /usr/bin/env bash
echo "insert text here" > out1 echo "insert text here" > out1
echo "and here" >> out1 echo "and here" >> out1
@ -70,9 +70,9 @@ echo "and there" >> out2
echo "done" echo "done"
echo "exit" echo "exit"
echo "stop" echo "stop"
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE nofiles.sh # @TEST-START-FILE nofiles.sh
#! /usr/bin/env bash #! /usr/bin/env bash
echo "here's something on stdout" echo "here's something on stdout"
echo "some more stdout" echo "some more stdout"
@ -81,23 +81,23 @@ echo "and some stderr" 1>&2
echo "more stderr" 1>&2 echo "more stderr" 1>&2
echo "last stderr" 1>&2 echo "last stderr" 1>&2
exit 1 exit 1
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE suicide.sh # @TEST-START-FILE suicide.sh
#! /usr/bin/env bash #! /usr/bin/env bash
echo "FML" echo "FML"
kill -9 $$ kill -9 $$
echo "nope" echo "nope"
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE stdin.sh # @TEST-START-FILE stdin.sh
#! /usr/bin/env bash #! /usr/bin/env bash
read -r line read -r line
echo "$line" echo "$line"
@TEST-END-FILE # @TEST-END-FILE
@TEST-START-FILE empty_file.sh # @TEST-START-FILE empty_file.sh
#! /usr/bin/env bash #! /usr/bin/env bash
touch out3 touch out3
echo "test" > out4 echo "test" > out4
@TEST-END-FILE # @TEST-END-FILE

View file

@ -6,7 +6,7 @@
# @TEST-EXEC: zeek -b %INPUT > output # @TEST-EXEC: zeek -b %INPUT > output
# @TEST-EXEC: btest-diff output # @TEST-EXEC: btest-diff output
@TEST-START-FILE common.zeek # @TEST-START-FILE common.zeek
function check_addr(ip: addr) function check_addr(ip: addr)
{ {
print fmt("%s is private: %s", ip, Site::is_private_addr(ip)); print fmt("%s is private: %s", ip, Site::is_private_addr(ip));
@ -23,36 +23,36 @@ event zeek_init()
check_addr(10.0.0.1); check_addr(10.0.0.1);
check_addr(1.2.3.4); check_addr(1.2.3.4);
} }
@TEST-END-FILE # @TEST-END-FILE
# (1) The common case: 10/8 is private, implying local, and 1/8 is not. # (1) The common case: 10/8 is private, implying local, and 1/8 is not.
@load ./common @load ./common
@TEST-START-NEXT # @TEST-START-NEXT
# (2) Removing 10/8 from private space implies we remove it from local, too. # (2) Removing 10/8 from private space implies we remove it from local, too.
@load ./common @load ./common
redef Site::private_address_space -= { 10.0.0.0/8 }; redef Site::private_address_space -= { 10.0.0.0/8 };
@TEST-START-NEXT # @TEST-START-NEXT
# (3) Adding 1/8 to private space implies we add it to local, too. # (3) Adding 1/8 to private space implies we add it to local, too.
@load ./common @load ./common
redef Site::private_address_space = { 1.0.0.0/8 }; redef Site::private_address_space = { 1.0.0.0/8 };
@TEST-START-NEXT # @TEST-START-NEXT
# (4) Adding 1/8 to local space doesn't change the private one. # (4) Adding 1/8 to local space doesn't change the private one.
@load ./common @load ./common
redef Site::local_nets += { 1.0.0.0/8 }; redef Site::local_nets += { 1.0.0.0/8 };
@TEST-START-NEXT # @TEST-START-NEXT
# (5) Resetting the local space to 1/8 does not lose the private space. # (5) Resetting the local space to 1/8 does not lose the private space.
@load ./common @load ./common
redef Site::local_nets = { 1.0.0.0/8 }; redef Site::local_nets = { 1.0.0.0/8 };
@TEST-START-NEXT # @TEST-START-NEXT
# (6) Resetting the private space dynamically does propagate into local space. # (6) Resetting the private space dynamically does propagate into local space.
@load ./common @load ./common
@ -62,7 +62,7 @@ event zeek_init() &priority=5
Config::set_value("Site::private_address_space", set(1.0.0.0/8)); Config::set_value("Site::private_address_space", set(1.0.0.0/8));
} }
@TEST-START-NEXT # @TEST-START-NEXT
# (7) Resetting local space dynamically does not lose the private space. # (7) Resetting local space dynamically does not lose the private space.
@load ./common @load ./common
@ -72,14 +72,14 @@ event zeek_init() &priority=5
Config::set_value("Site::local_nets", set(1.0.0.0/8)); Config::set_value("Site::local_nets", set(1.0.0.0/8));
} }
@TEST-START-NEXT # @TEST-START-NEXT
# (8) Disable the private-means-local implication and verify defaults. # (8) Disable the private-means-local implication and verify defaults.
@load ./common @load ./common
redef Site::private_address_space_is_local = F; redef Site::private_address_space_is_local = F;
@TEST-START-NEXT # @TEST-START-NEXT
# (9) Disable the private-means-local implication and alter both. # (9) Disable the private-means-local implication and alter both.
@load ./common @load ./common

View file

@ -15,7 +15,7 @@
# # simply update this test's TEST-START-FILE with the latest contents # # simply update this test's TEST-START-FILE with the latest contents
# site/local.zeek. # site/local.zeek.
@TEST-START-FILE local-7.2.zeek # @TEST-START-FILE local-7.2.zeek
##! Local site policy. Customize as appropriate. ##! Local site policy. Customize as appropriate.
##! ##!
##! This file will not be overwritten when upgrading or reinstalling! ##! This file will not be overwritten when upgrading or reinstalling!
@ -122,4 +122,4 @@ redef digest_salt = "Please change this value.";
# Uncomment this to source zkg's package state # Uncomment this to source zkg's package state
# @load packages # @load packages
@TEST-END-FILE # @TEST-END-FILE