pmrep: fix archive end time reporting
[pcp.git] / qa / 154
blob88ea04809049fe064e81e960a0231521f0e6d1fd
1 #! /bin/sh
2 # PCP QA Test No. 154
3 # what the hell is chkhelp supposed to do?
5 # Copyright (c) 2015 Red Hat.
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. 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 [ -f $PCP_PMDAS_DIR/cisco/pmdacisco ] || _notrun "cisco pmda not installed"
19 _filter_illegal()
21 sed \
22 -e '/illegal key/s/(-*[0-9][0-9]*)/(SIZE)/' \
23 -e "s;$tmp;TMP;g"
26 _filter_chk()
28 sed \
29 -e '/-v version/d' \
30 -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;"
33 trap "rm -f $tmp.*; exit" 0 1 2 3 15
35 # real QA test starts here
37 cleanup=false
38 if [ ! -f $PCP_PMDAS_DIR/cisco/help.pag ]
39 then
40 # no compiled help text, so the cisco PMDA has never been installed
41 # here ... the only way to make this file appear is Install and Remove
42 # the PMDA ... this should be a no-op, but may take a while
44 cd $PCP_PMDAS_DIR/cisco
45 unset ROOT MAKEFLAGS
46 $sudo ./Install </dev/null >/dev/null 2>&1
47 cd $here
48 if [ ! -f $PCP_PMDAS_DIR/cisco/help.pag ]
49 then
50 echo "Arrggh, need $PCP_PMDAS_DIR/cisco/help.pag and cannot remake it!"
51 exit 1
53 cleanup=true
55 $sudo chmod 644 $PCP_PMDAS_DIR/cisco/help.*
57 echo
58 echo bad dbf
59 dd if=/dev/zero ibs=1024 count=4 of=$tmp.pag >/dev/null 2>&1
60 cp $tmp.pag $tmp.dir
61 echo "chkhelp bad-helpfile"
62 chkhelp $tmp >$tmp.out 2>&1
63 status=$?
64 _filter_illegal <$tmp.out
65 echo status=$status
66 echo "chkhelp -p bad-helpfile"
67 chkhelp -p $tmp >$tmp.out 2>&1
68 status=$?
69 _filter_illegal <$tmp.out
70 echo status=$status
71 echo "chkhelp bad-helpfile cisco.rate_in"
72 chkhelp $tmp cisco.rate_in 2>&1 | _filter_illegal
73 echo status=$?
75 echo
76 echo "some usage failures ..."
77 echo 'chkhelp -i $PCP_PMDAS_DIR/cisco/help cisco.rate_in'
78 chkhelp -i $PCP_PMDAS_DIR/cisco/help cisco.rate_in 2>&1 \
79 | _filter_chk
80 echo 'chkhelp -p $PCP_PMDAS_DIR/cisco/help cisco.rate_in'
81 chkhelp -p $PCP_PMDAS_DIR/cisco/help cisco.rate_in 2>&1 \
82 | _filter_chk
83 echo 'chkhelp -ip $PCP_PMDAS_DIR/cisco/help cisco.rate_in'
84 chkhelp -ip $PCP_PMDAS_DIR/cisco/help cisco.rate_in 2>&1 \
85 | _filter_chk
87 echo
88 echo "debug trace ..."
89 echo 'chkhelp -D 2048 $PCP_PMDAS_DIR/cisco/help'
90 chkhelp -D 2048 $PCP_PMDAS_DIR/cisco/help 2>&1 \
91 | _filter_chk
93 echo
94 echo "exercise options ..."
96 for h in "" -H
98 for o in "" -O
100 for i in "" -i
102 for p in "" -p
104 for metric in "" cisco.rate_in "cisco.rate_in cisco.rate_out"
106 if [ "X$p" = "X-p" -o "X$i" = "X-i" ]
107 then
108 [ "X$metric" != X ] && continue
110 echo
111 echo "args: $h $o $i $p $metric"
112 chkhelp $h $o $i $p \
113 -n $PCP_PMDAS_DIR/cisco/root \
114 $PCP_PMDAS_DIR/cisco/help $metric >$tmp.out 2>&1
115 status=$?
116 _filter_chk <$tmp.out
117 echo status=$status
118 done
119 done
120 done
121 done
122 done
124 if $cleanup
125 then
126 # see comments above when help.pag created for cisco PMDA
128 cd $PCP_PMDAS_DIR/cisco
129 unset ROOT MAKEFLAGS
130 $sudo ./Remove </dev/null >/dev/null 2>&1
131 cd $here
134 exit 0