summaryrefslogtreecommitdiffstats
path: root/src/test/compressor/test_compression.cc
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2018-07-06 17:08:00 +0200
committerKefu Chai <kchai@redhat.com>2018-07-10 17:42:59 +0200
commitf528475d92524328ef3e12dfec036461395338c0 (patch)
treefde1820cfa95bbb1227b83157e0a6cb745589d10 /src/test/compressor/test_compression.cc
parentcommon,rbd,rgw,osd: extract config values into ConfigValues (diff)
downloadceph-f528475d92524328ef3e12dfec036461395338c0.tar.xz
ceph-f528475d92524328ef3e12dfec036461395338c0.zip
common: move ConfigValues out of md_config_t
by moving ConfigValues out of md_config_t, we are able to point md_config_t to a new ConfigValues instance at runtime, without destroying the old one. also remove ConfigReader, because all md_config_obs_t will be updated with ConfigProxy now. as md_config_t is not able to offer the *data* anymore. Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/test/compressor/test_compression.cc')
-rw-r--r--src/test/compressor/test_compression.cc46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/test/compressor/test_compression.cc b/src/test/compressor/test_compression.cc
index e747205ff11..0bdc2f2601e 100644
--- a/src/test/compressor/test_compression.cc
+++ b/src/test/compressor/test_compression.cc
@@ -33,7 +33,7 @@ public:
CompressorTest() {
// note for later
- old_zlib_isal = g_conf->compressor_zlib_isal;
+ old_zlib_isal = g_conf()->compressor_zlib_isal;
plugin = GetParam();
size_t pos = plugin.find('/');
@@ -41,11 +41,11 @@ public:
string isal = plugin.substr(pos + 1);
plugin = plugin.substr(0, pos);
if (isal == "isal") {
- g_conf->set_val("compressor_zlib_isal", "true");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "true");
+ g_ceph_context->_conf.apply_changes(nullptr);
} else if (isal == "noisal") {
- g_conf->set_val("compressor_zlib_isal", "false");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "false");
+ g_ceph_context->_conf.apply_changes(nullptr);
} else {
assert(0 == "bad option");
}
@@ -53,8 +53,8 @@ public:
cout << "[plugin " << plugin << " (" << GetParam() << ")]" << std::endl;
}
~CompressorTest() override {
- g_conf->set_val("compressor_zlib_isal", old_zlib_isal ? "true" : "false");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", old_zlib_isal ? "true" : "false");
+ g_ceph_context->_conf.apply_changes(nullptr);
}
void SetUp() override {
@@ -343,15 +343,15 @@ INSTANTIATE_TEST_CASE_P(
TEST(ZlibCompressor, zlib_isal_compatibility)
{
- g_conf->set_val("compressor_zlib_isal", "true");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "true");
+ g_ceph_context->_conf.apply_changes(nullptr);
CompressorRef isal = Compressor::create(g_ceph_context, "zlib");
if (!isal) {
// skip the test if the plugin is not ready
return;
}
- g_conf->set_val("compressor_zlib_isal", "false");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "false");
+ g_ceph_context->_conf.apply_changes(nullptr);
CompressorRef zlib = Compressor::create(g_ceph_context, "zlib");
char test[101];
srand(time(0));
@@ -407,15 +407,15 @@ TEST(CompressionPlugin, all)
TEST(ZlibCompressor, isal_compress_zlib_decompress_random)
{
- g_conf->set_val("compressor_zlib_isal", "true");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "true");
+ g_ceph_context->_conf.apply_changes(nullptr);
CompressorRef isal = Compressor::create(g_ceph_context, "zlib");
if (!isal) {
// skip the test if the plugin is not ready
return;
}
- g_conf->set_val("compressor_zlib_isal", "false");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "false");
+ g_ceph_context->_conf.apply_changes(nullptr);
CompressorRef zlib = Compressor::create(g_ceph_context, "zlib");
for (int cnt=0; cnt<100; cnt++)
@@ -443,15 +443,15 @@ TEST(ZlibCompressor, isal_compress_zlib_decompress_random)
TEST(ZlibCompressor, isal_compress_zlib_decompress_walk)
{
- g_conf->set_val("compressor_zlib_isal", "true");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "true");
+ g_ceph_context->_conf.apply_changes(nullptr);
CompressorRef isal = Compressor::create(g_ceph_context, "zlib");
if (!isal) {
// skip the test if the plugin is not ready
return;
}
- g_conf->set_val("compressor_zlib_isal", "false");
- g_ceph_context->_conf->apply_changes(NULL);
+ g_conf().set_val("compressor_zlib_isal", "false");
+ g_ceph_context->_conf.apply_changes(nullptr);
CompressorRef zlib = Compressor::create(g_ceph_context, "zlib");
for (int cnt=0; cnt<100; cnt++)
@@ -490,9 +490,9 @@ TEST(QAT, enc_qat_dec_noqat) {
const char* alg_collection[] = {"zlib", "snappy"};
#endif
for (auto alg : alg_collection) {
- g_conf->set_val("qat_compressor_enabled", "true");
+ g_conf().set_val("qat_compressor_enabled", "true");
CompressorRef q = Compressor::create(g_ceph_context, alg);
- g_conf->set_val("qat_compressor_enabled", "false");
+ g_conf().set_val("qat_compressor_enabled", "false");
CompressorRef noq = Compressor::create(g_ceph_context, alg);
// generate random buffer
@@ -526,9 +526,9 @@ TEST(QAT, enc_noqat_dec_qat) {
const char* alg_collection[] = {"zlib", "snappy"};
#endif
for (auto alg : alg_collection) {
- g_conf->set_val("qat_compressor_enabled", "true");
+ g_conf().set_val("qat_compressor_enabled", "true");
CompressorRef q = Compressor::create(g_ceph_context, alg);
- g_conf->set_val("qat_compressor_enabled", "false");
+ g_conf().set_val("qat_compressor_enabled", "false");
CompressorRef noq = Compressor::create(g_ceph_context, alg);
// generate random buffer