From: Colin Patrick McCabe Date: Mon, 24 Jan 2011 15:34:40 +0000 (-0800) Subject: test: Add test_rw X-Git-Tag: v0.25~259 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a2a7d03934af989744ee81470c43a5af0edd470f;p=ceph.git test: Add test_rw Test reading and writing lots of objects from the object store. Signed-off-by: Colin McCabe --- diff --git a/src/test/test_common.sh b/src/test/test_common.sh index 1d7de583a46d..6ac3585129be 100755 --- a/src/test/test_common.sh +++ b/src/test/test_common.sh @@ -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 index 000000000000..0cfcec85557d --- /dev/null +++ b/src/test/test_rw.sh @@ -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" +} + +$@