3 # basic pmlogcheck workout
5 # Copyright (c) 2013 Ken McDonell. All Rights Reserved.
6 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
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
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
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
47 # archives/badlabel-2.index: mismatched label version: 0 not 2 as expected from archives/badlabel-2.meta
52 -e '/^archives\/badlabel-2.* mismatched label/d' \
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
64 ( echo; echo "TMP/foo.meta missing:" ) |
tee -a $here/$seq.full
65 pmlogcheck
-z -v $tmp/foo
>$tmp.out
2>$tmp.err
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
74 ( echo; echo "TMP/foo.index missing:" ) |
tee -a $here/$seq.full
75 pmlogcheck
-z -v $tmp/foo
>$tmp.out
2>$tmp.err
77 cp tmparch
/foo.index
$tmp
87 ( echo; echo "TMP/bar:" ) |
tee -a $here/$seq.full
88 pmlogcheck
-z -v $tmp/bar
>$tmp.out
2>$tmp.err
90 ( echo; echo "TMP/foo:" ) |
tee -a $here/$seq.full
91 pmlogcheck
-z -v $tmp/foo
>$tmp.out
2>$tmp.err
94 ( echo; echo "foo:" ) |
tee -a $here/$seq.full
95 pmlogcheck
-z -v foo
>$tmp.out
2>$tmp.err
98 ( echo; echo "foo.index:" ) |
tee -a $here/$seq.full
99 pmlogcheck
-z -v foo.index
>$tmp.out
2>$tmp.err
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
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
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
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
138 archives
/badti-1.index
)
141 ( echo; echo "$arch:" ) |
tee -a $here/$seq.full
142 pmlogcheck
-z -v $arch >$tmp.out
2>$tmp.err
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
158 ( echo; echo "$arch:" ) |
tee -a $here/$seq.full
159 pmlogcheck
-z -v $arch >$tmp.out
2>$tmp.err