summaryrefslogtreecommitdiffstats
path: root/tests/da-mainmsg-q.sh
blob: 2ea6278eb856c88be43abefe9446552a32aa48e8 (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
# Test for DA mode on the main message queue
# This test checks if DA mode operates correctly. To do so,
# it uses a small in-memory queue size, so that DA mode is initiated
# rather soon, and disk spooling used. There is some uncertainty (based
# on machine speeds), but in general the test should work rather well.
# We add a few messages after the initial run, just so that we can
# check everything recovers from DA mode correctly.
# added 2009-04-22 by Rgerhards
# This file is part of the rsyslog project, released  under GPLv3
echo "testing main message queue in DA mode (going to disk)"
rm -f work rsyslog.out.log
rm -rf test-spool
mkdir test-spool
rm -f work rsyslog.out.log rsyslog.out.log.save # work files
../tools/rsyslogd -c4 -u2 -n -irsyslog.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/da-mainmsg-q.conf &
sleep 1
echo "rsyslogd started with pid " `cat rsyslog.pid`
#
# part1: send first 50 messages (in memory, only)
#
./tcpflood 127.0.0.1 13514 1 50
if [ "$?" -ne "0" ]; then
  echo "error during tcpflood! see rsyslog.out.log.save for what was written"
  cp rsyslog.out.log rsyslog.out.log.save
fi
ls -l test-spool
sleep 1 # we need this so that rsyslogd can receive all outstanding messages
#
# part 2: send bunch of messages. This should trigger DA mode
#
# 20000 messages should be enough - the disk test is slow enough ;)
./tcpflood 127.0.0.1 13514 2 20000 50
if [ "$?" -ne "0" ]; then
  echo "error during tcpflood! see rsyslog.out.log.save for what was written"
  cp rsyslog.out.log rsyslog.out.log.save
fi
ls -l test-spool
sleep 5 # we need this so that rsyslogd can receive all outstanding messages
#
# send another handful
#
ls -l test-spool
./tcpflood 127.0.0.1 13514 1 50 20050
if [ "$?" -ne "0" ]; then
  echo "error during tcpflood! see rsyslog.out.log.save for what was written"
  cp rsyslog.out.log rsyslog.out.log.save
fi
sleep 1 # we need this so that rsyslogd can receive all outstanding messages
# 
# clean up and check test result
#
kill `cat rsyslog.pid`
rm -f work
sort < rsyslog.out.log > work
./chkseq work 0 20099
if [ "$?" -ne "0" ]; then
 # rm -f work rsyslog.out.log
  echo "sequence error detected"
  exit 1
fi
rm -f work rsyslog.out.log
rm -rf test-spool