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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
#! /bin/sh
# PCP QA Test No. 178
# pmlogextract exerciser
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
trap "rm -f $tmp.*; exit" 0 1 2 3 15
#debug# tmp=`pwd`/tmp
_filter()
{
$PCP_AWK_PROG '
/\<mark\>/ { next }
/suspended/ { next }
/No values/ { noval++; next }
/\?/ { noval++; next }
/^[0-2][0-9]:/ { sample++; next }
END { printf "%d samples",sample
if (noval > 0) printf ", %d \"no values\"",noval
print ""
}'
}
_range()
{
$PCP_AWK_PROG '
'$1' <= $1 && $1 <= '$2' { print "Pass",$2,$3; next }
{ print "Fail (" $1 " " $2 " " $3 ")" }'
}
_stamp()
{
sed -e 's/ [0-2][0-9]:.*$/ datestamp/'
}
_count_rec()
{
$PCP_AWK_PROG '
/^[0-2][0-9]:.*\<mark\>/ { mark++; next }
/^[0-2][0-9]:/ { rec++; next }
END { printf "%d",rec
if (mark == 1) printf " (+%d mark)",mark
else if (mark > 1) printf " (+%d marks)",mark
print ""
}'
}
rm -f $seq.full $tmp.*
# real QA test starts here
cat >$tmp.a.config <<End-of-File
log mandatory on 600 msec sample.bin
End-of-File
cat >$tmp.b.config <<End-of-File
log mandatory on 300 msec {
sample.bin [ "bin-200" ]
sample.drift
}
End-of-File
cat >$tmp.c.config <<End-of-File
log mandatory on 300 msec {
sample.bin
sample.drift
}
End-of-File
# find a port for each pmlogger to use, avoiding (small!) race
# when starting multiple pmlogger processes at the same time.
port1=`_find_free_port`
port2=`expr $port1 + 1`
port2=`_find_free_port $port2`
port3=`expr $port2 + 1`
port3=`_find_free_port $port3`
# a and b concurrently
# a: 25 x 0.6 sec
# b: 20 x 0.3 sec
#
PMLOGGER_PORT=$port1 \
pmlogger -c $tmp.a.config -l $tmp.a.log -s 25 $tmp.a >$tmp.a.err 2>&1 &
PMLOGGER_PORT=$port2 \
pmlogger -c $tmp.b.config -l $tmp.b.log -s 20 $tmp.b >$tmp.b.err 2>&1 &
wait
echo "log for archive 'a' ..." >>$seq.full
cat $tmp.a.err $tmp.a.log | tee -a $seq.full | _filter_pmlogger_log
echo >>$seq.full
echo "log for archive 'b' ..." >>$seq.full
cat $tmp.b.err $tmp.b.log | tee -a $seq.full | _filter_pmlogger_log
# c later
#
PMLOGGER_PORT=$port3 \
pmlogger -c $tmp.c.config -l $tmp.c.log -s 10 $tmp.c >$tmp.c.err 2>&1
echo >>$seq.full
echo "log for archive 'c' ..." >>$seq.full
cat $tmp.c.err $tmp.c.log | tee -a $seq.full | _filter_pmlogger_log
echo "Full merge ..."
rm -f $tmp.merge.*
pmlogextract $tmp.a $tmp.b $tmp.c $tmp.merge
echo >>$seq.full
echo "Log record counts ..." | tee -a $seq.full
for i in a b c merge
do
$PCP_ECHO_PROG $PCP_ECHO_N "$i: ""$PCP_ECHO_C"
( echo; echo "=== $i ===" ) >>$seq.full
pmdumplog -m $tmp.$i | tee -a $seq.full | _count_rec
done
echo
echo 'sample.bin ["bin-200"] ... expect 55 samples'
pmval -i "bin-200" -U $tmp.merge sample.bin 2>&1 \
| _filter
echo
echo 'sample.bin ["bin-100"] ... expect 35 samples, 20 no values'
pmval -i "bin-100" -U $tmp.merge sample.bin 2>&1 \
| _filter
echo
echo "sample.drift ... expect 30 samples"
pmval -U $tmp.merge sample.drift 2>&1 \
| _filter
echo | tee -a $seq.full
echo "merge -s 10" | tee -a $seq.full
rm -f $tmp.merge.*
pmlogextract -s 10 $tmp.a $tmp.b $tmp.c $tmp.merge
$PCP_ECHO_PROG $PCP_ECHO_N "merge (expect 10): ""$PCP_ECHO_C"
pmdumplog -m $tmp.merge \
| tee -a $seq.full \
| _count_rec
# all of b + 11 from a
#
echo | tee -a $seq.full
echo "merge -T 6.9" | tee -a $seq.full
rm -f $tmp.merge.*
pmlogextract -T 6.9 $tmp.a $tmp.b $tmp.c $tmp.merge
$PCP_ECHO_PROG $PCP_ECHO_N "merge (expect 31 + 2 preamble + 1 mark): ""$PCP_ECHO_C"
pmdumplog -m $tmp.merge \
| tee -a $seq.full \
| _count_rec
# tail of a (less 1), none of b or c
echo | tee -a $seq.full
echo "merge -S 6.9 -T 7.2" | tee -a $seq.full
rm -f $tmp.merge.*
pmlogextract -S 6.9 -T 7.2 $tmp.a $tmp.b $tmp.c $tmp.merge
$PCP_ECHO_PROG $PCP_ECHO_N "merge (expect 12): ""$PCP_ECHO_C"
pmdumplog -m $tmp.merge \
| tee -a $seq.full \
| _count_rec
echo | tee -a $seq.full
echo "Full merge with volume switch ..." | tee -a $seq.full
rm -f $tmp.merge.*
pmlogextract -v 15 $tmp.a $tmp.b $tmp.c $tmp.merge 2>&1 \
| tee -a $seq.full \
| _stamp
echo "Log record counts ..." | tee -a $seq.full
for i in a b c merge
do
$PCP_ECHO_PROG $PCP_ECHO_N "$i: ""$PCP_ECHO_C"
( echo; echo "=== $i ===" ) >>$seq.full
pmdumplog -m $tmp.$i \
| tee -a $seq.full \
| _count_rec
done
for file in $tmp.merge.[0-9]*
do
mv $file $file.x
done
echo "Log record counts per merged volume ..." | tee -a $seq.full
for vol in `echo $tmp.merge.[0-9]* | sed -e "s;$tmp\\.merge\\.\\([0-9]*\\)\\.x;\\1;g"`
do
$PCP_ECHO_PROG $PCP_ECHO_N "volume $vol: ""$PCP_ECHO_C"
( echo; echo "=== volume $vol ===" ) >>$seq.full
mv $tmp.merge.$vol.x $tmp.merge.$vol
pmdumplog -m $tmp.merge \
| tee -a $seq.full \
| _count_rec
mv $tmp.merge.$vol $tmp.merge.$vol.x
done
|