From de278a6de9dfbe8b126da7ef5401b3a41ee225b4 Mon Sep 17 00:00:00 2001 From: amayank Date: Fri, 16 Nov 2012 12:55:21 -0800 Subject: [PATCH] Fix a coding error in db_test.cc Summary: The new function MinLevelToCompress in db_test.cc was incomplete. It needs to tell the calling function-TEST whether the test has to be skipped or not Test Plan: make all;./db_test Reviewers: dhruba, heyongqiang Reviewed By: dhruba CC: sheki Differential Revision: https://reviews.facebook.net/D6771 --- db/db_test.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/db/db_test.cc b/db/db_test.cc index 88557f6df..514fd0d5f 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -1104,7 +1104,8 @@ void MinLevelHelper(DBTest* self, Options& options) { ASSERT_EQ(self->NumTableFilesAtLevel(1), 1); } -void MinLevelToCompress(CompressionType& type, Options& options, int wbits, +// returns false if the calling-Test should be skipped +bool MinLevelToCompress(CompressionType& type, Options& options, int wbits, int lev, int strategy) { fprintf(stderr, "Test with compression options : window_bits = %d, level = %d, strategy = %d}\n", wbits, lev, strategy); options.write_buffer_size = 100<<10; //100KB @@ -1126,7 +1127,7 @@ void MinLevelToCompress(CompressionType& type, Options& options, int wbits, fprintf(stderr, "using bzip2\n"); } else { fprintf(stderr, "skipping test, compression disabled\n"); - return; + return false; } options.compression_per_level = new CompressionType[options.num_levels]; @@ -1137,11 +1138,14 @@ void MinLevelToCompress(CompressionType& type, Options& options, int wbits, for (int i = 1; i < options.num_levels; i++) { options.compression_per_level[i] = type; } + return true; } TEST(DBTest, MinLevelToCompress1) { Options options = CurrentOptions(); CompressionType type; - MinLevelToCompress(type, options, -14, -1, 0); + if (!MinLevelToCompress(type, options, -14, -1, 0)) { + return; + } Reopen(&options); MinLevelHelper(this, options); @@ -1159,7 +1163,9 @@ TEST(DBTest, MinLevelToCompress1) { TEST(DBTest, MinLevelToCompress2) { Options options = CurrentOptions(); CompressionType type; - MinLevelToCompress(type, options, 15, -1, 0); + if (!MinLevelToCompress(type, options, 15, -1, 0)) { + return; + } Reopen(&options); MinLevelHelper(this, options); -- GitLab