summaryrefslogtreecommitdiffstats
path: root/tests/omprog-output-capture.sh
blob: bbe62e9854417bf29b088b5812aadde4093d2fb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# This file is part of the rsyslog project, released under ASL 2.0

# This test tests the 'output' setting of omprog when the feedback
# feature is not used (confirmMessages=off).

. ${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="'$srcdir'/testsuites/omprog-output-capture-bin.sh"
        template="outfmt"
        name="omprog_action"
        output="'$RSYSLOG_OUT_LOG'"
        fileCreateMode="0644"  # default is 0600
    )
}
'
startup
injectmsg 0 10
wait_file_lines "$RSYSLOG_OUT_LOG" 22
shutdown_when_empty
wait_shutdown

export EXPECTED="[stdout] Starting
[stderr] Starting
[stdout] Received msgnum:00000000:
[stderr] Received msgnum:00000000:
[stdout] Received msgnum:00000001:
[stderr] Received msgnum:00000001:
[stdout] Received msgnum:00000002:
[stderr] Received msgnum:00000002:
[stdout] Received msgnum:00000003:
[stderr] Received msgnum:00000003:
[stdout] Received msgnum:00000004:
[stderr] Received msgnum:00000004:
[stdout] Received msgnum:00000005:
[stderr] Received msgnum:00000005:
[stdout] Received msgnum:00000006:
[stderr] Received msgnum:00000006:
[stdout] Received msgnum:00000007:
[stderr] Received msgnum:00000007:
[stdout] Received msgnum:00000008:
[stderr] Received msgnum:00000008:
[stdout] Received msgnum:00000009:
[stderr] Received msgnum:00000009:
[stdout] Terminating normally
[stderr] Terminating normally"
cmp_exact $RSYSLOG_OUT_LOG

exit_test