rsyslog/tests/imptcp_uds_unlink.sh
Rainer Gerhards 69ef6e329b fix bad bash coding style and disable shellcheck false positives
Also now permit interactivly running tests without explicitly setting
$srcdir. This now works if we are inside ./tests and fails, as before,
when we are in a different directory.

Detected by shellcheck via CodeFactor.io
2018-10-23 13:27:37 +02:00

46 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
. ${srcdir:=.}/diag.sh init
# First make sure we don't unlink if not asked to
rm -f "$srcdir/testbench_socket"
echo "nope" > "$srcdir/testbench_socket"
generate_conf
add_conf '
global(MaxMessageSize="124k")
module(load="../plugins/imptcp/.libs/imptcp")
input(type="imptcp" path="'$RSYSLOG_DYNNAME'-testbench_socket" unlink="on" filecreatemode="0600")
input(type="imptcp" path="'$RSYSLOG_DYNNAME'-testbench_socket2" unlink="on" filecreatemode="0666")
template(name="outfmt" type="string" string="%msg:%\n")
*.notice action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
'
startup
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
content_check "imptcp: error while binding unix socket: Address already in use"
exit_test
# Now make sure we unlink if asked to
echo "ok" > "$srcdir/testbench_socket"
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
global(MaxMessageSize="124k")
module(load="../plugins/imptcp/.libs/imptcp")
input(type="imptcp" path="'$RSYSLOG_DYNNAME'-testbench_socket" unlink="on")
template(name="outfmt" type="string" string="%msg:%\n")
*.notice action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
'
startup
logger -Tu "$srcdir/testbench_socket" "hello from imptcp uds"
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
content_check "hello from imptcp uds"
exit_test