docs: tweak formatting in pmrep(1) archive folio example
[pcp.git] / qa / 256
blob3613ca368bc56a17a4fcbca408b93987cf99a541
1 #!/bin/sh
2 # PCP QA Test No. 256
4 # Derived metrics and PMNS operations
6 # Copyright (c) 2009 Ken McDonell. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 unset PCP_DERIVED_CONFIG
19 status=0 # success is the default!
20 $sudo rm -rf $tmp.* $seq.full
21 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
23 # Derived metric expr dump from 0x8513a48...
24 # expr node 0x867eb68 type=PLUS left=0x867eb98 right=0x867ed28
25 _filter()
27 cat $tmp.out >>$seq.full
28 awk <$tmp.out >$tmp.sed '
29 BEGIN { n = 0 }
30 $1 == "expr" && $2 == "node" && $3 ~ /^0x/ { print "s/" $3 "/<addr-" n ">/"; n++ }
31 { next }'
32 echo "=== sed ===" >>$seq.full
33 cat $tmp.sed >>$seq.full
34 echo "=== end sed ===" >>$seq.full
35 sed -f $tmp.sed <$tmp.out \
36 | sed \
37 -e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*.*numpmid/TIMESTAMP ... numpmid/' \
38 -e 's/=0x0 /=(nil) /g' \
39 -e "s;$tmp;TMP;"
40 # -e 's/ val=[0-9][0-9]*/ val=<number>/g'
43 # expr node <addr-6> type=NAME left=(nil) right=(nil) save_last=1 [sample.pdu] master=0
44 # ...
45 # [0] inst=-1, val=49794
46 _filter2()
48 sed <$tmp.out -e 's/val=/val /' \
49 | awk >$tmp.sed2 '
50 BEGIN { n = 0 }
51 /expr.*sample\./ { want=1; next }
52 want == 1 && $3 == "val" { if (seen[$4] != "y") {
53 print "s/ val=" $4 "$/ val=<value-" n ">/"
54 n++
55 seen[$4] = "y"
58 $1 == "expr" { want = 0 }'
59 echo "=== sed2 ===" >>$seq.full
60 cat $tmp.sed2 >>$seq.full
61 echo "=== end sed2 ===" >>$seq.full
62 sed -f $tmp.sed2 \
63 | sed \
64 -e '/pmGetChildren(name="")/s/ [0-9][0-9]* regular/ N regular/' \
65 -e '/pmGetChildren/s/returns [0-9][0-9]/returns N/'
68 # real QA test starts here
70 echo "HOST context ..." | tee -a $seq.full
71 cat <<End-of-File >$tmp.config
72 myname.one = sample.long.one
73 myname.suba.two = 2*sample.long.one
74 myname.suba.three = 3*sample.long.one
75 myname.suba.subb.four = 4*sample.long.one
76 myname.suba.subb.subc.subd.five = 5*sample.long.one
77 myname.suba.subb.subc.subd.six = 6*sample.long.one
78 End-of-File
79 echo | tee -a $seq.full
80 cat $tmp.config | tee -a $seq.full
82 for args in myname.suba.subb.subc.subd.six myname.suba.subb myname \
83 myname.one.bad myname.suba.subb.subc.bad
85 echo | tee -a $seq.full
86 echo "=== -h localhost $args ===" | tee -a $seq.full
87 pminfo -h localhost -c $tmp.config $args >$tmp.out 2>&1
88 _filter
89 echo "=== -h localhost -f $args ===" | tee -a $seq.full
90 pminfo -h localhost -c $tmp.config -f $args >$tmp.out 2>&1
91 _filter
92 done
94 echo | tee -a $seq.full
95 echo "ARCHIVE context ..." | tee -a $seq.full
96 cat <<End-of-File >$tmp.config
97 sample.one = sample.longlong.one
98 sample.suba.two = 2*sample.longlong.one
99 sample.suba.three = 3*sample.longlong.one
100 sample.suba.subb.four = 4*sample.longlong.one
101 sample.suba.subb.subc.subd.five = 5*sample.longlong.one
102 sample.suba.subb.subc.subd.six = 6*sample.longlong.one
103 End-of-File
104 echo | tee -a $seq.full
105 cat $tmp.config | tee -a $seq.full
107 for args in sample.suba.subb.subc.subd.six sample.suba.subb sample \
108 sample.one.bad sample.suba.subb.subc.bad
110 echo | tee -a $seq.full
111 echo "=== -a archives/reduce-1 $args ===" | tee -a $seq.full
112 pminfo -a archives/reduce-1 -c $tmp.config $args >$tmp.out 2>&1
113 _filter
114 echo "=== -a archives/reduce-1 -f $args ===" | tee -a $seq.full
115 pminfo -a archives/reduce-1 -c $tmp.config -f $args >$tmp.out 2>&1
116 _filter
117 done
119 echo | tee -a $seq.full
120 echo "LOCAL context ..." | tee -a $seq.full
121 cat <<End-of-File >$tmp.config
122 sampledso.one = sampledso.longlong.one
123 sampledso.suba.two = 2*sampledso.longlong.one
124 sampledso.suba.three = 3*sampledso.longlong.one
125 sampledso.suba.subb.four = 4*sampledso.longlong.one
126 sampledso.suba.subb.subc.subd.five = 5*sampledso.longlong.one
127 sampledso.suba.subb.subc.subd.six = 6*sampledso.longlong.one
128 End-of-File
129 echo | tee -a $seq.full
130 cat $tmp.config | tee -a $seq.full
131 export PMDA_LOCAL_SAMPLE=yes
133 for args in sampledso.suba.subb.subc.subd.six sampledso.suba.subb sampledso \
134 sampledso.one.bad sampledso.suba.subb.subc.bad
136 echo | tee -a $seq.full
137 echo "=== -L $args ===" | tee -a $seq.full
138 $sudo pminfo -L -c $tmp.config $args >$tmp.out 2>&1
139 _filter
140 echo "=== -L -f $args ===" | tee -a $seq.full
141 $sudo pminfo -L -c $tmp.config -f $args >$tmp.out 2>&1
142 _filter \
143 | $PCP_AWK_PROG '
144 NF == 0 { want = 0; next }
145 $1 == "sampledso.one" { print ""; want = 1 }
146 $1 ~ /^sampledso\.suba\./ { print ""; want = 1 }
147 want == 1 { print }'
148 echo "=== -n .../root -L ===" | tee -a $seq.full
149 $sudo pminfo -L -c $tmp.config -n $PCP_VAR_DIR/pmns/root $args >$tmp.out 2>&1
150 _filter
151 echo "=== -n .../root ===" | tee -a $seq.full
152 export PCP_DERIVED_CONFIG=$tmp.config
153 src/nameall -n $PCP_VAR_DIR/pmns/root $args >$tmp.out 2>&1
154 _filter | sed -e '/Name space load:/s/[0-9.]* msec/N.NN msec/'
155 unset PCP_DERIVED_CONFIG
156 done
158 echo | tee -a $seq.full
159 echo "Splice-n-dice into existing PMNS ..." | tee -a $seq.full
160 cat <<End-of-File >$tmp.config
161 derived = sample.long.one
162 derived_tree.ten = sample.long.ten
163 derived_tree.hundred = sample.long.hundred
164 derived_tree.sample.long.million = sample.long.million
165 sample.long.derived = sample.long.one
166 sample.long.foo.bar.derived = sample.long.one
167 End-of-File
168 echo | tee -a $seq.full
169 cat $tmp.config | tee -a $seq.full
171 for args in "" derived derived_tree sample
173 echo | tee -a $seq.full
174 echo "=== $args ===" | tee -a $seq.full
175 pminfo -c $tmp.config $args 2>&1 | grep derived
176 done
178 echo | tee -a $seq.full
179 echo "Check diags ..." | tee -a $seq.full
180 cat <<End-of-File >$tmp.config
181 derived.tree.one = sample.long.one
182 derived.tree.ten = sample.long.ten
183 derived.tree.hundred = sample.long.hundred
184 derived.tree.a.million = sample.long.million
185 derived.tree.b.million = sample.long.million
186 derived.tree.b.cmillion = sample.long.million
187 sample.long.derived = sample.long.one
188 sample.long.foo.bar.derived = sample.long.one
189 End-of-File
190 cat $tmp.config
191 export PCP_DERIVED_CONFIG=$tmp.config
192 #debug# src/torture_pmns -Dall -h localhost derived.tree >$tmp.out 2>&1
193 src/torture_pmns -Dderive,appl1 -h localhost derived.tree >$tmp.out 2>&1
194 _filter | _filter2
196 # success, all done
197 exit