]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Add test_rw
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 24 Jan 2011 15:34:40 +0000 (07:34 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Mon, 24 Jan 2011 15:43:10 +0000 (07:43 -0800)
Test reading and writing lots of objects from the object store.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/test/test_common.sh
src/test/test_rw.sh [new file with mode: 0755]

index 1d7de583a46d43e39078863ac4cbdeecb090d8a9..6ac3585129be23f8f601c317228c2e2bf5206c73 100755 (executable)
@@ -100,6 +100,19 @@ write_objects() {
         done
 }
 
+read_objects() {
+        ver=$1
+        num_objs=$2
+        obj_size=$3
+        [ -d "${TEMPDIR}" ] || die "must setup_tempdir"
+       chr=`perl -e "print chr(48+$ver)"`
+       head -c $obj_size /dev/zero  | tr '\0' "$chr" > $TEMPDIR/exemplar
+        for i in `seq -w 1 $num_objs`; do
+                ./rados -p $pool get obj$i $TEMPDIR/out$i || die "radostool failed"
+               cmp $TEMPDIR/out$i $TEMPDIR/exemplar || die "got back incorrect obj$i"
+        done
+}
+
 poll_cmd() {
         command=$1
         search_str=$2
diff --git a/src/test/test_rw.sh b/src/test/test_rw.sh
new file mode 100755 (executable)
index 0000000..0cfcec8
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash -x
+
+#
+# Generic read/write from object store test
+#
+
+# Includes
+source "`dirname $0`/test_common.sh"
+
+# Functions
+my_write_objects() {
+        write_objects $1 $2 10 1000000 data
+}
+
+setup() {
+        export CEPH_NUM_OSD=$1
+
+        # Start ceph
+        ./stop.sh
+
+        ./vstart.sh -d -n || die "vstart.sh failed"
+}
+
+read_write_1_impl() {
+        write_objects 1 2 100 8192 data
+        read_objects 2 100 8192 
+
+        write_objects 3 3 10 81920 data
+        read_objects 3 10 81920 
+
+        write_objects 4 4 100 4 data
+        read_objects 4 100 4
+
+        write_objects 1 2 100 8192 data
+        read_objects 2 100 8192
+
+        # success
+        return 0
+}
+
+read_write_1() {
+        setup 3
+        read_write_1_impl
+}
+
+run() {
+        read_write_1 || die "test failed"
+}
+
+$@