3 2ec1f75b 2019-03-26 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 2ec1f75b 2019-03-26 stsp # Permission to use, copy, modify, and distribute this software for any
6 2ec1f75b 2019-03-26 stsp # purpose with or without fee is hereby granted, provided that the above
7 2ec1f75b 2019-03-26 stsp # copyright notice and this permission notice appear in all copies.
9 2ec1f75b 2019-03-26 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 2ec1f75b 2019-03-26 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 2ec1f75b 2019-03-26 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 2ec1f75b 2019-03-26 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 2ec1f75b 2019-03-26 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 2ec1f75b 2019-03-26 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 2ec1f75b 2019-03-26 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 2ec1f75b 2019-03-26 stsp . ./common.sh
19 f6cae3ed 2020-09-13 naddy test_rm_basic() {
20 2ec1f75b 2019-03-26 stsp local testroot=`test_init rm_basic`
22 2ec1f75b 2019-03-26 stsp got checkout $testroot/repo $testroot/wt > /dev/null
24 2ec1f75b 2019-03-26 stsp if [ "$ret" != "0" ]; then
25 2ec1f75b 2019-03-26 stsp test_done "$testroot" "$ret"
29 17ed4618 2019-06-02 stsp echo 'D alpha' > $testroot/stdout.expected
30 17ed4618 2019-06-02 stsp echo 'D beta' >> $testroot/stdout.expected
31 17ed4618 2019-06-02 stsp (cd $testroot/wt && got rm alpha beta > $testroot/stdout)
33 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
35 2ec1f75b 2019-03-26 stsp if [ "$ret" != "0" ]; then
36 2ec1f75b 2019-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
37 17ed4618 2019-06-02 stsp test_done "$testroot" "$ret"
41 17ed4618 2019-06-02 stsp (cd $testroot/wt && got status > $testroot/stdout)
43 17ed4618 2019-06-02 stsp cmp -s $testroot/stdout.expected $testroot/stdout
45 17ed4618 2019-06-02 stsp if [ "$ret" != "0" ]; then
46 17ed4618 2019-06-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
47 17ed4618 2019-06-02 stsp test_done "$testroot" "$ret"
51 17ed4618 2019-06-02 stsp for f in alpha beta; do
52 17ed4618 2019-06-02 stsp if [ -e $testroot/wt/$f ]; then
53 17ed4618 2019-06-02 stsp echo "removed file $f still exists on disk" >&2
54 17ed4618 2019-06-02 stsp test_done "$testroot" "1"
59 17ed4618 2019-06-02 stsp test_done "$testroot" "0"
62 f6cae3ed 2020-09-13 naddy test_rm_with_local_mods() {
63 2ec1f75b 2019-03-26 stsp local testroot=`test_init rm_with_local_mods`
65 2ec1f75b 2019-03-26 stsp got checkout $testroot/repo $testroot/wt > /dev/null
67 2ec1f75b 2019-03-26 stsp if [ "$ret" != "0" ]; then
68 2ec1f75b 2019-03-26 stsp test_done "$testroot" "$ret"
72 2ec1f75b 2019-03-26 stsp echo "modified beta" > $testroot/wt/beta
73 f0b0c0ce 2019-08-04 stsp echo 'got: beta: file contains modifications' \
74 f0b0c0ce 2019-08-04 stsp > $testroot/stderr.expected
75 2ec1f75b 2019-03-26 stsp (cd $testroot/wt && got rm beta 2>$testroot/stderr)
77 8d301dd9 2019-05-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
79 2ec1f75b 2019-03-26 stsp if [ "$ret" != "0" ]; then
80 2ec1f75b 2019-03-26 stsp diff -u $testroot/stderr.expected $testroot/stderr
81 2ec1f75b 2019-03-26 stsp test_done "$testroot" "$ret"
85 2ec1f75b 2019-03-26 stsp echo 'D beta' > $testroot/stdout.expected
86 2ec1f75b 2019-03-26 stsp (cd $testroot/wt && got rm -f beta > $testroot/stdout)
88 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
90 2ec1f75b 2019-03-26 stsp if [ "$ret" != "0" ]; then
91 2ec1f75b 2019-03-26 stsp diff -u $testroot/stdout.expected $testroot/stdout
94 2ec1f75b 2019-03-26 stsp if [ -e $testroot/wt/beta ]; then
95 2ec1f75b 2019-03-26 stsp echo "removed file beta still exists on disk" >&2
96 2ec1f75b 2019-03-26 stsp test_done "$testroot" "1"
100 2ec1f75b 2019-03-26 stsp test_done "$testroot" "$ret"
103 f6cae3ed 2020-09-13 naddy test_double_rm() {
104 71a29355 2019-03-27 stsp local testroot=`test_init double_rm`
106 71a29355 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
108 71a29355 2019-03-27 stsp if [ "$ret" != "0" ]; then
109 71a29355 2019-03-27 stsp test_done "$testroot" "$ret"
113 71a29355 2019-03-27 stsp (cd $testroot/wt && got rm beta > /dev/null)
115 71a29355 2019-03-27 stsp for fflag in "" "-f"; do
116 6d022e97 2019-08-04 stsp echo -n > $testroot/stderr.expected
117 6d022e97 2019-08-04 stsp (cd $testroot/wt && got rm $fflag beta > $testroot/stdout \
118 6d022e97 2019-08-04 stsp 2> $testroot/stderr)
120 6d022e97 2019-08-04 stsp if [ "$ret" != "0" ]; then
121 6d022e97 2019-08-04 stsp echo "got rm command failed unexpectedly" >&2
122 6d022e97 2019-08-04 stsp diff -u $testroot/stderr.expected $testroot/stderr
123 6d022e97 2019-08-04 stsp test_done "$testroot" "$ret"
126 6d022e97 2019-08-04 stsp echo -n > $testroot/stdout.expected
127 6d022e97 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
129 71a29355 2019-03-27 stsp if [ "$ret" != "0" ]; then
130 6d022e97 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
131 71a29355 2019-03-27 stsp test_done "$testroot" "$ret"
135 71a29355 2019-03-27 stsp test_done "$testroot" "0"
138 f6cae3ed 2020-09-13 naddy test_rm_and_add_elsewhere() {
139 f0b0c0ce 2019-08-04 stsp local testroot=`test_init rm_and_add_elsewhere`
141 f0b0c0ce 2019-08-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
143 f0b0c0ce 2019-08-04 stsp if [ "$ret" != "0" ]; then
144 f0b0c0ce 2019-08-04 stsp test_done "$testroot" "$ret"
148 f0b0c0ce 2019-08-04 stsp (cd $testroot/wt && mv alpha epsilon/)
150 f0b0c0ce 2019-08-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
152 f0b0c0ce 2019-08-04 stsp echo '! alpha' > $testroot/stdout.expected
153 f0b0c0ce 2019-08-04 stsp echo '? epsilon/alpha' >> $testroot/stdout.expected
154 f0b0c0ce 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
156 f0b0c0ce 2019-08-04 stsp if [ "$ret" != "0" ]; then
157 f0b0c0ce 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
158 f0b0c0ce 2019-08-04 stsp test_done "$testroot" "$ret"
162 f0b0c0ce 2019-08-04 stsp echo 'D alpha' > $testroot/stdout.expected
163 f0b0c0ce 2019-08-04 stsp (cd $testroot/wt && got rm alpha > $testroot/stdout)
165 f0b0c0ce 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
167 f0b0c0ce 2019-08-04 stsp if [ "$ret" != "0" ]; then
168 f0b0c0ce 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
169 f0b0c0ce 2019-08-04 stsp test_done "$testroot" "$ret"
173 f0b0c0ce 2019-08-04 stsp echo 'A epsilon/alpha' > $testroot/stdout.expected
174 f0b0c0ce 2019-08-04 stsp (cd $testroot/wt && got add epsilon/alpha > $testroot/stdout)
176 f0b0c0ce 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
178 f0b0c0ce 2019-08-04 stsp if [ "$ret" != "0" ]; then
179 f0b0c0ce 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
180 f0b0c0ce 2019-08-04 stsp test_done "$testroot" "$ret"
184 f0b0c0ce 2019-08-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
186 f0b0c0ce 2019-08-04 stsp echo 'D alpha' > $testroot/stdout.expected
187 f0b0c0ce 2019-08-04 stsp echo 'A epsilon/alpha' >> $testroot/stdout.expected
188 f0b0c0ce 2019-08-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
190 f0b0c0ce 2019-08-04 stsp if [ "$ret" != "0" ]; then
191 f0b0c0ce 2019-08-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
193 f0b0c0ce 2019-08-04 stsp test_done "$testroot" "$ret"
196 f6cae3ed 2020-09-13 naddy test_rm_directory() {
197 f2a9dc41 2019-12-13 tracey local testroot=`test_init rm_directory`
199 f2a9dc41 2019-12-13 tracey got checkout $testroot/repo $testroot/wt > /dev/null
201 f2a9dc41 2019-12-13 tracey if [ "$ret" != "0" ]; then
202 f2a9dc41 2019-12-13 tracey test_done "$testroot" "$ret"
206 f2a9dc41 2019-12-13 tracey (cd $testroot/wt && got rm . > $testroot/stdout 2> $testroot/stderr)
208 f2a9dc41 2019-12-13 tracey echo "got: removing directories requires -R option" \
209 f2a9dc41 2019-12-13 tracey > $testroot/stderr.expected
210 f2a9dc41 2019-12-13 tracey cmp -s $testroot/stderr.expected $testroot/stderr
212 f2a9dc41 2019-12-13 tracey if [ "$ret" != "0" ]; then
213 f2a9dc41 2019-12-13 tracey diff -u $testroot/stderr.expected $testroot/stderr
214 f2a9dc41 2019-12-13 tracey test_done "$testroot" "$ret"
218 f2a9dc41 2019-12-13 tracey echo -n > $testroot/stdout.expected
219 f2a9dc41 2019-12-13 tracey cmp -s $testroot/stdout.expected $testroot/stdout
221 f2a9dc41 2019-12-13 tracey if [ "$ret" != "0" ]; then
222 f2a9dc41 2019-12-13 tracey diff -u $testroot/stdout.expected $testroot/stdout
223 f2a9dc41 2019-12-13 tracey test_done "$testroot" "$ret"
227 f2a9dc41 2019-12-13 tracey (cd $testroot/wt && got rm -R . > $testroot/stdout)
229 f2a9dc41 2019-12-13 tracey echo 'D alpha' > $testroot/stdout.expected
230 f2a9dc41 2019-12-13 tracey echo 'D beta' >> $testroot/stdout.expected
231 f2a9dc41 2019-12-13 tracey echo 'D epsilon/zeta' >> $testroot/stdout.expected
232 f2a9dc41 2019-12-13 tracey echo 'D gamma/delta' >> $testroot/stdout.expected
234 f2a9dc41 2019-12-13 tracey cmp -s $testroot/stdout.expected $testroot/stdout
236 f2a9dc41 2019-12-13 tracey if [ "$ret" != "0" ]; then
237 f2a9dc41 2019-12-13 tracey diff -u $testroot/stdout.expected $testroot/stdout
238 f2a9dc41 2019-12-13 tracey test_done "$testroot" "$ret"
242 6b36edd8 2020-10-03 naddy (cd $testroot/wt && ls -l | sed '/^total/d' > $testroot/stdout)
244 15341bfd 2020-03-05 tracey echo -n '' > $testroot/stdout.expected
246 15341bfd 2020-03-05 tracey cmp -s $testroot/stdout.expected $testroot/stdout
248 15341bfd 2020-03-05 tracey if [ "$ret" != "0" ]; then
249 15341bfd 2020-03-05 tracey diff -u $testroot/stdout.expected $testroot/stdout
250 15341bfd 2020-03-05 tracey test_done "$testroot" "$ret"
254 6b36edd8 2020-10-03 naddy (cd $testroot/wt && ls -l | sed '/^total/d' > $testroot/stdout)
256 15341bfd 2020-03-05 tracey echo -n '' > $testroot/stdout.expected
258 15341bfd 2020-03-05 tracey cmp -s $testroot/stdout.expected $testroot/stdout
260 15341bfd 2020-03-05 tracey if [ "$ret" != "0" ]; then
261 15341bfd 2020-03-05 tracey diff -u $testroot/stdout.expected $testroot/stdout
262 15341bfd 2020-03-05 tracey test_done "$testroot" "$ret"
266 f2a9dc41 2019-12-13 tracey test_done "$testroot" "$ret"
269 f6cae3ed 2020-09-13 naddy test_rm_directory_keep_files() {
270 9c2e8939 2020-03-22 stsp local testroot=`test_init rm_directory_keep_files`
272 70e3e7f5 2019-12-13 tracey got checkout $testroot/repo $testroot/wt > /dev/null
274 70e3e7f5 2019-12-13 tracey if [ "$ret" != "0" ]; then
275 70e3e7f5 2019-12-13 tracey test_done "$testroot" "$ret"
279 70e3e7f5 2019-12-13 tracey (cd $testroot/wt && got rm . > $testroot/stdout 2> $testroot/stderr)
281 70e3e7f5 2019-12-13 tracey echo "got: removing directories requires -R option" \
282 70e3e7f5 2019-12-13 tracey > $testroot/stderr.expected
283 70e3e7f5 2019-12-13 tracey cmp -s $testroot/stderr.expected $testroot/stderr
285 70e3e7f5 2019-12-13 tracey if [ "$ret" != "0" ]; then
286 70e3e7f5 2019-12-13 tracey diff -u $testroot/stderr.expected $testroot/stderr
287 70e3e7f5 2019-12-13 tracey test_done "$testroot" "$ret"
291 70e3e7f5 2019-12-13 tracey echo -n > $testroot/stdout.expected
292 70e3e7f5 2019-12-13 tracey cmp -s $testroot/stdout.expected $testroot/stdout
294 70e3e7f5 2019-12-13 tracey if [ "$ret" != "0" ]; then
295 70e3e7f5 2019-12-13 tracey diff -u $testroot/stdout.expected $testroot/stdout
296 70e3e7f5 2019-12-13 tracey test_done "$testroot" "$ret"
300 70e3e7f5 2019-12-13 tracey (cd $testroot/wt && got rm -k -R . > $testroot/stdout)
302 70e3e7f5 2019-12-13 tracey echo 'D alpha' > $testroot/stdout.expected
303 70e3e7f5 2019-12-13 tracey echo 'D beta' >> $testroot/stdout.expected
304 70e3e7f5 2019-12-13 tracey echo 'D epsilon/zeta' >> $testroot/stdout.expected
305 70e3e7f5 2019-12-13 tracey echo 'D gamma/delta' >> $testroot/stdout.expected
307 70e3e7f5 2019-12-13 tracey cmp -s $testroot/stdout.expected $testroot/stdout
309 70e3e7f5 2019-12-13 tracey if [ "$ret" != "0" ]; then
310 70e3e7f5 2019-12-13 tracey diff -u $testroot/stdout.expected $testroot/stdout
311 70e3e7f5 2019-12-13 tracey test_done "$testroot" "$ret"
315 70e3e7f5 2019-12-13 tracey (cd $testroot/wt && got st . > $testroot/stdout)
317 70e3e7f5 2019-12-13 tracey echo 'D alpha' > $testroot/stdout.expected
318 70e3e7f5 2019-12-13 tracey echo 'D beta' >> $testroot/stdout.expected
319 70e3e7f5 2019-12-13 tracey echo 'D epsilon/zeta' >> $testroot/stdout.expected
320 70e3e7f5 2019-12-13 tracey echo 'D gamma/delta' >> $testroot/stdout.expected
322 70e3e7f5 2019-12-13 tracey cmp -s $testroot/stdout.expected $testroot/stdout
324 70e3e7f5 2019-12-13 tracey if [ "$ret" != "0" ]; then
325 70e3e7f5 2019-12-13 tracey diff -u $testroot/stdout.expected $testroot/stdout
326 70e3e7f5 2019-12-13 tracey test_done "$testroot" "$ret"
330 70e3e7f5 2019-12-13 tracey (cd $testroot/wt && got commit -m "keep" > /dev/null)
331 70e3e7f5 2019-12-13 tracey (cd $testroot/wt && got st . > $testroot/stdout)
333 70e3e7f5 2019-12-13 tracey echo '? alpha' > $testroot/stdout.expected
334 70e3e7f5 2019-12-13 tracey echo '? beta' >> $testroot/stdout.expected
335 70e3e7f5 2019-12-13 tracey echo '? epsilon/zeta' >> $testroot/stdout.expected
336 70e3e7f5 2019-12-13 tracey echo '? gamma/delta' >> $testroot/stdout.expected
338 70e3e7f5 2019-12-13 tracey cmp -s $testroot/stdout.expected $testroot/stdout
340 70e3e7f5 2019-12-13 tracey if [ "$ret" != "0" ]; then
341 70e3e7f5 2019-12-13 tracey diff -u $testroot/stdout.expected $testroot/stdout
342 70e3e7f5 2019-12-13 tracey test_done "$testroot" "$ret"
346 70e3e7f5 2019-12-13 tracey test_done "$testroot" "$ret"
349 f6cae3ed 2020-09-13 naddy test_rm_subtree() {
350 15341bfd 2020-03-05 tracey local testroot=`test_init rm_subtree`
352 15341bfd 2020-03-05 tracey got checkout $testroot/repo $testroot/wt > /dev/null
354 15341bfd 2020-03-05 tracey if [ "$ret" != "0" ]; then
355 15341bfd 2020-03-05 tracey test_done "$testroot" "$ret"
359 15341bfd 2020-03-05 tracey mkdir -p $testroot/wt/epsilon/foo/bar/baz
360 15341bfd 2020-03-05 tracey mkdir -p $testroot/wt/epsilon/foo/bar/bax
361 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/a.o
362 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/a.o
363 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/b.o
364 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/b.d
365 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/f.o
366 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/f.d
367 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/c.o
368 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/baz/c.d
369 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/e.o
370 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/e.d
371 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/x.o
372 15341bfd 2020-03-05 tracey echo "new file" > $testroot/wt/epsilon/foo/bar/bax/x.d
373 15341bfd 2020-03-05 tracey (cd $testroot/wt && got add -R epsilon >/dev/null)
374 15341bfd 2020-03-05 tracey (cd $testroot/wt && got commit -m "add subtree" >/dev/null)
376 15341bfd 2020-03-05 tracey # now delete and revert the entire subtree
377 15341bfd 2020-03-05 tracey (cd $testroot/wt && got rm -R epsilon/foo >/dev/null)
379 15341bfd 2020-03-05 tracey if [ -d $testroot/wt/epsilon/foo ]; then
380 15341bfd 2020-03-05 tracey echo "removed dir epsilon/foo still exists on disk" >&2
381 15341bfd 2020-03-05 tracey test_done "$testroot" "1"
385 15341bfd 2020-03-05 tracey echo "D epsilon/foo/a.o" > $testroot/stdout.expected
386 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/b.d" >> $testroot/stdout.expected
387 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/b.o" >> $testroot/stdout.expected
388 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/bax/e.d" >> $testroot/stdout.expected
389 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/bax/e.o" >> $testroot/stdout.expected
390 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/bax/x.d" >> $testroot/stdout.expected
391 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/bax/x.o" >> $testroot/stdout.expected
392 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/baz/c.d" >> $testroot/stdout.expected
393 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/baz/c.o" >> $testroot/stdout.expected
394 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/baz/f.d" >> $testroot/stdout.expected
395 15341bfd 2020-03-05 tracey echo "D epsilon/foo/bar/baz/f.o" >> $testroot/stdout.expected
397 15341bfd 2020-03-05 tracey (cd $testroot/wt && got status > $testroot/stdout)
399 a919d5c4 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
401 a919d5c4 2020-07-23 stsp if [ "$ret" != "0" ]; then
402 a919d5c4 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
404 a919d5c4 2020-07-23 stsp test_done "$testroot" "$ret"
407 f6cae3ed 2020-09-13 naddy test_rm_symlink() {
408 a919d5c4 2020-07-23 stsp local testroot=`test_init rm_symlink`
410 a919d5c4 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
411 a919d5c4 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
412 a919d5c4 2020-07-23 stsp (cd $testroot/repo && ln -s /etc/passwd passwd.link)
413 64773fde 2020-07-23 stsp (cd $testroot/repo && ln -s ../beta epsilon/beta.link)
414 64773fde 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
415 a919d5c4 2020-07-23 stsp (cd $testroot/repo && git add .)
416 64773fde 2020-07-23 stsp git_commit $testroot/repo -m "add symlinks"
418 a919d5c4 2020-07-23 stsp got checkout $testroot/repo $testroot/wt > /dev/null
420 a919d5c4 2020-07-23 stsp if [ "$ret" != "0" ]; then
421 a919d5c4 2020-07-23 stsp test_done "$testroot" "$ret"
425 a919d5c4 2020-07-23 stsp echo 'D alpha.link' > $testroot/stdout.expected
426 a919d5c4 2020-07-23 stsp echo 'D epsilon.link' >> $testroot/stdout.expected
427 a919d5c4 2020-07-23 stsp echo 'D passwd.link' >> $testroot/stdout.expected
428 64773fde 2020-07-23 stsp echo 'D epsilon/beta.link' >> $testroot/stdout.expected
429 64773fde 2020-07-23 stsp echo 'D nonexistent.link' >> $testroot/stdout.expected
430 64773fde 2020-07-23 stsp (cd $testroot/wt && got rm alpha.link epsilon.link passwd.link \
431 64773fde 2020-07-23 stsp epsilon/beta.link nonexistent.link > $testroot/stdout)
433 766841c2 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
435 766841c2 2020-08-13 stsp if [ "$ret" != "0" ]; then
436 766841c2 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
438 766841c2 2020-08-13 stsp test_done "$testroot" "$ret"
441 f6cae3ed 2020-09-13 naddy test_rm_status_code() {
442 766841c2 2020-08-13 stsp local testroot=`test_init rm_status_code`
444 766841c2 2020-08-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
446 766841c2 2020-08-13 stsp if [ "$ret" != "0" ]; then
447 766841c2 2020-08-13 stsp test_done "$testroot" "$ret"
451 766841c2 2020-08-13 stsp echo "modified beta" > $testroot/wt/beta
453 766841c2 2020-08-13 stsp echo "got: invalid status code 'x'" > $testroot/stderr.expected
454 766841c2 2020-08-13 stsp (cd $testroot/wt && got rm -s Mx beta 2>$testroot/stderr)
456 766841c2 2020-08-13 stsp cmp -s $testroot/stderr.expected $testroot/stderr
458 766841c2 2020-08-13 stsp if [ "$ret" != "0" ]; then
459 766841c2 2020-08-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
460 766841c2 2020-08-13 stsp test_done "$testroot" "$ret"
464 766841c2 2020-08-13 stsp rm $testroot/wt/epsilon/zeta # put file into 'missing' status
466 766841c2 2020-08-13 stsp echo 'D epsilon/zeta' > $testroot/stdout.expected
467 766841c2 2020-08-13 stsp (cd $testroot/wt && got rm -R -s '!' . >$testroot/stdout)
469 766841c2 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
471 766841c2 2020-08-13 stsp if [ "$ret" != "0" ]; then
472 766841c2 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
475 766841c2 2020-08-13 stsp if [ ! -e $testroot/wt/beta ]; then
476 766841c2 2020-08-13 stsp echo "file beta was unexpectedly removed from disk" >&2
477 766841c2 2020-08-13 stsp test_done "$testroot" "1"
481 766841c2 2020-08-13 stsp # put file into 'missing' status again
482 766841c2 2020-08-13 stsp (cd $testroot/wt && got revert epsilon/zeta > /dev/null)
483 766841c2 2020-08-13 stsp rm $testroot/wt/epsilon/zeta
485 766841c2 2020-08-13 stsp echo 'D beta' > $testroot/stdout.expected
486 766841c2 2020-08-13 stsp echo 'D epsilon/zeta' >> $testroot/stdout.expected
487 766841c2 2020-08-13 stsp (cd $testroot/wt && got rm -R -s 'M!' . >$testroot/stdout)
489 15341bfd 2020-03-05 tracey cmp -s $testroot/stdout.expected $testroot/stdout
491 15341bfd 2020-03-05 tracey if [ "$ret" != "0" ]; then
492 15341bfd 2020-03-05 tracey diff -u $testroot/stdout.expected $testroot/stdout
493 766841c2 2020-08-13 stsp test_done "$testroot" "1"
497 766841c2 2020-08-13 stsp if [ -e $testroot/wt/beta ]; then
498 766841c2 2020-08-13 stsp echo "removed file beta still exists on disk" >&2
499 766841c2 2020-08-13 stsp test_done "$testroot" "1"
503 766841c2 2020-08-13 stsp echo 'D beta' > $testroot/stdout.expected
504 766841c2 2020-08-13 stsp echo 'D epsilon/zeta' >> $testroot/stdout.expected
505 766841c2 2020-08-13 stsp (cd $testroot/wt && got status > $testroot/stdout)
506 766841c2 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
508 766841c2 2020-08-13 stsp if [ "$ret" != "0" ]; then
509 766841c2 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
510 766841c2 2020-08-13 stsp test_done "$testroot" "1"
514 15341bfd 2020-03-05 tracey test_done "$testroot" "$ret"
518 7fb414ae 2020-08-08 stsp test_parseargs "$@"
519 2ec1f75b 2019-03-26 stsp run_test test_rm_basic
520 2ec1f75b 2019-03-26 stsp run_test test_rm_with_local_mods
521 71a29355 2019-03-27 stsp run_test test_double_rm
522 f0b0c0ce 2019-08-04 stsp run_test test_rm_and_add_elsewhere
523 f2a9dc41 2019-12-13 tracey run_test test_rm_directory
524 70e3e7f5 2019-12-13 tracey run_test test_rm_directory_keep_files
525 15341bfd 2020-03-05 tracey run_test test_rm_subtree
526 a919d5c4 2020-07-23 stsp run_test test_rm_symlink
527 766841c2 2020-08-13 stsp run_test test_rm_status_code