[sheepdog] [PATCH 1/2] tests/functional: add test for reading/writing partially zeroed data

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Aug 7 16:39:20 CEST 2013


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 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 9652167..0ea0be0 100644
--- a/tests/functional/common.rc
+++ b/tests/functional/common.rc
@@ -485,6 +485,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:$((7000+$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.3.566.gaa39828




More information about the sheepdog mailing list