blob: 2649c8b43eea9cd23c203fb2f6cdb35cea632d37 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/bin/bash
# This is part of the rsyslog testbench, licensed under GPLv3
. ${srcdir:=.}/diag.sh init
. $srcdir/diag.sh check-inotify-only
generate_conf
add_conf '
global(workDirectory="'${RSYSLOG_DYNNAME}'.spool")
module(load="../plugins/imfile/.libs/imfile" mode="inotify" PollingInterval="1")
/* Filter out busy debug output */
global( debug.whitelist="off"
debug.files=["rainerscript.c", "ratelimit.c", "ruleset.c", "main Q", "msg.c", "../action.c"])
input(type="imfile" File="./'$RSYSLOG_DYNNAME'.input"
Tag="file:" Severity="error" Facility="local7" addMetadata="on")
template(name="outfmt" type="string" string="%msg:F,58:2%\n")
if $msg contains "msgnum:" then
action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt")
'
# generate small input file - state file must be inode only
./inputfilegen -m 1 > $RSYSLOG_DYNNAME.input
ls -li $RSYSLOG_DYNNAME.input
echo "STEP 1 - small input"
startup
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
echo "STEP 2 - still small input"
# add a bit to input file, but state file must still be inode only
./inputfilegen -m 1 -i1 >> $RSYSLOG_DYNNAME.input
ls -li $RSYSLOG_DYNNAME.input*
if [ $(ls ${RSYSLOG_DYNNAME}.spool/* | wc -l) -ne 1 ]; then
echo FAIL: more than one state file in work directory:
ls -l ${RSYSLOG_DYNNAME}.spool
error_exit 1
fi
startup
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
echo "STEP 3 - larger input, hash shall be used"
./inputfilegen -m 998 -i 2 >> $RSYSLOG_DYNNAME.input
ls -li $RSYSLOG_DYNNAME.input*
echo ls ${RSYSLOG_DYNNAME}.spool:
ls -l ${RSYSLOG_DYNNAME}.spool
startup
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
if [ $(ls ${RSYSLOG_DYNNAME}.spool/* | wc -l) -ne 1 ]; then
echo FAIL: more than one state file in work directory:
ls -l ${RSYSLOG_DYNNAME}.spool
error_exit 1
fi
echo "STEP 4 - append to larger input, hash state file must now be found"
./inputfilegen -m 1000 -i 1000 >> $RSYSLOG_DYNNAME.input
ls -li $RSYSLOG_DYNNAME.input*
echo ls ${RSYSLOG_DYNNAME}.spool:
ls -l ${RSYSLOG_DYNNAME}.spool
startup
shutdown_when_empty # shut down rsyslogd when done processing messages
wait_shutdown # we need to wait until rsyslogd is finished!
if [ $(ls ${RSYSLOG_DYNNAME}.spool/* | wc -l) -ne 1 ]; then
echo FAIL: more than one state file in work directory:
ls -l ${RSYSLOG_DYNNAME}.spool
error_exit 1
fi
seq_check 0 1999
exit_test
|