Fixed an "Internal abbrev error" when dealing with an xattr value
[rsync/rsync.git] / testsuite / delete.test
index fdd5966..8fa6035 100644 (file)
@@ -11,9 +11,7 @@
 
 hands_setup
 
-makepath "$chkdir"
-makepath "$todir/extradir"
-makepath "$todir/emptydir/subdir"
+makepath "$chkdir" "$todir/extradir" "$todir/emptydir/subdir"
 
 echo extra >"$todir"/remove1
 echo extra >"$todir"/remove2
@@ -21,12 +19,23 @@ echo extra >"$todir"/extradir/remove3
 echo extra >"$todir"/emptydir/subdir/remove4
 
 # Create two chk dirs, one with a copy of the source files, and one with
-# what we expect to be left behind by the copy using --remove-sent-files.
-$RSYNC -av "$fromdir/" "$chkdir/copy/"
+# what we expect to be left behind by the copy using --remove-source-files.
+# Also, make sure that --dry-run --del doesn't output anything extraneous.
+$RSYNC -av "$fromdir/" "$chkdir/copy/" >"$tmpdir/copy.out" 2>&1
+cat "$tmpdir/copy.out"
+egrep -v '^(created directory|sent|total size) ' "$tmpdir/copy.out" >"$tmpdir/copy.new"
+mv "$tmpdir/copy.new" "$tmpdir/copy.out"
+
+$RSYNC -avn --del "$fromdir/" "$chkdir/copy2/" >"$tmpdir/copy2.out" 2>&1 || true
+cat "$tmpdir/copy2.out"
+egrep -v '^(created directory|sent|total size) ' "$tmpdir/copy2.out" >"$tmpdir/copy2.new"
+mv "$tmpdir/copy2.new" "$tmpdir/copy2.out"
+
+diff $diffopt "$tmpdir/copy.out" "$tmpdir/copy2.out"
+
 $RSYNC -av -f 'exclude,! */' "$fromdir/" "$chkdir/empty/"
 
-checkit "$RSYNC -avv --del --remove-sent-files \
-    \"$fromdir/\" \"$todir/\"" "$chkdir/copy" "$todir"
+checkit "$RSYNC -avv --del --remove-source-files '$fromdir/' '$todir/'" "$chkdir/copy" "$todir"
 
 diff -r "$chkdir/empty" "$fromdir"
 
@@ -40,9 +49,9 @@ touch "$todir/foo" "$todir/bar" "$todir/baz"
 
 $RSYNC -r --exclude=baz --filter=': filters' --delete-excluded "$fromdir/" "$todir/"
 
-test -f "$todir/foo" || test_fail "rsync deleted $todir/foo"
-test -f "$todir/bar" && test_fail "rsync did not delete $todir/bar"
-test -f "$todir/baz" && test_fail "rsync did not delete $todir/baz"
+test -f "$todir/foo" || test_fail "rsync should NOT have deleted $todir/foo"
+test -f "$todir/bar" && test_fail "rsync SHOULD have deleted $todir/bar"
+test -f "$todir/baz" && test_fail "rsync SHOULD have deleted $todir/baz"
 
 # The script would have aborted on error, so getting here means we've won.
 exit 0