summaryrefslogtreecommitdiff
path: root/qa/411
blob: 9a043cf803a49d3343eaad0eea881ca404ff85d4 (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
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
#! /bin/sh
# PCP QA Test No. 411
# exercising the simple pmdas dynamic instance domain
#
# 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.check
. ./common.filter

rm -f $seq.out
if pminfo -f simple.now | grep '3600 or "hour"' >/dev/null
then
    # old simple with indom 1, 60, 3600
    ln $seq.out.0 $seq.out || exit 1
else
    # new simple with indom 0, 1, 2
    if [ $PCP_VER -lt 3600 ]
    then
	ln $seq.out.1 $seq.out || exit 1
    else
	ln $seq.out.2 $seq.out || exit 1
    fi
fi

status=1	# failure is the default!
trap "_cleanup" 0 1 2 3 15

_cleanup()
{
    [ -f $iam.conf.$seq ] && $sudo mv $iam.conf.$seq $iam.conf
    $sudo ./Install </dev/null >/dev/null 2>&1
    $sudo rm -f $tmp.*
    exit $status
}

unset ROOT TOOLROOT MAKEFLAGS

_time_filter()
{
    sed \
	-e 's/[0-9][0-9]*/[NUMBER]/g'
}

_pmda_filter()
{
    _filter_pmda_install \
    | sed \
	-e 's/or python //g' \
	-e 's/or perl //g' \

}

# real QA test starts here
home=$PCP_PMDAS_DIR
iam=simple
if [ ! -d $home/$iam ]
then
    echo "Where is $home/$iam?"
    exit 1
fi
cd $home/$iam
unset ROOT

$sudo mv $iam.conf $iam.conf.$seq

echo "sec,min,hour" >$tmp.conf
$sudo cp $tmp.conf $home/$iam/$iam.conf

if $sudo make clobber >$tmp.out 2>&1
then
    :
else
    cat $tmp.out
    echo "Arrgh, make clobber failed"
    exit
fi

# start from a known starting point
$sudo ./Remove >/dev/null 2>&1

$sudo ./Install -e </dev/null >$tmp.out 2>&1
_pmda_filter <$tmp.out

# exercise various configuration file entries (updated on the fly) ...
# check all together
cat > $tmp.test1 << EOF
sec,min,hour
EOF
# should just get min
cat > $tmp.test2 << EOF
min, hour
EOF
# empty file (should fall back to previous config)
cat > $tmp.test3 << EOF
EOF
# should just get hour
cat > $tmp.test4 << EOF
sdj, min,hour,df
mday
EOF
# multiple entries the same ... should get just one instance returned
cat > $tmp.test5 << EOF
sec,sec,sec
EOF

# cp over prev config and then filter pminfo calls for each test
for test in $tmp.test1 $tmp.test2 $tmp.test3 $tmp.test4 $tmp.test5
do
    $sudo cp $test $home/$iam/$iam.conf
    sync
    sleep 3
    pminfo -f simple.now | _time_filter
    $sudo rm -f $home/$iam/$iam.conf
done
$sudo cp $tmp.conf $home/$iam/$iam.conf

# remove the agent
$sudo ./Remove >$tmp.out 2>&1
_pmda_filter <$tmp.out

status=0
exit