Skip to content

Commit

Permalink
Make table_test runnable in ROCKSDB_LITE
Browse files Browse the repository at this point in the history
Summary: Remove plain table tests from table_test since plain table is not supported in ROCKSDB_LITE

Test Plan: table_test

Reviewers: igor, sdong, yhchiang

Reviewed By: yhchiang

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D42153
  • Loading branch information
IslamAbdelRahman committed Jul 20, 2015
1 parent f0fe912 commit 4853e22
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions table/table_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ class DBConstructor: public Constructor {

enum TestType {
BLOCK_BASED_TABLE_TEST,
#ifndef ROCKSDB_LITE
PLAIN_TABLE_SEMI_FIXED_PREFIX,
PLAIN_TABLE_FULL_STR_PREFIX,
PLAIN_TABLE_TOTAL_ORDER,
#endif // !ROCKSDB_LITE
BLOCK_TEST,
MEMTABLE_TEST,
DB_TEST
Expand All @@ -563,10 +565,14 @@ struct TestArgs {
static std::vector<TestArgs> GenerateArgList() {
std::vector<TestArgs> test_args;
std::vector<TestType> test_types = {
BLOCK_BASED_TABLE_TEST, PLAIN_TABLE_SEMI_FIXED_PREFIX,
PLAIN_TABLE_FULL_STR_PREFIX, PLAIN_TABLE_TOTAL_ORDER,
BLOCK_TEST, MEMTABLE_TEST,
DB_TEST};
BLOCK_BASED_TABLE_TEST,
#ifndef ROCKSDB_LITE
PLAIN_TABLE_SEMI_FIXED_PREFIX,
PLAIN_TABLE_FULL_STR_PREFIX,
PLAIN_TABLE_TOTAL_ORDER,
#endif // !ROCKSDB_LITE
BLOCK_TEST,
MEMTABLE_TEST, DB_TEST};
std::vector<bool> reverse_compare_types = {false, true};
std::vector<int> restart_intervals = {16, 1, 1024};

Expand All @@ -593,6 +599,7 @@ static std::vector<TestArgs> GenerateArgList() {

for (auto test_type : test_types) {
for (auto reverse_compare : reverse_compare_types) {
#ifndef ROCKSDB_LITE
if (test_type == PLAIN_TABLE_SEMI_FIXED_PREFIX ||
test_type == PLAIN_TABLE_FULL_STR_PREFIX) {
// Plain table doesn't use restart index or compression.
Expand All @@ -604,6 +611,7 @@ static std::vector<TestArgs> GenerateArgList() {
test_args.push_back(one_arg);
continue;
}
#endif // !ROCKSDB_LITE

for (auto restart_interval : restart_intervals) {
for (auto compression_type : compression_types) {
Expand Down Expand Up @@ -685,6 +693,8 @@ class HarnessTest : public testing::Test {
new BlockBasedTableFactory(table_options_));
constructor_ = new TableConstructor(options_.comparator);
break;
// Plain table is not supported in ROCKSDB_LITE
#ifndef ROCKSDB_LITE
case PLAIN_TABLE_SEMI_FIXED_PREFIX:
support_prev_ = false;
only_support_prefix_seek_ = true;
Expand Down Expand Up @@ -724,6 +734,7 @@ class HarnessTest : public testing::Test {
internal_comparator_.reset(
new InternalKeyComparator(options_.comparator));
break;
#endif // !ROCKSDB_LITE
case BLOCK_TEST:
table_options_.block_size = 256;
options_.table_factory.reset(
Expand Down Expand Up @@ -1762,6 +1773,8 @@ TEST_F(BlockBasedTableTest, BlockCacheLeak) {
}
}

// Plain table is not supported in ROCKSDB_LITE
#ifndef ROCKSDB_LITE
TEST_F(PlainTableTest, BasicPlainTableProperties) {
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 8;
Expand Down Expand Up @@ -1810,6 +1823,7 @@ TEST_F(PlainTableTest, BasicPlainTableProperties) {
ASSERT_EQ(26ul, props->num_entries);
ASSERT_EQ(1ul, props->num_data_blocks);
}
#endif // !ROCKSDB_LITE

TEST_F(GeneralTableTest, ApproximateOffsetOfPlain) {
TableConstructor c(BytewiseComparator());
Expand Down Expand Up @@ -2068,6 +2082,8 @@ TEST_F(HarnessTest, FooterTests) {
ASSERT_EQ(decoded_footer.index_handle().size(), index.size());
ASSERT_EQ(decoded_footer.version(), 1U);
}
// Plain table is not supported in ROCKSDB_LITE
#ifndef ROCKSDB_LITE
{
// upconvert legacy plain table
std::string encoded;
Expand Down Expand Up @@ -2107,6 +2123,7 @@ TEST_F(HarnessTest, FooterTests) {
ASSERT_EQ(decoded_footer.index_handle().size(), index.size());
ASSERT_EQ(decoded_footer.version(), 1U);
}
#endif // !ROCKSDB_LITE
{
// version == 2
std::string encoded;
Expand Down

0 comments on commit 4853e22

Please sign in to comment.