qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 489
blobb1217cc89ba0ef829f4233a99e9b04e6d1137f82
1 #!/bin/sh
2 # PCP QA Test No. 489
3 # exercise pmdaCacheStoreKey()
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 status=0 # success is the default!
17 $sudo rm -rf $tmp.* $seq.full
18 trap "$sudo rm -f $tmp.* $PCP_VAR_DIR/config/pmda/42.42; exit \$status" 0 1 2 3 15
20 # real QA test starts here
21 for arg in -k '' -d '-l -Dindom' -dk '-l -Dindom'
23 echo | tee -a $seq.full
24 echo "=== keycache $arg ===" | tee -a $seq.full
26 case "$arg"
28 -l*)
31 $sudo rm -f $PCP_VAR_DIR/config/pmda/42.42
33 esac
35 $sudo src/keycache $arg >$tmp.out 2>&1
36 cat $tmp.out >>$seq.full
38 case "$arg"
40 -l*)
43 echo "First few lines of output ..."
44 head -20 $tmp.out
45 echo
46 echo "Duplicate instance ids ... expect none"
47 sed -n <$tmp.out \
48 -e '/pmdaCacheDump:/q' \
49 -e '/active 0x0/s//active (nil)/' \
50 -e '/ -> /s/ -> .*//p' \
51 | sort \
52 | uniq -c \
53 | grep -v ' 1 '
55 esac
57 case "$arg"
59 -d*|-l*)
60 $PCP_AWK_PROG <$tmp.out '
61 /pmdaCacheDump:/ { want = 1 }
62 want == 1 { print }' \
63 | sed -e '/active 0x0/s//active (nil)/'
67 echo
68 echo "Check distribution ..."
69 $PCP_AWK_PROG <$tmp.out '
70 /Instances distribution across/ { want=1
71 nb = $4
72 if ($4 <= 8) {
73 minp = 0.95 * (1 / nb)
74 maxp = 1.05 * (1 / nb)
76 else if ($4 <= 16) {
77 minp = 0.90 * (1 / nb)
78 maxp = 1.10 * (1 / nb)
80 else if ($4 <= 64) {
81 minp = 0.80 * (1 / nb)
82 maxp = 1.20 * (1 / nb)
84 else {
85 minp = 0.75 * (1 / nb)
86 maxp = 1.25 * (1 / nb)
88 print
89 next
91 want == 1 && NF == 0 { want = 0 }
92 want == 1 { for (i = 1; i <= NF; i++) {
93 if (minp <= $i && $i <= maxp)
94 printf "OK "
95 else
96 printf "%s not in (%.4f,%.4f) ",$i,minp,maxp
98 print ""
101 esac
102 done
104 # success, all done
105 exit