Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 525
bloba7767db89ffba2256090c3ff76db08bad9c1546f
1 #!/bin/sh
2 # PCP QA Test No. 525
3 # Units from summary botched after avg_host added to metric declaration.
5 # From a report by Jun Wang, junwang123@gmail.com
7 # Copyright (c) 2013 Ken McDonell. All Rights Reserved.
8 # Copyright (c) 2015 Red Hat.
11 seq=`basename $0`
12 echo "QA output created by $seq"
14 # get standard environment, filters and checks
15 . ./common.product
16 . ./common.filter
17 . ./common.check
19 [ -f $PCP_PMDAS_DIR/summary/pmdasummary ] || _notrun "summary pmda not installed"
21 status=1 # failure is the default!
22 $sudo rm -rf $tmp.* $seq.full
23 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # check if summary PMDA already installed
27 eval `pmprobe summary 2>&1 | awk '
28 BEGIN { sts = "false" }
29 $2 > 0 { sts = "true"; exit }
30 END { print "reinstall=" sts }'`
32 _cleanup()
34 cd $PCP_VAR_DIR/pmdas/summary
35 for file in pmns expr.pmie help
37 [ -f $file.$seq ] && $sudo mv $file.$seq $file
38 done
39 if $reinstall
40 then
41 $sudo ./Install </dev/null >>$here/$seq.full 2>&1
42 else
43 $sudo ./Remove >>$here/$seq.full 2>&1
45 cd $here
46 rm -rf $tmp.*
49 cat >$tmp.pmns <<End-of-File
50 /* for QA $seq */
51 summary {
52 mem SYSSUMMARY:0:0
53 avg_mem SYSSUMMARY:0:1
56 summary.qa {
57 t01 SYSSUMMARY:1:1
58 t02 SYSSUMMARY:1:2
59 t03 SYSSUMMARY:1:3
60 t04 SYSSUMMARY:1:4
61 t05 SYSSUMMARY:1:5
62 t06 SYSSUMMARY:1:6
64 End-of-File
66 cat >$tmp.expr.pmie <<End-of-File
67 summary.mem = sample.kbyte_ctr;
68 summary.avg_mem = avg_host sample.kbyte_ctr :'localhost' :'127.0.0.1';
69 // now some extra tests after pmie has been fixed
70 summary.qa.t01 = sample.kbyte_ctr + 1;
71 summary.qa.t02 = sample.kbyte_ctr + 1 Kbyte / sec;
72 summary.qa.t03 = some_inst sample.long.bin_ctr > 0;
73 summary.qa.t04 = all_inst sample.long.bin_ctr > 0;
74 summary.qa.t05 = min_inst sample.long.bin_ctr;
75 summary.qa.t06 = max_inst sample.long.bin_ctr;
76 End-of-File
78 echo >$tmp.help
80 cd $PCP_VAR_DIR/pmdas/summary
82 for file in pmns expr.pmie help
84 $sudo mv $file $file.$seq
85 $sudo mv $tmp.$file $file
86 done
87 $sudo ./Install </dev/null | _filter_pmda_install
89 # real QA test starts here
90 pminfo -d summary | tee -a $here/$seq.full
91 pminfo -f summary >>$here/$seq.full
93 cat $PCP_LOG_DIR/pmcd/summary.log >>$here/$seq.full
95 echo >>$here/$seq.full
96 echo "--- pmie directly ---" >>$here/$seq.full
97 pmie -v -t 1 -T +2 -c expr.pmie >>$here/$seq.full 2>&1
99 # success, all done
100 status=0
102 exit