From: Greg Farnum Date: Tue, 31 May 2016 23:18:19 +0000 (-0700) Subject: test: split objectcacher test into 'stress' and 'correctness' X-Git-Tag: ses5-milestone5~564^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc9aab1b0a22c3f7320046b97f75dccf2b86cc6d;p=ceph.git test: split objectcacher test into 'stress' and 'correctness' Signed-off-by: Greg Farnum --- diff --git a/qa/workunits/osdc/stress_objectcacher.sh b/qa/workunits/osdc/stress_objectcacher.sh index e6b9ec121ea8..67baadc3317c 100755 --- a/qa/workunits/osdc/stress_objectcacher.sh +++ b/qa/workunits/osdc/stress_objectcacher.sh @@ -14,7 +14,7 @@ do do for MAX_DIRTY in 0 25165824 do - ceph_test_objectcacher_stress --ops $OPS --percent-read $READS --delay-ns $DELAY --objects $OBJECTS --max-op-size $OP_SIZE --client-oc-max-dirty $MAX_DIRTY > /dev/null 2>&1 + ceph_test_objectcacher_stress --ops $OPS --percent-read $READS --delay-ns $DELAY --objects $OBJECTS --max-op-size $OP_SIZE --client-oc-max-dirty $MAX_DIRTY --stress-test > /dev/null 2>&1 done done done @@ -23,4 +23,6 @@ do done done +ceph_test_objectcacher_stress --correctness-test > /dev/null 2>&1 + echo OK diff --git a/src/test/osdc/object_cacher_stress.cc b/src/test/osdc/object_cacher_stress.cc index b961f75769ca..ffe84c242cea 100644 --- a/src/test/osdc/object_cacher_stress.cc +++ b/src/test/osdc/object_cacher_stress.cc @@ -21,6 +21,7 @@ #include "osdc/ObjectCacher.h" #include "FakeWriteback.h" +#include "MemWriteback.h" // XXX: Only tests default namespace struct op_data { @@ -173,6 +174,24 @@ int stress_test(uint64_t num_ops, uint64_t num_objs, return EXIT_SUCCESS; } +int correctness_test(uint64_t delay_ns) +{ + Mutex lock("object_cacher_stress::object_cacher"); + MemWriteback writeback(g_ceph_context, &lock, delay_ns); + + ObjectCacher obc(g_ceph_context, "test", writeback, lock, NULL, NULL, + g_conf->client_oc_size, + g_conf->client_oc_max_objects, + g_conf->client_oc_max_dirty, + g_conf->client_oc_target_dirty, + g_conf->client_oc_max_dirty_age, + true); + obc.start(); + + std::cout << "Testing ObjectCacher correctness" << std::endl; + return 0; +} + int main(int argc, const char **argv) { std::vector args; @@ -187,6 +206,8 @@ int main(int argc, const char **argv) long long num_objs = 10; float percent_reads = 0.90; int seed = time(0) % 100000; + bool stress = false; + bool correctness = false; std::ostringstream err; std::vector::iterator i; for (i = args.begin(); i != args.end();) { @@ -225,12 +246,21 @@ int main(int argc, const char **argv) cerr << argv[0] << ": " << err.str() << std::endl; return EXIT_FAILURE; } + } else if (ceph_argparse_flag(args, i, "--stress-test", NULL)) { + stress = true; + } else if (ceph_argparse_flag(args, i, "--correctness-test", NULL)) { + correctness = true; } else { cerr << "unknown option " << *i << std::endl; return EXIT_FAILURE; } } - srandom(seed); - return stress_test(num_ops, num_objs, obj_bytes, delay_ns, max_len, percent_reads); + if (stress) { + srandom(seed); + return stress_test(num_ops, num_objs, obj_bytes, delay_ns, max_len, percent_reads); + } + if (correctness) { + return correctness_test(delay_ns); + } }