pmrep: update TODO, man page
[pcp.git] / qa / 492
blobbbef55de4e5db2634f667457c9e62ca832fedf5c
1 #!/bin/sh
2 # PCP QA Test No. 492
3 # pmlogrewrite error cases
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard filters
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 status=0 # success is the default!
17 $sudo rm -rf $tmp.* $seq.full
18 trap "rm -rf $tmp.*; exit \$status" 0 1 2 3 15
20 _filter()
22 sed \
23 -e "s;$tmp;TMP;g"
26 _filter_usage()
28 sed \
29 -e '/illegal option/{
30 s/illegal/invalid/
31 s/.$/'"'&'"'/
32 }' \
33 -e '/invalid option/s/[^'"'"']$/'"'&'"'/'
37 _cnt_logrecs()
39 if [ ! -f $1.0 ]
40 then
41 echo no file
42 else
43 pmdumplog $1 2>/dev/null | grep '^[0-9]' | wc -l | sed -e 's/ //g'
47 # real QA test starts here
48 echo "=== usage cases ==="
49 pmlogrewrite -x in out 2>&1 | _filter_usage
50 echo
51 pmlogrewrite in out foo
52 echo
53 pmlogrewrite -c no.such.file in out
54 echo
55 pmlogrewrite -c /dev/tty in out
56 echo
57 touch $tmp.forbidden
58 chmod 0 $tmp.forbidden
59 pmlogrewrite -c $tmp.forbidden archives/rattle $tmp.new 2>&1 | _filter
60 rm -f $tmp.new.* $tmp.forbidden
61 echo
62 mkdir $tmp.forbiddendir
63 chmod 0 $tmp.forbiddendir
64 pmlogrewrite -c $tmp.forbiddendir in out 2>&1 | _filter
65 echo
66 pmlogrewrite -c $tmp.forbiddendir/blah in out 2>&1 | _filter
67 chmod 755 $tmp.forbiddendir
68 rm -rf $tmp.forbiddendir
69 echo
70 mkdir $tmp.configdir
71 touch $tmp.configdir/forbidden
72 chmod 0 $tmp.configdir/forbidden
73 pmlogrewrite -v -c $tmp.configdir archives/rattle $tmp.new 2>&1 | _filter
74 echo
75 ln -s $tmp.configdir/forbidden $tmp.link
76 pmlogrewrite -v -c $tmp.link archives/rattle $tmp.new 2>&1 | _filter
77 rm -rf $tmp.config $tmp.forbidden
78 echo
79 rm -f $tmp.link
80 ln -s $tmp.configdir $tmp.link
81 pmlogrewrite -v -c $tmp.link archives/rattle $tmp.new 2>&1 | _filter
82 rm -rf $tmp.configdir $tmp.link
84 echo
85 echo "=== truncated archive ==="
86 pmlogrewrite archives/ok-truncbin $tmp.new 2>&1 | _filter
87 echo "input records: `_cnt_logrecs archives/ok-truncbin`"
88 echo "output records: `_cnt_logrecs $tmp.new`"
90 echo
91 echo "=== truncated archive -d ==="
92 rm -f $tmp.new.*
93 pmlogrewrite -d archives/ok-truncbin $tmp.new 2>&1 | _filter
94 echo "input records: `_cnt_logrecs archives/ok-truncbin`"
95 echo "output records: `_cnt_logrecs $tmp.new`"
97 echo
98 echo "=== bad label ==="
99 rm -f $tmp.new.*
100 pmlogrewrite -d archives/badlen-8 $tmp.new 2>&1 | _filter
101 echo "input records: `_cnt_logrecs archives/badlen-8`"
102 echo "output records: `_cnt_logrecs $tmp.new`"
104 echo
105 echo "=== truncated metadata ==="
106 rm -f $tmp.new.*
107 pmlogrewrite -d archives/badlen-9 $tmp.new 2>&1 | _filter
108 echo "input records: `_cnt_logrecs archives/badlen-9`"
109 echo "output records: `_cnt_logrecs $tmp.new`"
111 echo
112 echo "=== bad version ==="
113 rm -f $tmp.new.*
114 pmlogrewrite -d archives/err_v1 $tmp.new 2>&1 | _filter
115 echo "input records: `_cnt_logrecs archives/err_v1`"
116 echo "output records: `_cnt_logrecs $tmp.new`"
118 rm -f $tmp.new.*
120 # success, all done
121 exit