mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-19 23:10:41 +01:00
This is work torward the ability to run the testbench in parallel. Some small issues in tests have also been detected, which were not previously seen. They have been fixed. We did not do separate commits for this as it would clutter the commit log with not really relevant info. Also move some cleanup to "make clean" target To support parallel testbench runs, we need to have dynamic work files. So deleting work files on each test does not work, especially as we can no longer assume they are "left-overs" from a failed test - they may actually (and quite likely) belong to tests that run in parallel. So the proper solution is to do via "make clean". closes https://github.com/rsyslog/rsyslog/pull/2916
64 lines
1.9 KiB
Bash
Executable File
64 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# This file is part of the rsyslog project, released under ASL 2.0
|
|
|
|
# This test tests omprog using the default values for all non-mandatory
|
|
# settings. It also checks that command-line parameters are correctly
|
|
# passed to the external program.
|
|
|
|
# NOTE: Because the omprog feedback mode is not used in this test
|
|
# (confirmMessages=off), it is difficult to synchronize the execution
|
|
# of the external program with the test code. For this reason, it would
|
|
# be difficult to test for negative cases (e.g. restart of the program
|
|
# if it terminates prematurely) without making the test racy. So, we
|
|
# only test a happy case: the program processes all logs received and
|
|
# exits when the pipe is closed. After closing the pipe, omprog will
|
|
# wait for the program to terminate during a timeout of 5 seconds
|
|
# (default value of closeTimeout), which should be sufficient for the
|
|
# program to write its output.
|
|
|
|
. $srcdir/diag.sh init
|
|
generate_conf
|
|
add_conf '
|
|
module(load="../plugins/omprog/.libs/omprog")
|
|
|
|
template(name="outfmt" type="string" string="%msg%\n")
|
|
|
|
:msg, contains, "msgnum:" {
|
|
action(
|
|
type="omprog"
|
|
binary=`echo $srcdir/testsuites/omprog-defaults-bin.sh param1 param2 param3`
|
|
template="outfmt"
|
|
name="omprog_action"
|
|
hideEnvironment="off"
|
|
)
|
|
}
|
|
'
|
|
startup
|
|
. $srcdir/diag.sh wait-startup
|
|
. $srcdir/diag.sh injectmsg 0 10
|
|
. $srcdir/diag.sh wait-queueempty
|
|
shutdown_when_empty
|
|
wait_shutdown
|
|
|
|
expected_output="Starting with parameters: param1 param2 param3
|
|
Received msgnum:00000000:
|
|
Received msgnum:00000001:
|
|
Received msgnum:00000002:
|
|
Received msgnum:00000003:
|
|
Received msgnum:00000004:
|
|
Received msgnum:00000005:
|
|
Received msgnum:00000006:
|
|
Received msgnum:00000007:
|
|
Received msgnum:00000008:
|
|
Received msgnum:00000009:
|
|
Terminating normally"
|
|
|
|
written_output=$(<$RSYSLOG_OUT_LOG)
|
|
if [[ "$expected_output" != "$written_output" ]]; then
|
|
echo unexpected omprog script output:
|
|
echo "$written_output"
|
|
error_exit 1
|
|
fi
|
|
|
|
exit_test
|