| 1 | #!/bin/sh -e |
| 2 | # This is a simple test script that tests a few rsync |
| 3 | # features to make sure I haven't broken them before a release. Thanks |
| 4 | # to Phil Hands for writing this |
| 5 | |
| 6 | export PATH=.:$PATH |
| 7 | TMP=/tmp/rsync-test.$$ |
| 8 | F1=README |
| 9 | |
| 10 | mkdir $TMP |
| 11 | |
| 12 | pause() { |
| 13 | echo ... press enter to continue |
| 14 | read |
| 15 | } |
| 16 | |
| 17 | echo "Test 1 basic operation" |
| 18 | rsync -av testin/ ${TMP}/rsync |
| 19 | diff -ur testin/ ${TMP}/rsync |
| 20 | pause |
| 21 | |
| 22 | echo "Test 2 - one file" |
| 23 | rm ${TMP}/rsync/${F1} |
| 24 | rsync -av testin/ ${TMP}/rsync |
| 25 | diff -ur testin/ ${TMP}/rsync |
| 26 | pause |
| 27 | |
| 28 | echo "Test 3 - extra data" |
| 29 | echo "extra line" >> ${TMP}/rsync/${F1} |
| 30 | rsync -av testin/ ${TMP}/rsync |
| 31 | diff -ur testin/ ${TMP}/rsync |
| 32 | pause |
| 33 | |
| 34 | echo "Test 4 - --delete" |
| 35 | cp testin/${F1} ${TMP}/rsync/f1 |
| 36 | rsync --delete -av testin/ ${TMP}/rsync |
| 37 | diff -ur testin/ ${TMP}/rsync |
| 38 | pause |
| 39 | |
| 40 | echo "Test 5 (uses ssh, so will fail if you don't have it) " |
| 41 | rm -rf ${TMP}/rsync |
| 42 | rsync -av -e ssh testin/ localhost:${TMP}/rsync |
| 43 | diff -ur testin/ ${TMP}/rsync |
| 44 | pause |
| 45 | |
| 46 | echo "Test 6 (uses ssh, so will fail if you don't have it) " |
| 47 | mv ${TMP}/rsync/${F1} ${TMP}/rsync/f1 |
| 48 | rsync --delete -av -e ssh testin/ localhost:${TMP}/rsync |
| 49 | diff -ur testin/ ${TMP}/rsync |
| 50 | pause |
| 51 | |
| 52 | rm -rf ${TMP} |
| 53 | |
| 54 | echo Tests Completed |