From 2b07695f1c2999e14dcf6313713959bb108af05d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 11 Mar 2016 17:34:19 -0500 Subject: [PATCH] unittest_compression_zlib: do not assume buffer will be null terminated Signed-off-by: Sage Weil --- src/test/compressor/test_compression_zlib.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/compressor/test_compression_zlib.cc b/src/test/compressor/test_compression_zlib.cc index d6f6985c0f1..70df87f7491 100644 --- a/src/test/compressor/test_compression_zlib.cc +++ b/src/test/compressor/test_compression_zlib.cc @@ -36,7 +36,9 @@ TEST(CompressionZlib, compress_decompress) bufferlist after; res = sp.decompress(out, after); EXPECT_EQ(res, 0); - EXPECT_STREQ(test, after.c_str()); + bufferlist exp; + exp.append(test); + EXPECT_TRUE(exp.contents_equal(after)); } TEST(CompressionZlib, compress_decompress_chunk) @@ -54,7 +56,9 @@ TEST(CompressionZlib, compress_decompress_chunk) bufferlist after; res = sp.decompress(out, after); EXPECT_EQ(res, 0); - EXPECT_STREQ("This is test text1234567890", after.c_str()); + bufferlist exp; + exp.append("This is test text1234567890"); + EXPECT_TRUE(exp.contents_equal(after)); } int main(int argc, char **argv) {