]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: test rados put and get 1327/head
authorLoic Dachary <loic@dachary.org>
Sun, 2 Mar 2014 16:54:39 +0000 (17:54 +0100)
committerLoic Dachary <loic@dachary.org>
Mon, 3 Mar 2014 08:28:56 +0000 (09:28 +0100)
Check that rados put immediately followed by rados get retrieves exactly
the same content.

http://tracker.ceph.com/issues/7423 refs #7423

Signed-off-by: Loic Dachary <loic@dachary.org>
src/test/erasure-code/Makefile.am
src/test/erasure-code/test-erasure-code.sh [new file with mode: 0755]

index dc94168262b6f2acd6d07eb57683e26235fcd539..30f461cc2f61d0288753de6ce42caf52bfa8b6f6 100644 (file)
@@ -1,3 +1,6 @@
+check_SCRIPTS += \
+       test/erasure-code/test-erasure-code.sh
+
 ceph_erasure_code_benchmark_SOURCES = \
        test/erasure-code/ceph_erasure_code_benchmark.cc
 ceph_erasure_code_benchmark_LDADD = $(LIBOSD) $(LIBCOMMON) $(BOOST_PROGRAM_OPTIONS_LIBS) $(CEPH_GLOBAL)
diff --git a/src/test/erasure-code/test-erasure-code.sh b/src/test/erasure-code/test-erasure-code.sh
new file mode 100755 (executable)
index 0000000..6474c07
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library Public License for more details.
+#
+
+source test/mon/mon-test-helpers.sh
+source test/osd/osd-test-helpers.sh
+
+function run() {
+    local dir=$1
+
+    export CEPH_ARGS
+    CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none "
+    CEPH_ARGS+="--mon-host=127.0.0.1 "
+
+    setup $dir || return 1
+    run_mon $dir a --public-addr 127.0.0.1 || return 1
+    for id in $(seq 0 4) ; do
+        run_osd $dir $id || return 1
+    done
+    create_erasure_coded_pool || return 1
+    FUNCTIONS=${FUNCTIONS:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')}
+    for TEST_function in $FUNCTIONS ; do
+        if ! $TEST_function $dir ; then
+            cat $dir/a/log
+            return 1
+        fi
+    done
+    teardown $dir || return 1
+}
+
+function create_erasure_coded_pool() {
+    local plugin_parameters="erasure-code-k=2 erasure-code-m=1"
+    ./ceph osd crush rule create-erasure ecruleset \
+        $plugin_parameters \
+        erasure-code-ruleset-failure-domain=osd || return 1
+    ./ceph osd pool create ecpool 12 12 erasure crush_ruleset=ecruleset \
+        $plugin_parameters || return 1
+}
+
+function TEST_rados_put() {
+    local dir=$1
+    local payload=ABC
+    echo "$payload" > $dir/ORIGINAL
+
+    ./rados --pool ecpool put SOMETHING $dir/ORIGINAL || return 1
+    ./rados --pool ecpool get SOMETHING $dir/COPY || return 1
+
+    diff $dir/ORIGINAL $dir/COPY || return 1
+
+    rm $dir/ORIGINAL $dir/COPY
+}
+
+main test-erasure-code
+
+# Local Variables:
+# compile-command: "cd ../.. ; make -j4 && test/erasure-code/test-erasure-code.sh"
+# End: