From b71ca04489f73beef688d79dac9fa9e96559ca58 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 3 May 2017 16:21:52 +0800 Subject: [PATCH] test/compressor: disable isal tests if not available the isal-zlib compressor plugin is not supported on non-intel archs, and if the user does not have a capable yasm compiler, neither will he/she get this plugin. Signed-off-by: Kefu Chai --- src/test/compressor/test_compression.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/compressor/test_compression.cc b/src/test/compressor/test_compression.cc index 11678e024e860..495af07669943 100644 --- a/src/test/compressor/test_compression.cc +++ b/src/test/compressor/test_compression.cc @@ -322,16 +322,24 @@ INSTANTIATE_TEST_CASE_P( Compressor, CompressorTest, ::testing::Values( +#ifdef __x86_64__ "zlib/isal", +#endif "zlib/noisal", "snappy", "zstd")); +#ifdef __x86_64__ + TEST(ZlibCompressor, zlib_isal_compatibility) { g_conf->set_val("compressor_zlib_isal", "true"); g_ceph_context->_conf->apply_changes(NULL); 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); CompressorRef zlib = Compressor::create(g_ceph_context, "zlib"); @@ -363,6 +371,7 @@ TEST(ZlibCompressor, zlib_isal_compatibility) exp.append(test); EXPECT_TRUE(exp.contents_equal(after)); } +#endif TEST(CompressionPlugin, all) { @@ -386,11 +395,17 @@ TEST(CompressionPlugin, all) } } +#ifdef __x86_64__ + TEST(ZlibCompressor, isal_compress_zlib_decompress_random) { g_conf->set_val("compressor_zlib_isal", "true"); g_ceph_context->_conf->apply_changes(NULL); 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); CompressorRef zlib = Compressor::create(g_ceph_context, "zlib"); @@ -423,6 +438,10 @@ TEST(ZlibCompressor, isal_compress_zlib_decompress_walk) g_conf->set_val("compressor_zlib_isal", "true"); g_ceph_context->_conf->apply_changes(NULL); 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); CompressorRef zlib = Compressor::create(g_ceph_context, "zlib"); @@ -452,3 +471,5 @@ TEST(ZlibCompressor, isal_compress_zlib_decompress_walk) EXPECT_TRUE(exp.contents_equal(after)); } } + +#endif // __x86_64__ -- 2.39.5