summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2013-12-11 17:27:57 +0000
committerBen Brown <ben.brown@codethink.co.uk>2013-12-11 17:27:57 +0000
commit775d05edada9d9fdf2bd9bc4eb62bbeec0961ad4 (patch)
treead3d5c78c6db538d849324814004fa5a8b4b9bda
parent0037d10f2e7f1298b376ff4819dc8d7bf19f2eb9 (diff)
parent9585ad83652220527be88afda05d719781e14f16 (diff)
downloadtbdiff-775d05edada9d9fdf2bd9bc4eb62bbeec0961ad4.tar.gz
Merge branch 'benbrown/S9462/convert-device-tests'
-rw-r--r--yarns/create-deploy.yarn65
1 files changed, 55 insertions, 10 deletions
diff --git a/yarns/create-deploy.yarn b/yarns/create-deploy.yarn
index 7dbb1c4..02106ad 100644
--- a/yarns/create-deploy.yarn
+++ b/yarns/create-deploy.yarn
@@ -163,6 +163,26 @@ successfully removes and creates the appropriate files.
THEN the directory 'A_dir/minus_dir' no longer exists
AND the directory 'A_dir' contains the directory 'plus_dir'
+ SCENARIO Adding and removing of character devices works
+ GIVEN a directory called 'A_dir'
+ AND a character device called 'minus_chardev' with major number '1' and minor number '3' in directory 'A_dir'
+ AND a directory called 'B_dir'
+ AND a character device called 'plus_chardev' with major number '1' and minor number '3' in directory '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 character device 'A_dir/minus_chardev' no longer exists
+ AND the directory 'A_dir' contains the character device 'plus_chardev'
+
+ SCENARIO Adding and removing of block devices works
+ GIVEN a directory called 'A_dir'
+ AND a block device called 'minus_blockdev' with major number '1' and minor number '3' in directory 'A_dir'
+ AND a directory called 'B_dir'
+ AND a block device called 'plus_blockdev' with major number '1' and minor number '3' in directory '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 block device 'A_dir/minus_blockdev' no longer exists
+ AND the directory 'A_dir' contains the block device 'plus_blockdev'
+
Changing modification time of a file
------------------------------------
@@ -259,6 +279,30 @@ 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 the device numbers of special files
+--------------------------------------------
+
+These scenarios check that the minor and major device numbers of special files
+are appropriately changed when a patch has been generated and deployed.
+
+ SCENARIO Changing a character special file's device numbers works
+ GIVEN a directory called 'A_dir'
+ AND a character device called 'foo_chardev' with major number '3' and minor number '9' in directory 'A_dir'
+ AND a directory called 'B_dir'
+ AND a character device called 'foo_chardev' with major number '1' and minor number '3' in directory '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 character devices 'A_dir/foo_chardev' and 'B_dir/foo_chardev' have the same device numbers
+
+ SCENARIO Changing a block special file's device numbers works
+ GIVEN a directory called 'A_dir'
+ AND a block device called 'foo_blockdev' with major number '2' and minor number '7' in directory 'A_dir'
+ AND a directory called 'B_dir'
+ AND a block device called 'foo_blockdev' with major number '1' and minor number '3' in directory '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 block devices 'A_dir/foo_blockdev' and 'B_dir/foo_blockdev' have the same device numbers
+
IMPLEMENTS
==========
@@ -294,6 +338,10 @@ Implementations for the creating and deploying of binary deltas
[ -n "$MATCH_2" ] && mkdir -p "$DATADIR/$MATCH_2"
mkdir "$DATADIR/$MATCH_2/$MATCH_1"
+ IMPLEMENTS GIVEN a (character|block) device called '([^']+)' with major number '([0-9]+)' and minor number '([0-9]+)'(?: in directory '([^']+)')?
+ [ -n "$MATCH_5" ] && mkdir -p "$DATADIR/$MATCH_5"
+ mknod "$DATADIR/$MATCH_5/$MATCH_2" "$(echo "$MATCH_1" | head -c 1)" "$MATCH_3" "$MATCH_4"
+
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"
@@ -310,29 +358,26 @@ 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|(?:character|block) device) '([^']+)' no longer exists
test ! -e "$DATADIR/$MATCH_1"
- IMPLEMENTS THEN the directory '([^']+)' contains the regular file '([^']+)'
- test -f "$DATADIR/$MATCH_1/$MATCH_2"
-
IMPLEMENTS THEN the (?:files|directories|named pipes|symbolic links) '([^']+)' and '([^']+)' have the same modification time
test "$(stat -c %y "$DATADIR/$MATCH_1")" = "$(stat -c %y "$DATADIR/$MATCH_2")"
- IMPLEMENTS THEN the directory '([^']+)' contains the named pipe '([^']+)'
- test -p "$DATADIR/$MATCH_1/$MATCH_2"
-
IMPLEMENTS THEN the directory '([^']+)' contains the symbolic link '([^']+)'
test -h "$DATADIR/$MATCH_1/$MATCH_2"
IMPLEMENTS THEN the symbolic links '([^']+)' and '([^']+)' refer to the same thing
test "$(readlink "$DATADIR/$MATCH_1")" = "$(readlink "$DATADIR/$MATCH_2")"
- IMPLEMENTS THEN the directory '([^']+)' contains the directory '([^']+)'
- test -d "$DATADIR/$MATCH_1/$MATCH_2"
-
IMPLEMENTS THEN the directory '([^']+)' has its sticky bit set
test -k "$DATADIR/$MATCH_1"
IMPLEMENTS THEN the directory '([^']+)' has its setgid bit set
test -g "$DATADIR/$MATCH_1"
+
+ IMPLEMENTS THEN the directory '([^']+)' contains the ((?:character|block) device|named pipe|directory|regular file) '([^']+)'
+ test -"$(echo "$MATCH_2" | sed -r 's/(named|regular) //' | head -c 1)" "$DATADIR/$MATCH_1/$MATCH_3"
+
+ IMPLEMENTS THEN the (?:block|character) devices '([^']+)' and '([^']+)' have the same device numbers
+ test "$(stat -c '%t %T' "$DATADIR/$MATCH_1")" = "$(stat -c '%t %T' "$DATADIR/$MATCH_2")"