diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2013-11-19 14:51:20 +0000 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2013-11-20 12:48:25 +0000 |
commit | e5bba1a2bd7d375e2728152ab321d319ab10f3b9 (patch) | |
tree | d986a450f84fb83a05b0dd17a69301e2fe3bfc98 | |
parent | a63142c9e6a97f9b145e784ae9175c36294f7e14 (diff) | |
download | tbdiff-baserock/test_branch.tar.gz |
Socket scenarios addedbaserock/test_branch
-rw-r--r-- | yarns/create-deploy.yarn | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/yarns/create-deploy.yarn b/yarns/create-deploy.yarn index 7dbb1c4..e06690a 100644 --- a/yarns/create-deploy.yarn +++ b/yarns/create-deploy.yarn @@ -259,6 +259,36 @@ And this scenario checks that the setgid bit of a directory is set accordingly. AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir' THEN the directory 'A_dir/1_dir' has its setgid bit set +Changing, adding and removing of sockets +---------------------------------------- + +Sockets can only be moved, linked or removed by the file system, creation is +only performed by the program that acts as the server, tbdiff won't be doing +that so the only sensible operation is removal. + + SCENARIO Removing of a socket works + GIVEN a directory called 'A_dir' + AND a socket called 'minus_socket' in directory 'A_dir' + AND a directory called 'B_dir' + WHEN tbdiff-create creates a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff' + AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A_dir' + THEN the socket 'A_dir/minus_socket' no longer exists + + SCENARIO Creation of a socket doesn't work + GIVEN a directory called 'A_dir' + AND a directory called 'B_dir' + AND a socket called 'minus_socket' in directory 'B_dir' + WHEN tbdiff-create attempts to create a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff' + THEN stderr contains "tbdiff-create cannot create sockets" + + SCENARIO Changing a socket doesn't work + GIVEN a directory called 'A_dir' + AND a socket called 'foo_socket' in directory 'A_dir' + AND a directory called 'B_dir' + AND a socket called 'foo_socket' in directory 'B_dir' + WHEN tbdiff-create attempts to create a binary delta between directories 'A_dir' and 'B_dir', called 'AB.tbdiff' + THEN stderr contains "tbdiff-create cannot create sockets" + IMPLEMENTS ========== @@ -294,8 +324,16 @@ Implementations for the creating and deploying of binary deltas [ -n "$MATCH_2" ] && mkdir -p "$DATADIR/$MATCH_2" mkdir "$DATADIR/$MATCH_2/$MATCH_1" - IMPLEMENTS WHEN tbdiff-create creates a binary delta between directories '([^']+)' and '([^']+)', called '([^']+)' - "$SRCDIR/tbdiff-create/tbdiff-create" "$DATADIR/$MATCH_3" "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2" + IMPLEMENTS GIVEN a socket called '([^']+)'(?: in directory '([^']+)')? + [ -n "$MATCH_2" ] && mkdir -p "$DATADIR/$MATCH_2" + "$SRCDIR/sockbind" "$DATADIR/$MATCH_2/$MATCH_1" + + IMPLEMENTS WHEN tbdiff-create (attempts to create|creates) a binary delta between directories '([^']+)' and '([^']+)', called '([^']+)' + set "$SRCDIR/tbdiff-create/tbdiff-create" "$DATADIR/$MATCH_4" "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_3" + if [ $MATCH_1 == creates ]; then "$@" + else + set +e; "$@" 2> "$DATADIR/stderr"; set -e + fi IMPLEMENTS WHEN tbdiff-deploy applies the delta '([^']+)' to '([^']+)' cd "$DATADIR/$MATCH_2" @@ -310,7 +348,7 @@ Implementations for the creating and deploying of binary deltas IMPLEMENTS THEN the (?:file|directory|named pipe) '([^']+)' has the permissions '([^']+)' test "$(stat -c %A "$DATADIR/$MATCH_1")" = "$MATCH_2" - IMPLEMENTS THEN the (?:file|directory|named pipe|symbolic link) '([^']+)' no longer exists + IMPLEMENTS THEN the (?:file|directory|named pipe|symbolic link|socket) '([^']+)' no longer exists test ! -e "$DATADIR/$MATCH_1" IMPLEMENTS THEN the directory '([^']+)' contains the regular file '([^']+)' @@ -336,3 +374,6 @@ Implementations for the creating and deploying of binary deltas IMPLEMENTS THEN the directory '([^']+)' has its setgid bit set test -g "$DATADIR/$MATCH_1" + + IMPLEMENTS THEN (\S+) contains "([^"]+)" + grep "$MATCH_2" "$DATADIR/$MATCH_1" |