summaryrefslogtreecommitdiffstats
path: root/tests/imklog_permitnonkernelfacility_root.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/imklog_permitnonkernelfacility_root.sh')
-rwxr-xr-xtests/imklog_permitnonkernelfacility_root.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/imklog_permitnonkernelfacility_root.sh b/tests/imklog_permitnonkernelfacility_root.sh
new file mode 100755
index 0000000..16e8b90
--- /dev/null
+++ b/tests/imklog_permitnonkernelfacility_root.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# add 2017-07-18 by Pascal Withopf, released under ASL 2.0
+echo \[imklog_permitnonkernelfacility_root.sh\]: test parameter permitnonkernelfacility
+echo This test must be run as root with no other active syslogd
+if [ "$EUID" -ne 0 ]; then
+ exit 77 # Not root, skip this test
+fi
+service rsyslog stop
+. ${srcdir:=.}/diag.sh init
+generate_conf
+add_conf '
+module(load="../plugins/imklog/.libs/imklog" permitnonkernelfacility="on")
+
+template(name="outfmt" type="string" string="%msg:57:16%: -%pri%-\n")
+
+:msg, contains, "msgnum" action(type="omfile" template="outfmt" file=`echo $RSYSLOG_OUT_LOG`)
+'
+startup
+echo "<115>Mar 10 01:00:00 172.20.245.8 tag: msgnum:1" > /dev/kmsg
+echo "<115>Mar 10 01:00:00 172.20.245.8 tag: msgnum:1"
+sleep 2
+shutdown_when_empty
+wait_shutdown
+echo 'Mar 10 01:00:00 172.20.245.8 tag: msgnum:1: -115-' | cmp - $RSYSLOG_OUT_LOG
+if [ ! $? -eq 0 ]; then
+ echo "invalid response generated, $RSYSLOG_OUT_LOG is:"
+ cat $RSYSLOG_OUT_LOG
+ error_exit 1
+fi;
+
+service rsyslog start
+exit_test