pmrep: update TODO, man page
[pcp.git] / qa / 566
blob799fc548ac5eac1737c67c999cf22c46d538ae23
1 #!/bin/sh
2 # PCP QA Test No. 566
3 # basic pmlogcheck workout
5 # Copyright (c) 2013 Ken McDonell. All Rights Reserved.
6 # Copyright (c) 2015 Red Hat 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 status=1 # failure is the default!
18 $sudo rm -rf $tmp $tmp.* $seq.full
19 trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
20 mkdir $tmp
22 _filter_hostnames()
24 sed -e 's/host \".*\"/host \"HOST\"/g' $tmp.out > $tmp.out.1
25 mv $tmp.out.1 $tmp.out
26 sed -e 's/host \".*\"/host \"HOST\"/g' $tmp.err > $tmp.err.1
27 mv $tmp.err.1 $tmp.err
29 _filter()
31 _filter_hostnames
32 echo >>$here/$seq.full
33 echo "stdout" >>$here/$seq.full
34 cat $tmp.out >>$here/$seq.full
35 echo "stderr" >>$here/$seq.full
36 cat $tmp.err >>$here/$seq.full
37 # need sort because order files are processed in not deterministic
39 sed $tmp.out -e "s;$tmp;TMP;g" | LC_COLLATE=POSIX sort
40 sed $tmp.err -e "s;$tmp;TMP;g" | LC_COLLATE=POSIX sort
43 # this sort of error is not deterministic unfortunately because it is
44 # sensitive to the directory order of the files that make up the
45 # archive
47 # archives/badlabel-2.index: mismatched label version: 0 not 2 as expected from archives/badlabel-2.meta
49 _filter_pass0()
51 sed \
52 -e '/^archives\/badlabel-2.* mismatched label/d' \
53 # end
56 # real QA test starts here
57 export LC_COLLATE=POSIX
58 echo "=== directory traversal and file checks ===" | tee -a $here/$seq.full
59 cp tmparch/foo.index $tmp
60 ( echo; echo "TMP/foo.index alone:" ) | tee -a $here/$seq.full
61 pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
62 _filter
63 cp tmparch/foo.0 $tmp
64 ( echo; echo "TMP/foo.meta missing:" ) | tee -a $here/$seq.full
65 pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
66 _filter
67 rm $tmp/foo.0
68 cp tmparch/foo.meta $tmp
69 ( echo; echo "TMP/foo.0 missing:" ) | tee -a $here/$seq.full
70 pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
71 _filter
72 rm $tmp/foo.index
73 cp tmparch/foo.0 $tmp
74 ( echo; echo "TMP/foo.index missing:" ) | tee -a $here/$seq.full
75 pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
76 _filter
77 cp tmparch/foo.index $tmp
79 touch $tmp/foo
80 touch $tmp/foo.
81 touch $tmp/foobar.0
82 touch $tmp/foo.999
83 touch $tmp/foo.1
84 chmod 0 $tmp/foo.1
85 touch $tmp/foo.bar
86 touch $tmp/foo.9x9
87 ( echo; echo "TMP/bar:" ) | tee -a $here/$seq.full
88 pmlogcheck -z -v $tmp/bar >$tmp.out 2>$tmp.err
89 _filter
90 ( echo; echo "TMP/foo:" ) | tee -a $here/$seq.full
91 pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
92 _filter
93 cd $tmp
94 ( echo; echo "foo:" ) | tee -a $here/$seq.full
95 pmlogcheck -z -v foo >$tmp.out 2>$tmp.err
96 _filter
97 chmod 644 foo.1
98 ( echo; echo "foo.index:" ) | tee -a $here/$seq.full
99 pmlogcheck -z -v foo.index >$tmp.out 2>$tmp.err
100 _filter
101 ( echo; echo "archive-20150415.044829:" ) | tee -a $here/$seq.full
102 ln foo.0 archive-20150415.044829.0
103 ln foo.meta archive-20150415.044829.meta
104 ln foo.index archive-20150415.044829.index
105 pmlogcheck -z -v archive-20150415.044829 >$tmp.out 2>$tmp.err
106 _filter
108 cd $here
110 echo | tee -a $here/$seq.full
111 echo "=== pass 0 failures ===" | tee -a $here/$seq.full
112 for arch in `ls archives/badlen-*.meta` archives/badti-1 `ls archives/badlabel-*.meta`
114 # some of the bad archives may not have pass 0 style corruption,
115 # so skip these ones for now
117 case $arch
119 archives/badlen-0.meta|archives/badlen-8.meta|archives/badlabel-0.meta)
122 ( echo; echo "$arch:" ) | tee -a $here/$seq.full
123 pmlogcheck -z -v $arch >$tmp.out 2>$tmp.err
124 _filter | _filter_pass0
126 esac
127 done
129 echo | tee -a $here/$seq.full
130 echo "=== pass 1 failures ===" | tee -a $here/$seq.full
131 for arch in `ls archives/badti-*.index`
133 # some of the bad archives may not have pass 1 style corruption,
134 # so skip these ones for now
136 case $arch
138 archives/badti-1.index)
141 ( echo; echo "$arch:" ) | tee -a $here/$seq.full
142 pmlogcheck -z -v $arch >$tmp.out 2>$tmp.err
143 _filter
145 esac
146 done
148 echo | tee -a $here/$seq.full
149 echo "=== pass 3 failures ===" | tee -a $here/$seq.full
150 for arch in `ls archives/badlog-*.0`
152 # some of the bad archives may not have pass 3 style corruption,
153 # so skip these ones for now
155 case $arch
158 ( echo; echo "$arch:" ) | tee -a $here/$seq.full
159 pmlogcheck -z -v $arch >$tmp.out 2>$tmp.err
160 _filter
162 esac
163 done
165 # success, all done
166 status=0
168 exit