[sheepdog] [PATCH v6 9/9] add functional test case for hyper volume

Robin Dong robin.k.dong at gmail.com
Mon Nov 11 07:55:35 CET 2013


Add test case for writing, reading and recovery of hyper volume.

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 tests/functional/077   |   54 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/functional/group |    1 +
 2 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100644 tests/functional/077

diff --git a/tests/functional/077 b/tests/functional/077
new file mode 100644
index 0000000..32064cd
--- /dev/null
+++ b/tests/functional/077
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+
+. ./common
+
+for i in `seq 0 2`; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 16P -b
+_vdi_list
+
+# write many 2MB data from different offset of vdi
+for i in `seq 0 15`; do
+	_random | head -c 2M > $STORE/b$i
+	cat $STORE/b$i | md5sum > $STORE/cs$i
+	dd if=$STORE/b$i 2>/dev/null | $DOG vdi write test ${i}P 2M
+done
+
+# read these data out and check
+for i in `seq 0 15`; do
+	$DOG vdi read test ${i}P 2M > $STORE/c$i
+	cat $STORE/c$i | md5sum > $STORE/csum$i
+	diff -u -a $STORE/cs$i $STORE/csum$i
+done
+
+_vdi_list
+
+_cleanup
+
+# test sheep recovery logic for hyper volume (B-tree)
+for i in `seq 0 2`; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$DOG vdi create test 16P -b
+_vdi_list
+_random | $DOG vdi write test 15P 2M
+$DOG vdi read test 15P 2M | md5sum > $STORE/csum1
+
+_kill_sheep 2;
+$DOG vdi read test 15P 2M | md5sum > $STORE/csum2
+
+diff -u $STORE/csum1 $STORE/csum2
+
+_vdi_list
diff --git a/tests/functional/group b/tests/functional/group
index 8d15ffe..a44ae6a 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -91,3 +91,4 @@
 074 auto quick clster md
 075 auto quick vdi md
 076 auto quick vdi md
+077 auto quick vdi md
-- 
1.7.1




More information about the sheepdog mailing list