rsyslog/tests/rscript_set_memleak-vg.sh
Rainer Gerhards 42a8051ad9
testbench: make most tests use a port file and assign listen port 0
This makes the test much more robust against heavily loaded test
systems.
2019-08-16 17:31:52 +02:00

43 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# A test that checks for memory leaks
# created based on real world case:
# https://github.com/rsyslog/rsyslog/issues/1376
# Copyright 2017-01-24 by Rainer Gerhards
# This file is part of the rsyslog project, released under ASL 2.0
uname
if [ $(uname) = "FreeBSD" ] ; then
echo "This test currently does not work on FreeBSD."
exit 77
fi
. ${srcdir:=.}/diag.sh init
generate_conf
add_conf '
module(load="../plugins/imtcp/.libs/imtcp")
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="rcvr")
template(name="json" type="string" string="%$!%\n")
template(name="ts" type="string" string="%timestamp:::date-rfc3339%")
ruleset(name="rcvr" queue.type="LinkedList") {
set $.index="unknown";
set $.type="unknown";
set $.interval=$$now & ":" & $$hour;
set $!host_forwarded=$hostname;
set $!host_received=$$myhostname;
set $!time_received=$timegenerated;
set $!@timestamp=exec_template("ts");
action( type="omfile"
file=`echo $RSYSLOG_OUT_LOG`
template="json"
)
}'
startup_vg
tcpflood -m5000
shutdown_when_empty
wait_shutdown_vg
check_exit_vg
# note: we check only the valgrind result, we are not really interested
# in the output data (non-standard format in any way...)
exit_test