summaryrefslogtreecommitdiff
path: root/qa/022
blob: 1755c8142a1581e99bba6c95f4082f1b119fc95b (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. 022
# proc PMDA exerciser
#
# Copyright (c) 2013-2014 Red Hat.
# 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.filter
. ./common.check

pminfo proc.nprocs >/dev/null 2>&1 || _notrun "proc PMDA not installed"

# see if unix domain sockets are available (permissions)
_get_libpcp_config
target="-h localhost"
$unix_domain_sockets && target="-h unix:"

rm -f $seq.out $seq.full
test -f $seq.out.$PCP_PLATFORM || _notrun "No validated output for $PCP_PLATFORM"
ln $seq.out.$PCP_PLATFORM $seq.out

trap "rm -f $tmp.*; exit" 0 1 2 3 15

_filter_pmids()
{
    sed \
	-e 's/indom=[0-9][0-9]* \[/indom=INDOM [/g' \
	-e 's/3\.[0-9][0-9]*\.[0-9][0-9]*/PMID/g' \
	-e 's/\[3\.9]/[INDOM]/g' \
	-e 's/60\.[0-9][0-9]*\.[0-9][0-9]*/PMID/g' \
	-e 's/\[60\.9]/[INDOM]/g'
}

_proc_filter() 
{
    input=$1

    # Set variables pid, ppid, cpid for process ids
    eval `grep '^pid=' $input`
    eval `grep '^cpid=' $input`

    sed < $input \
	-e '/proc.memory.*.txt/s/valfmt: [01]/valfmt: 0-or-1/' \
	-e '/proc\.psinfo\.[us]time/s/valfmt: [01]/valfmt: 0-or-1/' \
	-e '/unknown pid/d' \
	-e 's/^/ /' \
	-e 's/$/ /' \
	-e "s/\([^0-9]\)0*$pid\([^0-9]\)/\1PID\2/g" \
	-e "s/\([^0-9]\)0*$ppid\([^0-9]\)/\1PPID\2/g" \
	-e "s/\([^0-9]\)0*$cpid\([^0-9]\)/\1CPID\2/g" \
	-e "s,$PCP_RUN_DIR/pmcd.socket,localhost," \
	-e 's/^ //' \
	-e 's/ $//' \
	-e 's/fd=[0-9][0-9]*/fd=N/g' \
	-e 's/refcnt=[0-9]/refcnt=N/g' \
	-e 's/inst \[.*\] value/inst [NNN] value/' \
	-e '/value /{
    s/value [0-9][0-9]*/value INTEGER/
    s/value ".*"/value STRING/
    s/value \[.*\]/value BINARYDATA/
    }' \
	-e '/pmResult/s/ .* numpmid/ ... numpmid/' \
    \
    | $PCP_AWK_PROG '
    /End Fetch Over Entire Instance Domain/	{ all = 0; print; next; }
    /Fetch Over Entire Instance Domain/	{ all = 1 }
    all == 1 && / inst \[/		{ next }
    all == 1 && /] value /		{ next }
    all == 1 && $3 == "numval:"		{ $4 = "LOTS" }
					{ print }' \
    | _filter_pmids

}

# real QA test starts here

echo "=== pminfo -F output ===" >$seq.full

# try fetching all proc metrics
# cull out the not supported msg component
pminfo $target -F proc \
| tee -a $seq.full \
| _inst_value_filter \
| sed -e '/value/d' \
    -e '/not supported/d' \
    -e '/instance identifier/d' \
    -e '/^[ \t]*$/d' \
    -e '/DISAPPEARED/d' \
    -e '/^proc\.fd\.count$/d'

src/proc_test $target \
	proc.psinfo.utime \
	proc.psinfo.stime \
	proc.memory.rss \
	proc.memory.size \
	> $tmp.out 2>&1
code=$?

echo >>$seq.full
echo "=== src/proc_test output ===" >>$seq.full
cat $tmp.out >>$seq.full

_proc_filter $tmp.out

if [ $code != 0 ]
then
    echo $0: FAILED proc_test exit status = $code
    echo $0: see $seq.full
    exit 1
fi

#
# fetch all instances for one metric in each cluster 
# if new clusters are added, add more here
#
echo ""
echo "All instances for selected metrics ..."
pminfo $target -F 2>$tmp.err \
	proc.nprocs \
	proc.psinfo.sname \
	proc.memory.textrss \
	proc.runq.sleeping \
| sed \
    -e '/Error: proc_instance: unknown pid:/d' \
    -e '/^  *value /d' \
    -e '/^  *inst /d' \
    -e '/^"] value/d'

sed -e '/unknown pid/d' $tmp.err > $tmp.err1

if [ -s $tmp.err1 ]
then
	echo Following is unexpected stderr output from pminfo \| sed
	echo "--------"
	cat $tmp.err1
	echo "--------"
fi

exit 0