summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2011-10-13 16:03:34 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2011-10-13 16:03:34 +0100
commitc131cb9586bfdd5ce19c33639e908b89c44104d7 (patch)
tree0dad02a08f19141362e11343b74c283f75bd126f /tests
parent1e9d1410e355d8ad0ab1cdcc12c396e0670882c0 (diff)
downloadtbdiff-c131cb9586bfdd5ce19c33639e908b89c44104d7.tar.gz
Tests and fix for a horrific bug where removing a symlink to a
directory would remove the directory
Diffstat (limited to 'tests')
-rwxr-xr-xtests/05_symlink_add_remove.sh26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/05_symlink_add_remove.sh b/tests/05_symlink_add_remove.sh
index 5e841bf..0c8b0ac 100755
--- a/tests/05_symlink_add_remove.sh
+++ b/tests/05_symlink_add_remove.sh
@@ -12,17 +12,27 @@ TEST_TOOLS=$3
############# Test specific code ############
setup () {
- ln -s /foo $ORIGIN/remove && \
- ln -s /bar $TARGET/add && \
- chown -h :cdrom $TARGET/add
+ ln -s /foo $ORIGIN/remove &&
+ ln -s /bar $TARGET/add &&
+ chown -h :cdrom $TARGET/add &&
+ for dir in $ORIGIN $TARGET; do
+ (
+ cd $dir && mkdir -p data &&
+ touch data/a data/b
+ ); done &&
+ (cd $ORIGIN && ln -s data datalink)
}
check_results () {
- test -L $ORIGIN/add && \
- test ! -L $ORIGIN/remove && \
- check_symlink $ORIGIN/add "/bar" && \
- check_same_mtime $ORIGIN/add $TARGET/add && \
- check_same_uidgid $ORIGIN/add $TARGET/add
+ test -L $ORIGIN/add &&
+ test ! -L $ORIGIN/remove &&
+ check_symlink $ORIGIN/add "/bar" &&
+ check_same_mtime $ORIGIN/add $TARGET/add &&
+ check_same_uidgid $ORIGIN/add $TARGET/add &&
+ test ! -L $ORIGIN/datalink &&
+ test -d $ORIGIN/data &&
+ test -f $ORIGIN/data/a &&
+ test -f $ORIGIN/data/b
}
#############################################