File: 617

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (196 lines) | stat: -rwxr-xr-x 3,907 bytes parent folder | download
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#! /bin/sh
# PCP QA Test No. 617
# exercise PCP dbpmda interface
#
# Copyright (c) 2013 Red Hat.
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

if [ $# -eq 0 ]
then
    seq=`basename $0`
    echo "QA output created by $seq"
else
    # use $seq from caller, unless not set
    [ -n "$seq" ] || seq=`basename $0`
    echo "QA output created by `basename $0` $*"
fi

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

if [ "$1" = "--valgrind" ]
then
    _check_valgrind
fi

case "$PCP_PLATFORM"
in
    linux|solaris|freebsd|openbsd)
       PMDADSO=$PCP_PMDAS_DIR/sample/pmda_sample.so
       ;;
    darwin)
       PMDADSO=$PCP_PMDAS_DIR/sample/pmda_sample.dylib
       ;;
    *)
	echo "Arrgh ... need DSO name customization for $PCP_PLATFORM"
	exit 1
esac
export PMDADSO

status=0	# success is the default!
trap "$sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15

_filter()
{
    # in dbpmda's fillValues() strto*() may set errno (OpenIndiana) or
    # not (linux's), so the mapping at the end
    #
    sed \
	-e "s;$PMDADSO;PMDADSO;" \
	-e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
	-e 's/(pid: [0-9][0-9]*)/(pid: PID)/' \
	-e 's/parse error/Syntax error/' \
	-e 's/syntax error/Syntax error/' \
	-e '/^dbpmda> $/d' \
	-e '/pmResult/s/0x[^ ]*/ADDR/g' \
	-e '/DSO Interface Version:  /s/[5-9]/N/g' \
	-e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9]*[0-9]/TIMEZONE/g' \
	-e 's/Permission denied/No permission to perform requested operation/' \
        -e '/Error PDU/s/One-line/Oneline/' \
	-e "s@$tmp@TMP@g" \
	-e 's/Decoding value.*/Value "Hello there" is incompatible with metric type (PM_TYPE_32)/' \
    # end

# last sed substitution thanks to pv:937345 which changed the wording
# ... preserving the old form so QA passes
}

# real QA test starts here

cat <<End-of-File >$tmp.in
help
status
#a comment, this should be ignored
#test the debug and status commands
debug# a command with a trailing comment
help debug
debug all
status
debug none
debug appl0 timecontrol
status
debug none
status
debug blah
debug none
debug 1
debug pdu blah
debug none
debug blah fetch
debug none
open pipe /blah/this_file_should_not_exist
status
open dso /blah/this_file_should_not_exist blah_init 128
status
open pipe $PCP_PMDAS_DIR/sample/pmdasample -d 29 -l $tmp.log
status
#test the desc command
desc
desc 29.0.6
desc sample.bin
#test the instance command
instance
instance 29.2
instance 29.2 300
instance 29.2 "bin-100"
instance 29.2 "bin
instance "bin
instance 30.3
instance 29
instance -1
#test the timer command
timer
timer on
status
timer off
status
#test the fetch command
getdesc on
fetch
fetch 29.0.6
fetch sample.bin 29.0.5
fetch blah
fetch 29
fetch 0.29
fetch 0.1.2
#test the profile command
profile
profile 29.2 none
status
fetch 29.0.6
profile 29.2 add 200
status
fetch 29.0.6
profile 29.2 add 250
status
fetch 29.0.6
profile 29.2 add 300
status
fetch 29.0.6
profile 29.2 delete 200
status
fetch 29.0.6
profile 29.2 all
status
fetch 29.0.6
#test the text command
text
text 29.0.6
text indom 29.2
text indom 29.50
text blah 29.2
#test the store command
store
store 29.0.36 "42"
store 29.0.36 '43'
fetch sample.write_me
store 29.0.36
store 29.0.36 "57.3"
store 29.0.36 '57.3'
store 20.0.36 4
store sample.write_me "Hello there"
fetch sample.write_me
store sample.string.write_me "Hello I'm here"
fetch sample.string.write_me
store sample.string.write_me '"hello world" to you too'
fetch sample.string.write_me
store 29.0.20 "3"
store 0.0.0 "5"
store sample.aggregate.write_me "foo bar"
store sample.event.records "foo bar"
#test the close and open commands
close
status
open dso $PMDADSO sample_init 30
status
close
status
#other
blah
quit
End-of-File

if [ "$1" = "--valgrind" ]
then
    TERM=ansi _run_valgrind --sudo dbpmda -ie <$tmp.in
else
    TERM=ansi $sudo dbpmda -ie <$tmp.in 2>&1
fi \
| _filter

cat $tmp.log >>$seq_full

exit