5 # Copyright (c) 2014 Ken McDonell. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 status
=1 # failure is the default!
17 $sudo rm -rf $tmp.
* $seq.full
20 trap "cd $here; rm -rf $tmp.* $tmp; exit \$status" 0 1 2 3 15
24 # there are a lot of bizarre quoting variants for ln(1) error
27 -e '/^[rwx.-]* /s/.* /... ls data ... /' \
31 -e 's/ln: creating hard link/ln: failed to create hard link/' \
32 -e "/ln: failed /s/' to '/' => '/" \
36 # ls(1) does not have the same format for error messages, sigh.
39 sed -e '/ls: [^ ]*\*: No such/s/ls: /ls: cannot access /'
42 # real QA test starts here
45 echo "=== Usage, no input files, incomplete input archive ==="
48 [ $sts -eq 0 ] ||
echo exit status
$sts
51 [ $sts -eq 0 ] ||
echo exit status
$sts
54 [ $sts -eq 0 ] ||
echo exit status
$sts
55 cp $here/tmparch
/foo
.0 .
56 pmlogmv foo bar
>$tmp.out
2>&1
59 [ $sts -eq 0 ] ||
echo exit status
$sts
61 cp $here/tmparch
/foo.meta .
62 pmlogmv foo bar
>$tmp.out
2>&1
65 [ $sts -eq 0 ] ||
echo exit status
$sts
69 echo "=== non-pcp archives and output files already exist ==="
70 cp $here/tmparch
/foo.
* .
72 pmlogmv
-V foo bar
>$tmp.out
2>&1
75 [ $sts -eq 0 ] ||
echo exit status
$sts
76 ls foo
* bar
* 2>&1 | _filter_ls
78 cp $here/tmparch
/foo.
* .
81 echo "--- bar.$i already exists ---"
82 cp $here/tmparch
/bar.
$i .
83 pmlogmv
-V foo bar
>$tmp.out
2>&1
86 [ $sts -eq 0 ] ||
echo exit status
$sts
87 ls foo
* bar
* 2>&1 | _filter_ls
93 echo "=== simplest case ==="
94 cp $here/tmparch
/foo.
* .
95 pmlogmv
-NV foo bar
>$tmp.out
2>&1
98 [ $sts -eq 0 ] ||
echo exit status
$sts
99 pmlogmv
-V foo bar
>$tmp.out
2>&1
102 [ $sts -eq 0 ] ||
echo exit status
$sts
103 for part
in 0 index meta
105 if cmp $here/tmparch
/foo.
$part bar.
$part
109 echo "Arrgh ... input foo.$part not the same as output bar.$part"
110 ls -l $here/tmparch
/foo.
$part bar.
$part
113 ls foo
* bar
* 2>&1 | _filter_ls
117 echo "=== single oldfile name cases ==="
118 for ext
in meta
0 index
120 echo "--- foo.$ext ---"
121 cp $here/tmparch
/foo.
* .
122 pmlogmv
-V foo.
$ext bar
>$tmp.out
2>&1
125 [ $sts -eq 0 ] ||
echo exit status
$sts
126 for part
in 0 index meta
128 if cmp $here/tmparch
/foo.
$part bar.
$part
132 echo "Arrgh ... input foo.$part not the same as output bar.$part"
133 ls -l $here/tmparch
/foo.
$part bar.
$part
136 ls foo
* bar
* 2>&1 | _filter_ls
141 echo "=== multi-volume case ==="
142 cp $here/tmparch
/mv-foo.
* .
143 cp mv-foo
.2 mv-foo
.123456789
144 pmlogmv
-V mv-foo bar
>$tmp.out
2>&1
147 [ $sts -eq 0 ] ||
echo exit status
$sts
148 for opart
in 0 1 2 123456789 index meta
151 [ "$opart" = 123456789 ] && opart
=2
152 if cmp $here/tmparch
/mv-foo.
$opart bar.
$npart
156 echo "Arrgh ... input mv-foo.$opart not the same as output bar.$npart"
157 ls -l $here/tmparch
/mv-foo.
$opart bar.
$npart
160 ls foo
* bar
* 2>&1 | _filter_ls
164 echo "=== old and new in different directories =="
166 cp $here/tmparch
/mv-foo.
* .
167 pmlogmv
-V mv-foo new
/mv-foo
>$tmp.out
2>&1
170 [ $sts -eq 0 ] ||
echo exit status
$sts
171 for part
in 0 1 2 index meta
173 if cmp $here/tmparch
/mv-foo.
$part new
/mv-foo.
$part
177 echo "Arrgh ... input mv-foo.$part not the same as output new/mv-foo.$part"
178 ls -l $here/tmparch
/mv-foo.
$part new
/mv-foo.
$part
181 ls foo
* new
/* 2>&1 | _filter_ls
185 echo "=== error case for ln failing ==="
187 chmod u-w
,g-w
,o-w new
188 cp $here/tmparch
/mv-foo.
* .
189 pmlogmv
-V mv-foo new
/mv-foo
>$tmp.out
2>&1
192 [ $sts -eq 0 ] ||
echo exit status
$sts
193 ls mv-foo
* new
/* 2>&1 | _filter_ls
197 echo "=== error case for rm failing ==="
200 cp $here/tmparch
/mv-foo.
* .
201 pmlogmv
-V mv-foo new
/mv-foo
>$tmp.out
2>&1
204 [ $sts -eq 0 ] ||
echo exit status
$sts
205 ls mv-foo
* new
/* 2>&1 | _filter_ls
210 echo "=== Frank's error case rm failing after first file ==="
211 cp $here/tmparch
/mv-foo.
* .
213 pmlogmv
-V mv-foo mv-bar
>$tmp.out
2>&1
216 [ $sts -eq 0 ] ||
echo exit status
$sts
217 ls mv-foo
* mv-bar
* 2>&1 | _filter_ls
218 rm -rf mv-foo.
* mv-bar.
*