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 200 201 202 203 204 205 206 207 208 209 210
|
#! /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 ""
}'
}
# 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`
# Avoid derived metrics delay at startup ... want "a" and "b" to run
# as close as possible to concurrently
#
PCP_DERIVED_CONFIG=; export PCP_DERIVED_CONFIG
# a and b concurrently
# a: 25 x 0.6 sec + prologue + epilogue = 27
# b: 20 x 0.3 sec + prologue + epilogue = 22
#
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
sleep 2
# c later
# c: 10 x 0.3 sec + prologue + epilogue = 12
#
PMLOGGER_PORT=$port3 \
pmlogger -c $tmp.c.config -l $tmp.c.log -s 10 $tmp.c >$tmp.c.err 2>&1
echo >>$seq_full
wait
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
pmlogextract -s 10 $tmp.a $tmp.b $tmp.c $tmp.merge-10
$PCP_ECHO_PROG $PCP_ECHO_N "merge (expect 10): ""$PCP_ECHO_C"
pmdumplog -m $tmp.merge-10 \
| tee -a $seq_full \
| _count_rec
# all of a + b
#
echo | tee -a $seq_full
echo "merge -T 16" | tee -a $seq_full
pmlogextract -T 16 $tmp.a $tmp.b $tmp.c $tmp.merge-T16
$PCP_ECHO_PROG $PCP_ECHO_N "merge (expect 49): ""$PCP_ECHO_C"
pmdumplog -m $tmp.merge-T16 \
| tee -a $seq_full \
| _count_rec
# all of c, none of a or b
echo | tee -a $seq_full
echo "merge -S 16" | tee -a $seq_full
pmlogextract -S 16 $tmp.a $tmp.b $tmp.c $tmp.merge-S16
$PCP_ECHO_PROG $PCP_ECHO_N "merge (expect 12): ""$PCP_ECHO_C"
pmdumplog -m $tmp.merge-S16 \
| tee -a $seq_full \
| _count_rec
echo | tee -a $seq_full
echo "Full merge with volume switch ..." | tee -a $seq_full
pmlogextract -v 15 $tmp.a $tmp.b $tmp.c $tmp.merge-mv 2>&1 \
| tee -a $seq_full \
| _stamp
echo "Log record counts ..." | tee -a $seq_full
for i in a b c merge-mv
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-mv.[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-mv.[0-9]* | sed -e "s;$tmp\\.merge-mv\\.\\([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-mv.$vol.x $tmp.merge-mv.$vol
pmdumplog -m $tmp.merge-mv \
| tee -a $seq_full \
| _count_rec
mv $tmp.merge-mv.$vol $tmp.merge-mv.$vol.x
done
for file in $tmp.merge-mv.[0-9]*
do
file=`echo $file | sed -e 's/\.x$//'`
mv $file.x $file
done
|