batch-mode.test 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #! /bin/sh
  2. # Copyright (C) 2004 by Chris Shoemaker <c.shoemaker@cox.net>
  3. # This program is distributable under the terms of the GNU GPL (see
  4. # COPYING).
  5. # Test rsync's --write-batch and --read-batch options
  6. . "$suitedir/rsync.fns"
  7. hands_setup
  8. cd "$tmpdir"
  9. # Build chkdir for the daemon tests using a normal rsync and an --exclude.
  10. $RSYNC -av --exclude=foobar.baz "$fromdir/" "$chkdir/"
  11. $RSYNC -av --only-write-batch=BATCH --exclude=foobar.baz "$fromdir/" "$todir/missing/"
  12. test -d "$todir/missing" && test_fail "--only-write-batch should not have created destination dir"
  13. runtest "--read-batch (only)" 'checkit "$RSYNC -av --read-batch=BATCH \"$todir\"" "$chkdir" "$todir"'
  14. rm -rf "$todir" BATCH*
  15. runtest "local --write-batch" 'checkit "$RSYNC -av --write-batch=BATCH \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"'
  16. rm -rf "$todir"
  17. runtest "--read-batch" 'checkit "$RSYNC -av --read-batch=BATCH \"$todir\"" "$fromdir" "$todir"'
  18. build_rsyncd_conf
  19. RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
  20. export RSYNC_CONNECT_PROG
  21. rm -rf "$todir"
  22. runtest "daemon sender --write-batch" 'checkit "$RSYNC -av --write-batch=BATCH rsync://localhost/test-from/ \"$todir\"" "$chkdir" "$todir"'
  23. rm -rf "$todir"
  24. runtest "--read-batch from daemon" 'checkit "$RSYNC -av --read-batch=BATCH \"$todir\"" "$chkdir" "$todir"'
  25. rm -rf "$todir"
  26. runtest "BATCH.sh use of --read-batch" 'checkit "./BATCH.sh" "$chkdir" "$todir"'
  27. runtest "do-nothing re-run of batch" 'checkit "./BATCH.sh" "$chkdir" "$todir"'
  28. rm -rf "$todir"
  29. mkdir "$todir" || test_fail "failed to restore empty destination directory"
  30. runtest "daemon recv --write-batch" 'checkit "\"$ignore23\" $RSYNC -av --write-batch=BATCH \"$fromdir/\" rsync://localhost/test-to" "$chkdir" "$todir"'
  31. # The script would have aborted on error, so getting here means we pass.
  32. exit 0