3 # pmlogrewrite error cases
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard filters
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
33 -e '/invalid option/s/[^'"'"']$/'"'&'"'/'
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
51 pmlogrewrite
in out foo
53 pmlogrewrite
-c no.such.
file in out
55 pmlogrewrite
-c /dev
/tty
in out
58 chmod 0 $tmp.forbidden
59 pmlogrewrite
-c $tmp.forbidden archives
/rattle
$tmp.new
2>&1 | _filter
60 rm -f $tmp.new.
* $tmp.forbidden
62 mkdir
$tmp.forbiddendir
63 chmod 0 $tmp.forbiddendir
64 pmlogrewrite
-c $tmp.forbiddendir
in out
2>&1 | _filter
66 pmlogrewrite
-c $tmp.forbiddendir
/blah
in out
2>&1 | _filter
67 chmod 755 $tmp.forbiddendir
68 rm -rf $tmp.forbiddendir
71 touch $tmp.configdir
/forbidden
72 chmod 0 $tmp.configdir
/forbidden
73 pmlogrewrite
-v -c $tmp.configdir archives
/rattle
$tmp.new
2>&1 | _filter
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
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
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`"
91 echo "=== truncated archive -d ==="
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`"
98 echo "=== bad label ==="
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`"
105 echo "=== truncated metadata ==="
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`"
112 echo "=== bad version ==="
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`"