relative.test 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. # Copyright (C) 2005 by Wayne Davison <wayned@samba.org>
  3. #
  4. # This program is distributable under the terms of the GNU GPL (see COPYING)
  5. . "$suitedir/rsync.fns"
  6. deepstr='down/3/deep'
  7. deepdir="$fromdir/$deepstr"
  8. extradir="$fromdir/extra"
  9. makepath "$deepdir" "$extradir/$deepstr" "$chkdir"
  10. fromdir="$deepdir"
  11. hands_setup
  12. fromdir="$tmpdir/from"
  13. extrafile="$extradir/./$deepstr/extra.added.value"
  14. echo wowza >"$extrafile"
  15. $RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$extradir/"
  16. outfile="$scratchdir/rsync.out"
  17. cd "$fromdir"
  18. # Main script starts here
  19. $RSYNC -ai --include=/down/ --exclude='/*' "$fromdir/" "$chkdir/"
  20. sleep 1
  21. runtest "basic relative" 'checkit "$RSYNC -avR ./$deepstr \"$todir\"" "$chkdir" "$todir"'
  22. ln $deepstr/filelist $deepstr/dir
  23. ln ../chk/$deepstr/filelist ../chk/$deepstr/dir
  24. runtest "hard links" 'checkit "$RSYNC -avHR ./$deepstr/ \"$todir\"" "$chkdir" "$todir"'
  25. cp "$deepdir/text" "$todir/$deepstr/ThisShouldGo"
  26. cp "$deepdir/text" "$todir/$deepstr/dir/ThisShouldGoToo"
  27. runtest "deletion" 'checkit "$RSYNC -avHR --del ./$deepstr/ \"$todir\"" "$chkdir" "$todir"'
  28. runtest "non-deletion" 'checkit "$RSYNC -aiHR --del ./$deepstr/ \"$todir\"" "$chkdir" "$todir"' \
  29. | tee "$outfile"
  30. # Make sure no files were deleted
  31. grep 'deleting ' "$outfile" && test_fail "Erroneous deletions occurred!"
  32. # Relative with merging.
  33. $RSYNC -ai "$extradir/down" "$chkdir/"
  34. checkit "$RSYNC -aiR $deepstr '$extrafile' '$todir'" "$chkdir" "$todir"
  35. checkit "$RSYNC -aiR --del $deepstr '$extrafile' '$todir'" "$chkdir" "$todir" \
  36. | tee "$outfile"
  37. # Make sure no files were deleted
  38. grep 'deleting ' "$outfile" && test_fail "Erroneous deletions occurred! (2)"
  39. # The script would have aborted on error, so getting here means we've won.
  40. exit 0