summaryrefslogtreecommitdiffstats
path: root/tests/pipeaction.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/pipeaction.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/pipeaction.sh')
-rwxr-xr-xtests/pipeaction.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/pipeaction.sh b/tests/pipeaction.sh
new file mode 100755
index 0000000..a50784e
--- /dev/null
+++ b/tests/pipeaction.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# Test for the pipe output action.
+# will create a fifo in the current directory, write to it and
+# then do the usual sequence checks.
+# added 2009-11-05 by RGerhards
+
+# create the pipe and start a background process that copies data from
+# it to the "regular" work file
+. ${srcdir:=.}/diag.sh init
+export NUMMESSAGES=20000
+generate_conf
+add_conf '
+$MainMsgQueueTimeoutShutdown 10000
+
+# set spool locations and switch queue to disk-only mode
+$WorkDirectory '$RSYSLOG_DYNNAME'.spool
+$MainMsgQueueFilename mainq
+$MainMsgQueueType disk
+
+$template outfmt,"%msg:F,58:2%\n"
+# with pipes, we do not need to use absolute path names, so
+# we can simply refer to our working pipe via the usual relative
+# path name
+:msg, contains, "msgnum:" |rsyslog-testbench-fifo;outfmt
+'
+rm -f rsyslog-testbench-fifo
+mkfifo rsyslog-testbench-fifo
+cp rsyslog-testbench-fifo $RSYSLOG_OUT_LOG &
+CPPROCESS=$!
+echo background cp process id is $CPPROCESS
+
+# now do the usual run
+startup
+injectmsg 0 $NUMMESSAGES
+shutdown_when_empty
+wait_shutdown
+
+# wait for the cp process to finish, do pipe-specific cleanup
+echo waiting for background cp to terminate...
+wait $CPPROCESS
+rm -f rsyslog-testbench-fifo
+echo background cp has terminated, continue test...
+
+# and continue the usual checks
+seq_check
+exit_test