summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2011-10-06 16:13:52 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2011-10-06 16:13:52 +0100
commitf083ad60f671c0d058668c64ff2bb9ca8fad6fb2 (patch)
tree72fb9bc263efb4fe17226ea59dc5127fd47155d3 /tests
parentd9808d402d04ae320284b41133c16398ff64318c (diff)
downloadtbdiff-f083ad60f671c0d058668c64ff2bb9ca8fad6fb2.tar.gz
Added tests for block devices
Diffstat (limited to 'tests')
-rwxr-xr-xtests/10_blockdev_diff.sh26
-rwxr-xr-xtests/11_blockdev_add_remove.sh27
2 files changed, 53 insertions, 0 deletions
diff --git a/tests/10_blockdev_diff.sh b/tests/10_blockdev_diff.sh
new file mode 100755
index 0000000..2565ba4
--- /dev/null
+++ b/tests/10_blockdev_diff.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+TEST_ID="10"
+TEST_NAME="Block device difference"
+
+CREATE=`pwd`/$1
+DEPLOY=`pwd`/$2
+TEST_TOOLS=$3
+
+. ./test_lib.sh
+
+############# Test specific code ############
+
+setup () {
+ mknod $ORIGIN/tochange b `stat /dev/null -c '%t %T'`
+ mknod $TARGET/tochange b `stat /dev/full -c '%t %T'`
+}
+
+check_results () {
+ test -b $ORIGIN/tochange &&
+ test "`stat -c '%t %T' $ORIGIN/tochange`" = \
+ "`stat -c '%t %T' $TARGET/tochange`"
+}
+
+#############################################
+main $@
diff --git a/tests/11_blockdev_add_remove.sh b/tests/11_blockdev_add_remove.sh
new file mode 100755
index 0000000..4fa7f5a
--- /dev/null
+++ b/tests/11_blockdev_add_remove.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+TEST_ID="11"
+TEST_NAME="Block device add and remove"
+
+CREATE=`pwd`/$1
+DEPLOY=`pwd`/$2
+TEST_TOOLS=$3
+
+. ./test_lib.sh
+
+############# Test specific code ############
+
+setup () {
+ #make a node with the same numbers as /dev/null
+ setup_block_major_minor="`stat /dev/null -c '%t %T'`"
+ mknod $ORIGIN/toremove b $setup_block_major_minor
+ mknod $TARGET/toadd b $setup_block_major_minor
+}
+
+check_results () {
+ test -b $ORIGIN/toadd &&
+ test ! -b $ORIGIN/toremove
+}
+
+#############################################
+main $@