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) and rm(1)
27 -e '/^[rwx.-]* /s/.* /... ls data ... /' \
31 -e '/^ln: .*Permission/{
32 s/creating hard link //
33 s/failed to create hard link //
39 -e '/^rm: .*Permission/{
46 # ls(1) does not have the same format for error messages, sigh.
48 # Note on second sed expression ... need to handle GNU coreutils
49 # brain damage from newer versions of ls(1) and remove ' quotes
51 # ls: cannot access 'foo*': No such file or directory
56 -e '/ls: [^ ]*\*: No such/s/ls: /ls: cannot access /' \
57 -e "/: No such file /s/ '\([^']*\)': No/ \1: No/" \
61 # real QA test starts here
64 echo "=== Usage, no input files, incomplete input archive ==="
67 [ $sts -eq 0 ] ||
echo exit status
$sts
70 [ $sts -eq 0 ] ||
echo exit status
$sts
73 [ $sts -eq 0 ] ||
echo exit status
$sts
74 cp $here/tmparch
/foo
.0 .
75 pmlogmv foo bar
>$tmp.out
2>&1
78 [ $sts -eq 0 ] ||
echo exit status
$sts
80 cp $here/tmparch
/foo.meta .
81 pmlogmv foo bar
>$tmp.out
2>&1
84 [ $sts -eq 0 ] ||
echo exit status
$sts
88 echo "=== non-pcp archives and output files already exist ==="
89 cp $here/tmparch
/foo.
* .
91 pmlogmv
-V foo bar
>$tmp.out
2>&1
94 [ $sts -eq 0 ] ||
echo exit status
$sts
95 ls foo
* bar
* 2>&1 | _filter_ls
97 cp $here/tmparch
/foo.
* .
100 echo "--- bar.$i already exists ---"
101 cp $here/tmparch
/bar.
$i .
102 pmlogmv
-V foo bar
>$tmp.out
2>&1
105 [ $sts -eq 0 ] ||
echo exit status
$sts
106 ls foo
* bar
* 2>&1 | _filter_ls
112 echo "=== simplest case ==="
113 cp $here/tmparch
/foo.
* .
114 pmlogmv
-NV foo bar
>$tmp.out
2>&1
117 [ $sts -eq 0 ] ||
echo exit status
$sts
118 pmlogmv
-V foo bar
>$tmp.out
2>&1
121 [ $sts -eq 0 ] ||
echo exit status
$sts
122 for part
in 0 index meta
124 if cmp $here/tmparch
/foo.
$part bar.
$part
128 echo "Arrgh ... input foo.$part not the same as output bar.$part"
129 ls -l $here/tmparch
/foo.
$part bar.
$part
132 ls foo
* bar
* 2>&1 | _filter_ls
136 echo "=== single oldfile name cases ==="
137 for ext
in meta
0 index
139 echo "--- foo.$ext ---"
140 cp $here/tmparch
/foo.
* .
141 pmlogmv
-V foo.
$ext bar
>$tmp.out
2>&1
144 [ $sts -eq 0 ] ||
echo exit status
$sts
145 for part
in 0 index meta
147 if cmp $here/tmparch
/foo.
$part bar.
$part
151 echo "Arrgh ... input foo.$part not the same as output bar.$part"
152 ls -l $here/tmparch
/foo.
$part bar.
$part
155 ls foo
* bar
* 2>&1 | _filter_ls
160 echo "=== multi-volume case ==="
161 cp $here/tmparch
/mv-foo.
* .
162 cp mv-foo
.2 mv-foo
.123456789
163 pmlogmv
-V mv-foo bar
>$tmp.out
2>&1
166 [ $sts -eq 0 ] ||
echo exit status
$sts
167 for opart
in 0 1 2 123456789 index meta
170 [ "$opart" = 123456789 ] && opart
=2
171 if cmp $here/tmparch
/mv-foo.
$opart bar.
$npart
175 echo "Arrgh ... input mv-foo.$opart not the same as output bar.$npart"
176 ls -l $here/tmparch
/mv-foo.
$opart bar.
$npart
179 ls foo
* bar
* 2>&1 | _filter_ls
183 echo "=== old and new in different directories =="
185 cp $here/tmparch
/mv-foo.
* .
186 pmlogmv
-V mv-foo new
/mv-foo
>$tmp.out
2>&1
189 [ $sts -eq 0 ] ||
echo exit status
$sts
190 for part
in 0 1 2 index meta
192 if cmp $here/tmparch
/mv-foo.
$part new
/mv-foo.
$part
196 echo "Arrgh ... input mv-foo.$part not the same as output new/mv-foo.$part"
197 ls -l $here/tmparch
/mv-foo.
$part new
/mv-foo.
$part
200 ls foo
* new
/* 2>&1 | _filter_ls
204 echo "=== error case for ln failing ==="
206 chmod u-w
,g-w
,o-w new
207 cp $here/tmparch
/mv-foo.
* .
208 pmlogmv
-V mv-foo new
/mv-foo
>$tmp.out
2>&1
211 [ $sts -eq 0 ] ||
echo exit status
$sts
212 ls mv-foo
* new
/* 2>&1 | _filter_ls
216 echo "=== error case for rm failing ==="
219 cp $here/tmparch
/mv-foo.
* .
220 pmlogmv
-V mv-foo new
/mv-foo
>$tmp.out
2>&1
223 [ $sts -eq 0 ] ||
echo exit status
$sts
224 ls mv-foo
* new
/* 2>&1 | _filter_ls
229 echo "=== Frank's error case rm failing after first file ==="
230 cp $here/tmparch
/mv-foo.
* .
232 pmlogmv
-V mv-foo mv-bar
>$tmp.out
2>&1
235 [ $sts -eq 0 ] ||
echo exit status
$sts
236 ls mv-foo
* mv-bar
* 2>&1 | _filter_ls
237 rm -rf mv-foo.
* mv-bar.
*