Drop unused condition check
[pcp.git] / qa / 120
blob8f406a0aa93414658df0668eebb43774033fbe0f
1 #! /bin/sh
2 # PCP QA Test No. 120
4 # Verify some irix.resource.efs metrics
6 # See the instructions below for updating expected ranges (search for NOTE)
8 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
11 seq=`basename $0`
12 echo "QA output created by $seq"
14 # get standard filters
15 . ./common.product
16 . ./common.filter
18 rm -rf $tmp.*
20 # Find an efs filesystem ... if you do not have one, abandon ship
22 efs=`df 2>/dev/null \
23 | grep -v CDROM \
24 | $PCP_AWK_PROG ' $2 == "efs" { print $NF; exit }'`
26 if [ "X$efs" = "X" ]
27 then
28 # not much you can do if no EFS filesystem found ...
29 sed 1d <$seq.out
30 exit 0
33 [ ! -d $efs/$$ ] && $sudo mkdir $efs/$$
34 $sudo chmod 777 $efs/$$
36 trap "$sudo rm -rf $tmp.* $efs/$$" 0 1 2 3 15
38 # real QA starts here
40 # Don't change this lightly---the DELTAS will require tuning
42 nfiles=250
44 # Find metric values and metric names in $tmp.vals.1
46 pminfo -f irix.resource.efs \
47 | $PCP_AWK_PROG '
48 /^$/ { next }
49 /^No val/ { next }
50 /^irix./ { metric = $1 }
51 / value / { print metric, $2 }
52 { next } ' \
53 | LC_COLLATE=POSIX sort \
54 > $tmp.vals.1
56 # Generate some efs activity
58 cd $efs/$$
59 $here/src/mkfiles xxx $nfiles
61 # Get the new values of the metrics
62 pminfo -f irix.resource.efs \
63 | $PCP_AWK_PROG '
64 /^$/ { next }
65 /^No val/ { next }
66 /^irix./ { metric = $1 }
67 / value / { print metric, $2 }
68 { next } ' \
69 | LC_COLLATE=POSIX sort \
70 > $tmp.vals.2
72 # clean up mkfiles' handiwork
74 cd $here
75 if $sudo rm -rf $efs/$$
76 then
78 else
79 echo "Error removing files to exercise efs from $efs/$$"
80 exit 1
83 # Create and execute a shell script which computes the differences between
84 # the efs metrics and displays the equivalent of
85 # printf("%d\t%s", delta, metric_name)
87 echo '#!/bin/sh' >$tmp.sh
88 LC_COLLATE=POSIX join -j 1 -o 2.2 1.2 1.1 -e ERR $tmp.vals.1 $tmp.vals.2 \
89 | $PCP_AWK_PROG '{ printf "echo %s `expr %d - %d`\n", $3, $1, $2 }' \
90 >> $tmp.sh
91 sh $tmp.sh >$tmp.delta
93 # NOTE : how to update the expected value ranges
94 # When new metrics appear use this to determine what resonable differences
95 # may be expected:
97 # echo "DELTAS:"
98 # cat $tmp.delta
99 # echo ""
101 # Here is where to paste the new values AFTER adjusting them to multiples of
102 # the expected minimum delta (nfiles). Values less than the minimum delta
103 # should NOT appear.
105 # Things to beware of!
107 # 1. Use only nondeterministic metrics. Some metrics rely on kernel data
108 # structures which may or not be populated with the "right" objects when the
109 # test is run e.g. things like "allocated from free list" vs "allocated new".
111 # 2. Different versions of the kernel may have different paths through the
112 # statistics gathering code. Be conservative in the minima you set below.
113 # The test must work on all of them. If possible, try on a variety of kernels.
114 # E.g. if x.y.z returns 758 on IRIX 6.1 and 516 on IRIX 5.3 the minimum should
115 # be set to 500.
117 # 3. Use a quiescent system!
119 # DO NOT INCREASE THESE FIGURES WITHOUT CHECKING THE OUTPUT ON 5.3 and 6.1
121 # Nondeterministic metrics zeroed in list below:
122 # bmapfbc, itobpf, found
124 cat >$tmp.delta.expect <<END
125 irix.resource.efs.attempts 250
126 irix.resource.efs.attrchg 0
127 irix.resource.efs.bmapfbc 0
128 irix.resource.efs.bmapfbm 0
129 irix.resource.efs.bmaprd 250
130 irix.resource.efs.dirupd 250
131 irix.resource.efs.dup 0
132 irix.resource.efs.found 0
133 irix.resource.efs.frecycle 0
134 irix.resource.efs.ialloccoll 0
135 irix.resource.efs.iallocrd 250
136 irix.resource.efs.iallocrdf 250
137 irix.resource.efs.icreat 250
138 irix.resource.efs.itobp 500
139 irix.resource.efs.itobpf 0
140 irix.resource.efs.iupacc 250
141 irix.resource.efs.iupchg 500
142 irix.resource.efs.iupdat 500
143 irix.resource.efs.iupmod 0
144 irix.resource.efs.iupunk 0
145 irix.resource.efs.iupupd 500
146 irix.resource.efs.missed 0
147 irix.resource.efs.reclaims 0
148 irix.resource.efs.truncs 0
151 LC_COLLATE=POSIX sort $tmp.delta.expect | sed -e 's/[ ][ ]*/ /' >$tmp.filtered
152 mv $tmp.filtered $tmp.delta.expect
154 # Now generate and run another shell script to compare the observed deltas
155 # with the expected ones
157 echo '#!/bin/sh' >$tmp.delta.sh
158 echo 'sts=0' >>$tmp.delta.sh
159 LC_COLLATE=POSIX join -j 1 -o 1.2 2.2 1.1 $tmp.delta $tmp.delta.expect \
160 | tee $tmp.join \
161 | $PCP_AWK_PROG '{
162 printf "[ %d -lt %d ]", $1, $2;
163 printf " && sts=1 && " ;
164 printf "echo \"%s: got %d expected min %d\"\n", $3, $1, $2;
165 } ' \
166 >>$tmp.delta.sh
167 echo 'exit $sts' >>$tmp.delta.sh
169 # For debuging use sh -x
171 if sh $tmp.delta.sh
172 then
174 else
175 echo ""
176 echo "irix.resource.efs: one or more metrics failed range tests"
177 exit 1
179 exit 0