mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-19 15:12:56 +02:00
Why The testbench can declare rsyslog startup complete as soon as the started marker or imdiag port file appears. On slower runners, the pid file may still be missing for a short period after that. Impact: avoids spurious testbench failures in lookup-table reload tests and other helpers that signal or stop rsyslog by pid. Before/After: pid-based helpers could race missing, empty, or malformed pid files; they now wait for a valid pid before reading or signaling it. Technical Overview Add a dedicated helper that waits for a non-empty pid file containing a numeric pid for a specific rsyslog instance. Call that helper from getpid(), issue_HUP(), shutdown_when_empty(), and shutdown_immediate() before they read or signal the process pid. Keep the helper silent on success so command substitutions like pid=\$(getpid) remain valid. This keeps the relaxed startup diagnostics in wait_startup() while making pid-driven actions robust on slower systems such as s390 Debian. With the help of AI-Agents: Codex
29 lines
945 B
Bash
Executable File
29 lines
945 B
Bash
Executable File
#!/bin/bash
|
|
# addd 2021-05-10 by Rainer Gerhards, released under ASL 2.0
|
|
. ${srcdir:=.}/diag.sh init
|
|
generate_conf
|
|
add_conf '
|
|
module(load="../plugins/imtcp/.libs/imtcp")
|
|
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port"
|
|
notifyonconnectionopen="on" notifyonconnectionclose="on")
|
|
|
|
:msg, contains, "msgnum:" {
|
|
action(type="omfile" file=`echo $RSYSLOG2_OUT_LOG`)
|
|
}
|
|
|
|
action(type="omfile" file="'$RSYSLOG_OUT_LOG'")
|
|
|
|
'
|
|
startup
|
|
assign_tcpflood_port $RSYSLOG_DYNNAME.tcpflood_port
|
|
tcpflood -m1 -M"\"<129>Mar 10 01:00:00 172.20.245.8 tag: msgnum:1\""
|
|
shutdown_when_empty
|
|
wait_shutdown
|
|
content_check "connection established with "
|
|
if ! grep -qF -- "closed by remote peer " "$RSYSLOG_OUT_LOG"; then
|
|
# Some platforms lose the peer details during shutdown and emit the
|
|
# generic connection-close notification instead of the peer-annotated one.
|
|
content_check "connection could not be established with host: "
|
|
fi
|
|
exit_test
|