From: Loic Dachary Date: Thu, 8 Dec 2016 11:40:42 +0000 (+0100) Subject: tests: fix erasure-code premature deallocation of cct X-Git-Tag: v11.1.0~29^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=efa1e54362423d4cfd1541fb8c68237b7b9ebbe3;p=ceph.git tests: fix erasure-code premature deallocation of cct The setup function returns before the run function, the cct variable must be a data member, not a local variable that gets de-allocated before run() starts. Signed-off-by: Loic Dachary --- diff --git a/src/test/erasure-code/ceph_erasure_code.cc b/src/test/erasure-code/ceph_erasure_code.cc index f39900b88f07..52a21292cae2 100644 --- a/src/test/erasure-code/ceph_erasure_code.cc +++ b/src/test/erasure-code/ceph_erasure_code.cc @@ -37,6 +37,7 @@ namespace po = boost::program_options; class ErasureCodeCommand { po::variables_map vm; ErasureCodeProfile profile; + boost::intrusive_ptr cct; public: int setup(int argc, char** argv); int run(); @@ -82,7 +83,7 @@ int ErasureCodeCommand::setup(int argc, char** argv) { ceph_options.push_back(i->c_str()); } - auto cct = global_init( + cct = global_init( &def_args, ceph_options, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); diff --git a/src/test/erasure-code/ceph_erasure_code_benchmark.cc b/src/test/erasure-code/ceph_erasure_code_benchmark.cc index 01250cc774bd..238d8e6af826 100644 --- a/src/test/erasure-code/ceph_erasure_code_benchmark.cc +++ b/src/test/erasure-code/ceph_erasure_code_benchmark.cc @@ -81,7 +81,7 @@ int ErasureCodeBench::setup(int argc, char** argv) { ceph_options.push_back(i->c_str()); } - auto cct = global_init( + cct = global_init( &def_args, ceph_options, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, CINIT_FLAG_NO_DEFAULT_CONFIG_FILE); diff --git a/src/test/erasure-code/ceph_erasure_code_benchmark.h b/src/test/erasure-code/ceph_erasure_code_benchmark.h index c9375916473a..c65f716b1e17 100644 --- a/src/test/erasure-code/ceph_erasure_code_benchmark.h +++ b/src/test/erasure-code/ceph_erasure_code_benchmark.h @@ -38,6 +38,7 @@ class ErasureCodeBench { ErasureCodeProfile profile; bool verbose; + boost::intrusive_ptr cct; public: int setup(int argc, char** argv); int run();