mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00

* Generally increase timeouts for tests that have recent transient failures * Change any test that relied on `btest-bg-wait -k` since that's never going to play with with CI systems. Instead, we always need to have a well-defined termination condition in the test itself (and most already did, so didn't really need the `-k` flag anyway).
42 lines
1 KiB
Text
42 lines
1 KiB
Text
# @TEST-EXEC: btest-bg-run zeek zeek -j -b %INPUT
|
|
# @TEST-EXEC: btest-bg-wait 30
|
|
# @TEST-EXEC: btest-diff zeek/supervisor.out
|
|
# @TEST-EXEC: btest-diff zeek/node.out
|
|
|
|
# So the supervised node doesn't terminate right away.
|
|
redef exit_only_after_terminate=T;
|
|
|
|
global supervisor_output_file: file;
|
|
global node_output_file: file;
|
|
|
|
event zeek_init()
|
|
{
|
|
local pid_file = "supervisor.pid";
|
|
|
|
if ( Supervisor::is_supervisor() )
|
|
{
|
|
supervisor_output_file = open("supervisor.out");
|
|
print supervisor_output_file, "supervisor zeek_init()";
|
|
local f = open(pid_file);
|
|
print f, getpid();
|
|
local sn = Supervisor::NodeConfig($name="grault");
|
|
local res = Supervisor::create(sn);
|
|
|
|
if ( res != "" )
|
|
print supervisor_output_file, res;
|
|
}
|
|
else
|
|
{
|
|
node_output_file = open("node.out");
|
|
print node_output_file, "supervised node zeek_init()";
|
|
system(fmt("kill `cat %s`", pid_file));
|
|
}
|
|
}
|
|
|
|
event zeek_done()
|
|
{
|
|
if ( Supervisor::is_supervised() )
|
|
print node_output_file, "supervised node zeek_done()";
|
|
else
|
|
print supervisor_output_file, "supervisor zeek_done()";
|
|
}
|