summaryrefslogtreecommitdiff
path: root/qa/715
blob: ad98ccd584a52fcea0340ea795d6b14577d473b4 (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
#! /bin/sh
# PCP QA Test No. 715
# Basic checkout of the Perl pmdasimple implementation.
#
# Copyright (c) 2013 Red Hat.
#

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

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

rm -f $seq.out $seq.full
if [ $PCP_VER -ge 3801 ]
then
    ln $seq.out.2 $seq.out || exit 1
else
    ln $seq.out.1 $seq.out || exit 1
fi

perl -e "use PCP::PMDA" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "perl PCP::PMDA module not installed"

_cleanup()
{
    _restore_pmda_install simple
    rm -f $tmp.*
    exit $status
}

status=1
trap "_cleanup" 0 1 2 3 15

# real QA test starts here
_prepare_pmda_install simple

echo
echo "=== $iam agent installation ==="
cat << End-of-File | $sudo ./Install -e >$tmp.out 2>&1
both
perl
End-of-File
# Check simple metrics have appeared ... X metrics and Y values
_filter_pmda_install <$tmp.out

check()
{
    iter=$1
    name=$2

    echo "fetch pmprobe #$iter - $name" | tee -a $here/$seq.full
    pmprobe -v $iam \
    | LC_COLLATE=POSIX sort > $tmp.pmprobe
    cat $tmp.pmprobe >>$here/$seq.full

    echo "check pmprobe #$iter - $name" | tee -a $here/$seq.full
    cat $tmp.pmprobe \
    | while read metric nv v1
    do
	if [ "$metric" = "simple.numfetch" ]
	then
	    echo "$metric shows $nv value(s), $v1 fetches so far"
	else
	    echo "$metric shows $nv value(s)"
        fi
    done
}

echo
echo "=== fetch and check values ==="
echo sec,min,hour > $tmp.conf && $sudo mv $tmp.conf simple.conf
check 1 defaults
echo sec,min > $tmp.conf && $sudo mv $tmp.conf simple.conf
check 2 twotimes
echo hour > $tmp.conf && $sudo mv $tmp.conf simple.conf
check 3 onetime
echo > $tmp.conf && $sudo mv $tmp.conf simple.conf
check 4 notime

# reset the clock back to the start state
echo sec,min,hour > $tmp.conf && $sudo mv $tmp.conf simple.conf

echo "=== remove $iam agent ==="
$sudo ./Remove >$tmp.out 2>&1
_filter_pmda_remove <$tmp.out

status=0
exit