From a2a7d03934af989744ee81470c43a5af0edd470f Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Mon, 24 Jan 2011 07:34:40 -0800 Subject: [PATCH] test: Add test_rw Test reading and writing lots of objects from the object store. Signed-off-by: Colin McCabe --- src/test/test_common.sh | 13 +++++++++++ src/test/test_rw.sh | 50 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 src/test/test_rw.sh diff --git a/src/test/test_common.sh b/src/test/test_common.sh index 1d7de583a46d4..6ac3585129be2 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 0000000000000..0cfcec85557da --- /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" +} + +$@ -- 2.39.5