[sheepdog] [PATCH stable-0.6 19/22] tests/functional: add test for reading/writing partially zeroed data

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Aug 12 16:55:23 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 tests/functional/071       | 44 +++++++++++++++++++++
 tests/functional/071.out   | 98 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/functional/common.rc |  5 +++
 tests/functional/group     |  1 +
 4 files changed, 148 insertions(+)
 create mode 100755 tests/functional/071
 create mode 100644 tests/functional/071.out

diff --git a/tests/functional/071 b/tests/functional/071
new file mode 100755
index 0000000..1d6a41f
--- /dev/null
+++ b/tests/functional/071
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Test partially zeroed data
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1        # failure is the default!
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_cleanup
+
+for i in 0 1 2; do
+    _start_sheep $i
+done
+
+_wait_for_sheep 3
+
+_cluster_format
+
+$COLLIE vdi create test 4M
+
+# Create a 28 KB file.  The first 12 KB (3 blocks) is filled with zero,
+# next 4 KB is filled with one, and the rest is filled with zero.
+DATA_FILE="$STORE/data"
+rm -f $DATA_FILE
+dd if=<(_one) of=$DATA_FILE bs=4k seek=3 count=1 2> /dev/null
+truncate $DATA_FILE -s 28k
+
+for skip in 0 1 2 3; do
+    for offset in 0 512; do
+	for length in $((4 * 4096)) $((4 * 4096 - 512)); do
+	    dd if=$DATA_FILE bs=4k skip=$skip count=4 2> /dev/null \
+		| $COLLIE vdi write test $offset $length
+
+	    $COLLIE vdi read test $offset $length | hd
+	done
+    done
+done
diff --git a/tests/functional/071.out b/tests/functional/071.out
new file mode 100644
index 0000000..9ef24b3
--- /dev/null
+++ b/tests/functional/071.out
@@ -0,0 +1,98 @@
+QA output created by 071
+using backend plain store
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00004000
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00003e00
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00004000
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00003e00
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00002000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00003000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00004000
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00002000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00003000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003e00
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00002000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00003000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00004000
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00002000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00003000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003e00
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00001000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00002000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00004000
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00001000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00002000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003e00
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00001000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00002000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00004000
+00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00001000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00002000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003e00
+00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00001000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00004000
+00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00001000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003e00
+00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00001000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00004000
+00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
+*
+00001000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00003e00
diff --git a/tests/functional/common.rc b/tests/functional/common.rc
index 56900c9..7b36c89 100644
--- a/tests/functional/common.rc
+++ b/tests/functional/common.rc
@@ -466,6 +466,11 @@ _random()
 	openssl enc -aes-128-cbc -pass pass:"$(date)" -nosalt < /dev/zero 2>/dev/null
 }
 
+_one()
+{
+    yes $'\xFF' | tr -d "\n"
+}
+
 _kill_zk_session()
 {
 	local path="/sheepdog/member/IPv4 ip:127.0.0.1 port:700$1"
diff --git a/tests/functional/group b/tests/functional/group
index c16acc7..489248d 100644
--- a/tests/functional/group
+++ b/tests/functional/group
@@ -84,3 +84,4 @@
 068 auto quick cluster
 069 auto quick cluster md
 070 auto quick cluster md
+071 auto quick store md
-- 
1.8.1.2




More information about the sheepdog mailing list