summaryrefslogtreecommitdiff
path: root/qa/498
blob: 3a68e44b1bbf30c89ee798e235821497c6a7d113 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
# PCP QA Test No. 498
# exercise pmdaEventQueue interfaces
#
# Copyright (c) 2011 Nathan Scott.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

rm -f $seq.out
if [ $PCP_VER -lt 3604 ]
then
    ln $seq.out.1 $seq.out || exit 1
elif [ $PCP_VER -lt 3605 ]
then
    ln $seq.out.2 $seq.out || exit 1
else
    ln $seq.out.3 $seq.out || exit 1
fi

status=0	# success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

_filter()
{
    sed \
        -e 's/^\[[A-Z].. [A-Z]..  *[0-9][0-9]* ..:..:..]/[DATE]/' \
        -e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/[TIME]/' \
	-e 's/event=0x0$/event=(nil)/' \
        -e 's/0x[0-9a-f][0-9a-f]*/0xADDR/' \
        -e 's/queue([0-9][0-9]*)/queue(PID)/' \
        -e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;"
}

_queue_test()
{
    # always enable library debugging, stash raw results and output filtered
    src/pmdaqueue -Dlibpmda $@ 2>&1 | tee -a $seq.full | _filter
}

# real QA test starts here
echo
echo "events arriving with no queues setup yet (fail)"
_queue_test -E 0,1024

echo
echo "attempt to register duplicate queue names (fail)"
_queue_test -q queue1,1024 -q queue1,1024

echo
echo "attempt queue creation without memory limit (fail)"
_queue_test -q queue1,0

echo
echo "create one queue, events arriving with no clients yet"
_queue_test -q queue1,1024 -e queue1,128 -e queue1,42 -e queue1,18 -s queue1

echo
echo "multiple queues, events arriving without clients"
_queue_test \
    -q queue0,1024 -q queue1,512 \
    -e queue0,128 -e queue1,24 -e queue0,18 \
	-e queue1,228 -e queue0,142 -e queue1,28 \
    -s queue0 -s queue1 \
    -q queue2,356 \
    -e queue2,328 -e queue2,32 -e queue0,17 -e queue1,227 \
    -s queue0 -s queue1 -s queue2

echo
echo "single queue, single client, coming and going, no events arriving"
_queue_test -q queue0,1024 -c 1 -S 1,queue0 -s queue0 -C 1 -s queue0

echo
echo "single queue, single client, coming and going, with events arriving"
_queue_test \
    -q queue0,1024 \
    -c 1 -A1,queue0 \
    -s queue0 -S 1,queue0 \
    -e queue0,24 \
    -s queue0 -S 1,queue0 \
    -C 1 \
    -s queue0

echo
echo "single queue, single client, queue filling up"
_queue_test \
    -q queue0,42 \
    -c 1 \
    -A 1,queue0 \
    -s queue0 -S 1,queue0 \
    -e queue0,24 \
    -e queue0,2 \
    -e queue0,8 \
    -s queue0 -S 1,queue0 \
    -e queue0,28 \
    -e queue0,28 \
    -s queue0 -S 1,queue0

echo
echo "single queue, single filtering client"
_queue_test \
    -q queue0,42 \
    -c 1 -A1,queue0 \
    -f 1,queue0,10 \
    -s queue0 -S 1,queue0 \
    -e queue0,24 \
    -e queue0,2 \
    -e queue0,8 \
    -s queue0 -S 1,queue0 \
    -e queue0,28 \
    -e queue0,28 \
    -s queue0 -S 1,queue0

echo
echo "multiple queues, multiple clients coming and going, queues filling"
_queue_test \
    -q queue0,1024 -q queue1,512 -q queue2,356 \
    -c 84 -A 84,queue0 -c 42 -A 42,queue1 -c 21 -A 21,queue1 \
    -S 84,queue0 -S 42,queue1 -S 21,queue1 \
    -e queue0,128 -e queue1,24 -e queue0,18 \
	-e queue1,228 -e queue0,142 -e queue1,28 \
    -s queue0 -S 84,queue0 -s queue1 -S 42,queue1 -s queue2 -S 21,queue2 \
    -C 84 \
    -e queue2,328 -e queue2,32 -e queue0,17 -e queue1,227 \
    -c 84 -C 42 -c 21 \
    -s queue0 -S 84,queue0 -s queue1 -S 42,queue1 -s queue2 -S 21,queue2

echo
echo "ad-hoc queues, multiple clients coming and going, queues filling"
_queue_test \
    -q queue0,1024 -q queue1,512 \
    -c 84 -A 84,queue0 -c 42 -A 42,queue1 -c 21 -A 21,queue1 \
    -S 84,queue0 -S 42,queue1 -S 21,queue1 \
    -e queue0,128 -e queue1,24 -e queue0,18 \
	-e queue1,228 -e queue0,142 -e queue1,28 \
    -q queue2,356 \
    -s queue0 -S 84,queue0 -s queue1 -S 42,queue1 -s queue2 -S 21,queue2 \
    -C 84 \
    -e queue2,328 -e queue2,32 -e queue0,17 -e queue1,227 \
    -c 84 -C 42 -c 21 \
    -s queue0 -S 84,queue0 -s queue1 -S 42,queue1 -s queue2 -S 21,queue2

# success, all done
exit