summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/global_vars.sh15
-rw-r--r--tests/testsuites/global_vars.conf17
3 files changed, 33 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6fa4d96f..7724d7a5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,7 @@ TESTS = $(TESTRUNS)
if ENABLE_IMDIAG
TESTS += \
arrayqueue.sh \
+ global_vars.sh \
da-mainmsg-q.sh \
validation-run.sh \
imtcp-multiport.sh \
diff --git a/tests/global_vars.sh b/tests/global_vars.sh
new file mode 100755
index 00000000..5c6c579e
--- /dev/null
+++ b/tests/global_vars.sh
@@ -0,0 +1,15 @@
+# Test for global variables
+# added 2013-11-18 by rgerhards
+# This file is part of the rsyslog project, released under ASL 2.0
+echo ===============================================================================
+echo \[global_vars.sh\]: testing global variable support
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup global_vars.conf
+
+# 40000 messages should be enough
+source $srcdir/diag.sh injectmsg 0 40000
+
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 39999
+source $srcdir/diag.sh exit
diff --git a/tests/testsuites/global_vars.conf b/tests/testsuites/global_vars.conf
new file mode 100644
index 00000000..0d1a3cb8
--- /dev/null
+++ b/tests/testsuites/global_vars.conf
@@ -0,0 +1,17 @@
+$IncludeConfig diag-common.conf
+
+$MainMsgQueueTimeoutShutdown 10000
+
+module(load="../plugins/imtcp/.libs/imtcp")
+input(type="imtcp" port="13514")
+
+template(name="outfmt" type="string" string="%$/msgnum%\n")
+template(name="dynfile" type="string" string="rsyslog.out.log") /* trick to use relative path names! */
+
+if $/msgnum == "" then
+ set $/msgnum = 0;
+
+if $msg contains "msgnum:" then {
+ action(type="omfile" dynaFile="dynfile" template="outfmt")
+ set $/msgnum = $/msgnum + 1;
+}