summaryrefslogtreecommitdiff
path: root/qa/525
blob: ebceba020d16d1f15f541bddfb1e12949a3582c2 (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
#!/bin/sh
# PCP QA Test No. 525
# Units from summary botched after avg_host added to metric declaration.
#
# From a report by Jun Wang, junwang123@gmail.com
#
# Copyright (c) 2013 Ken McDonell.  All Rights Reserved.
#

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

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

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

# check if summary PMDA already installed
#
eval `pmprobe summary 2>&1 | awk '
BEGIN	{ sts = "false" }
$2 > 0	{ sts = "true"; exit }
END	{ print "reinstall=" sts }'`

_cleanup()
{
    cd $PCP_VAR_DIR/pmdas/summary
    for file in pmns expr.pmie help
    do
	[ -f $file.$seq ] && $sudo mv $file.$seq $file
    done
    if $reinstall
    then
	$sudo ./Install </dev/null >>$here/$seq.full 2>&1
    else
	$sudo ./Remove >>$here/$seq.full 2>&1
    fi
    cd $here
    rm -rf $tmp.*
}

cat >$tmp.pmns <<End-of-File
/* for QA $seq */
summary {
    mem		SYSSUMMARY:0:0
    avg_mem	SYSSUMMARY:0:1
    qa
}
summary.qa {
    t01		SYSSUMMARY:1:1
    t02		SYSSUMMARY:1:2
    t03		SYSSUMMARY:1:3
    t04		SYSSUMMARY:1:4
    t05		SYSSUMMARY:1:5
    t06		SYSSUMMARY:1:6
}
End-of-File

cat >$tmp.expr.pmie <<End-of-File
summary.mem = sample.kbyte_ctr;
summary.avg_mem = avg_host sample.kbyte_ctr :'localhost' :'127.0.0.1';
// now some extra tests after pmie has been fixed
summary.qa.t01 = sample.kbyte_ctr + 1;
summary.qa.t02 = sample.kbyte_ctr + 1 Kbyte / sec;
summary.qa.t03 = some_inst sample.long.bin_ctr > 0;
summary.qa.t04 = all_inst sample.long.bin_ctr > 0;
summary.qa.t05 = min_inst sample.long.bin_ctr;
summary.qa.t06 = max_inst sample.long.bin_ctr;
End-of-File

echo >$tmp.help

cd $PCP_VAR_DIR/pmdas/summary

for file in pmns expr.pmie help
do
    $sudo mv $file $file.$seq
    $sudo mv $tmp.$file $file
done
$sudo ./Install </dev/null | _filter_pmda_install

# real QA test starts here
pminfo -d summary | tee -a $here/$seq.full
pminfo -f summary >>$here/$seq.full

cat $PCP_LOG_DIR/pmcd/summary.log >>$here/$seq.full

echo >>$here/$seq.full
echo "--- pmie directly ---" >>$here/$seq.full
pmie -v -t 1 -T +2 -c expr.pmie >>$here/$seq.full 2>&1

# success, all done
status=0

exit