rsyslog/tests/mmpstrucdata-invalid-vg.sh
Rainer Gerhards 1ed6859dfd
testbench: replace hardcoded ports and improve cleanup handling
Support tools (like tcpflood) are also upgraded to support the
necessary dynamic port.s

This is part of the effort to make parallel testing possible.

We move parts of the cleanup to the buildbot cleanup, as we cannot
clean out instances on each test when we run parallel tests.
2018-08-18 20:28:31 +02:00

40 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# the goal here is to detect memleaks when structured data is not
# correctly parsed.
# This file is part of the rsyslog project, released under ASL 2.0
# rgerhards, 2015-04-30
uname
if [ `uname` = "FreeBSD" ] ; then
echo "This test currently does not work on FreeBSD."
exit 77
fi
echo ===============================================================================
echo \[mmpstrucdata-invalid.sh\]: testing mmpstrucdata with invalid SD
. $srcdir/diag.sh init
generate_conf
add_conf '
module(load="../plugins/mmpstrucdata/.libs/mmpstrucdata")
module(load="../plugins/imtcp/.libs/imtcp")
input(type="imtcp" port="'$TCPFLOOD_PORT'")
action(type="mmpstrucdata")
if $msg contains "msgnum" then
action(type="omfile" file=`echo $RSYSLOG_OUT_LOG`)
'
startup_vg
. $srcdir/diag.sh wait-startup
# we use different message counts as this hopefully aids us
# in finding which sample is leaking. For this, check the number
# of blocks lost and see what set they match.
tcpflood -m100 -M "\"<161>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood - tag [tcpflood@32473 MSGNUM] invalid structured data!\""
tcpflood -m200 -M "\"<161>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood - tag [tcpflood@32473 MSGNUM ] invalid structured data!\""
tcpflood -m300 -M "\"<161>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood - tag [tcpflood@32473 MSGNUM= ] invalid structured data!\""
tcpflood -m400 -M "\"<161>1 2003-03-01T01:00:00.000Z mymachine.example.com tcpflood - tag [tcpflood@32473 = ] invalid structured data!\""
shutdown_when_empty
wait_shutdown_vg
. $srcdir/diag.sh check-exit-vg
exit_test