summaryrefslogtreecommitdiff
path: root/qa/572
blob: 46f2be8ebcd482f1e83e4440535e2fc52abe7476 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#! /bin/sh
# PCP QA Test No. 572
# pmcd agent table relocation and libpcp_pmda botch for PMDA_INTERFACE_3.
# linux PMDA returns no values after weblog Install was the original
# observation.
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

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

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

pmcdconf=$PCP_PMCDCONF_PATH
rootconf=$PCP_VAR_DIR/pmns/root
needclean=false

unset ROOT TOOLROOT MAKEFLAGS

_cleanup()
{
    if $needclean
    then
	[ -f $tmp.pmcd.bak ] && $sudo cp $tmp.pmcd.bak $pmcdconf
	[ -f $tmp.root.bak ] && $sudo cp $tmp.root.bak $rootconf
	$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
	$sudo rm -f $tmp.*
	needclean=false
    fi
}

_filter_make()
{
    sed \
	-e '/In function .vpmprintf./d' \
	-e '/warning: the use of .tempnam./d' \
	-e '/make: Nothing to be done/d'
}

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

# create a basic pmcd config file
if [ $PCP_PLATFORM = linux -o $PCP_PLATFORM = solaris ]
then
cat >$tmp.pmcd.conf << EOF
# from QA $seq
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
EOF
elif [ $PCP_PLATFORM = irix ]
then
cat >$tmp.pmcd.conf << EOF
# from QA $seq
pmcd	2	dso	pmcd_init	pmda_pmcd.so
EOF
elif [ $PCP_PLATFORM = darwin ]
then
cat >$tmp.pmcd.conf << EOF
# from QA $seq
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
EOF
else
    echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
    exit 1
fi

# create my pmns
cat <<End-of-File >$tmp.pmns
root {
	pmcd
	sample
	trivial
	simple
}
pmcd {
    	numagents	2:0:2
}
sample {
	string
}
sample.string {
	write_me	29:0:32
}
trivial {
	time		250:0:0
}
simple {
	numfetch	253:0:0
}
End-of-File

# real QA test starts here
cp $pmcdconf $tmp.pmcd.bak
cp $rootconf $tmp.root.bak

needclean=true
$sudo cp $tmp.pmcd.conf $pmcdconf 
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start

for pmda in '' sample trivial simple
do
    echo
    if [ ! -z "$pmda" ]
    then
	echo "=== $pmda PMDA ==="
	cd $PCP_PMDAS_DIR/$pmda
	$sudo ./Install </dev/null >/dev/null 2> $tmp.stderr
        # strip blank lines from stderr
        # strip cc warning messages (assumed to be 4 non-blanks long)
	cat $tmp.stderr | _filter_make | \
        $PCP_AWK_PROG  '
            /^ *$/ {
                next 
            }
            /^cc-.*cc: WARNING/ {
                getline ; getline ; getline ; getline
                next
            }
            {    
                print
            }
        '
    fi
    pmstore -n $tmp.pmns sample.string.write_me "$pmda"
    pminfo -n $tmp.pmns -f \
	pmcd.numagents \
	sample.string.write_me \
	trivial.time \
	simple.numfetch \
    | $PCP_AWK_PROG '
mask == 1	{ if ($1 == "value") $2 = "NUMBER"
		  mask = 0
		}
		{ print }
/pmcd.numagents/ && "'"$pmda"'" == ""	{ mask = 1 }
/trivial.time$/	{ mask = 1 }'

done

status=0
exit