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
This commit is contained in:
parent
f5cdf931a0
commit
de278a6de9
@ -1104,7 +1104,8 @@ void MinLevelHelper(DBTest* self, Options& options) {
|
|||||||
ASSERT_EQ(self->NumTableFilesAtLevel(1), 1);
|
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) {
|
int lev, int strategy) {
|
||||||
fprintf(stderr, "Test with compression options : window_bits = %d, level = %d, strategy = %d}\n", wbits, lev, 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
|
options.write_buffer_size = 100<<10; //100KB
|
||||||
@ -1126,7 +1127,7 @@ void MinLevelToCompress(CompressionType& type, Options& options, int wbits,
|
|||||||
fprintf(stderr, "using bzip2\n");
|
fprintf(stderr, "using bzip2\n");
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "skipping test, compression disabled\n");
|
fprintf(stderr, "skipping test, compression disabled\n");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
options.compression_per_level = new CompressionType[options.num_levels];
|
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++) {
|
for (int i = 1; i < options.num_levels; i++) {
|
||||||
options.compression_per_level[i] = type;
|
options.compression_per_level[i] = type;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
TEST(DBTest, MinLevelToCompress1) {
|
TEST(DBTest, MinLevelToCompress1) {
|
||||||
Options options = CurrentOptions();
|
Options options = CurrentOptions();
|
||||||
CompressionType type;
|
CompressionType type;
|
||||||
MinLevelToCompress(type, options, -14, -1, 0);
|
if (!MinLevelToCompress(type, options, -14, -1, 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Reopen(&options);
|
Reopen(&options);
|
||||||
MinLevelHelper(this, options);
|
MinLevelHelper(this, options);
|
||||||
|
|
||||||
@ -1159,7 +1163,9 @@ TEST(DBTest, MinLevelToCompress1) {
|
|||||||
TEST(DBTest, MinLevelToCompress2) {
|
TEST(DBTest, MinLevelToCompress2) {
|
||||||
Options options = CurrentOptions();
|
Options options = CurrentOptions();
|
||||||
CompressionType type;
|
CompressionType type;
|
||||||
MinLevelToCompress(type, options, 15, -1, 0);
|
if (!MinLevelToCompress(type, options, 15, -1, 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Reopen(&options);
|
Reopen(&options);
|
||||||
MinLevelHelper(this, options);
|
MinLevelHelper(this, options);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user