Skip to content

Commit

Permalink
upgrade gtest 1.7.0 => 1.8.1 for json result writing
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebook#5332

Differential Revision: D17242232

fbshipit-source-id: c0d4646556a1335e51ac7382b986ca7f6ced7b64
  • Loading branch information
dothebart authored and facebook-github-bot committed Sep 9, 2019
1 parent adbc25a commit fbab991
Show file tree
Hide file tree
Showing 29 changed files with 5,166 additions and 2,608 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ endif()

include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.8.1/fused-src)
if(WITH_FOLLY_DISTRIBUTED_MUTEX)
include_directories(${PROJECT_SOURCE_DIR}/third-party/folly)
endif()
Expand Down Expand Up @@ -879,7 +879,7 @@ endif()

option(WITH_TESTS "build with tests" ON)
if(WITH_TESTS)
add_subdirectory(third-party/gtest-1.7.0/fused-src/gtest)
add_subdirectory(third-party/gtest-1.8.1/fused-src/gtest)
set(TESTS
cache/cache_test.cc
cache/lru_cache_test.cc
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ endif

export GTEST_THROW_ON_FAILURE=1
export GTEST_HAS_EXCEPTIONS=1
GTEST_DIR = ./third-party/gtest-1.7.0/fused-src
GTEST_DIR = ./third-party/gtest-1.8.1/fused-src
# AIX: pre-defined system headers are surrounded by an extern "C" block
ifeq ($(PLATFORM), OS_AIX)
PLATFORM_CCFLAGS += -I$(GTEST_DIR)
Expand Down
4 changes: 2 additions & 2 deletions db/compaction/compaction_picker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ TEST_F(CompactionPickerTest, IntraL0MaxCompactionBytesNotHit) {
ASSERT_EQ(5U, compaction->num_input_files(0));
ASSERT_EQ(CompactionReason::kLevelL0FilesNum,
compaction->compaction_reason());
ASSERT_EQ(0U, compaction->output_level());
ASSERT_EQ(0, compaction->output_level());
}

TEST_F(CompactionPickerTest, IntraL0MaxCompactionBytesHit) {
Expand Down Expand Up @@ -1534,7 +1534,7 @@ TEST_F(CompactionPickerTest, IntraL0MaxCompactionBytesHit) {
ASSERT_EQ(4U, compaction->num_input_files(0));
ASSERT_EQ(CompactionReason::kLevelL0FilesNum,
compaction->compaction_reason());
ASSERT_EQ(0U, compaction->output_level());
ASSERT_EQ(0, compaction->output_level());
}

} // namespace rocksdb
Expand Down
16 changes: 8 additions & 8 deletions db/db_block_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,11 @@ TEST_F(DBBlockCacheTest, IndexAndFilterBlocksCachePriority) {
TestGetTickerCount(options, BLOCK_CACHE_ADD));
ASSERT_EQ(0, TestGetTickerCount(options, BLOCK_CACHE_DATA_MISS));
if (priority == Cache::Priority::LOW) {
ASSERT_EQ(0, MockCache::high_pri_insert_count);
ASSERT_EQ(2, MockCache::low_pri_insert_count);
ASSERT_EQ(0u, MockCache::high_pri_insert_count);
ASSERT_EQ(2u, MockCache::low_pri_insert_count);
} else {
ASSERT_EQ(2, MockCache::high_pri_insert_count);
ASSERT_EQ(0, MockCache::low_pri_insert_count);
ASSERT_EQ(2u, MockCache::high_pri_insert_count);
ASSERT_EQ(0u, MockCache::low_pri_insert_count);
}

// Access data block.
Expand All @@ -502,11 +502,11 @@ TEST_F(DBBlockCacheTest, IndexAndFilterBlocksCachePriority) {

// Data block should be inserted with low priority.
if (priority == Cache::Priority::LOW) {
ASSERT_EQ(0, MockCache::high_pri_insert_count);
ASSERT_EQ(3, MockCache::low_pri_insert_count);
ASSERT_EQ(0u, MockCache::high_pri_insert_count);
ASSERT_EQ(3u, MockCache::low_pri_insert_count);
} else {
ASSERT_EQ(2, MockCache::high_pri_insert_count);
ASSERT_EQ(1, MockCache::low_pri_insert_count);
ASSERT_EQ(2u, MockCache::high_pri_insert_count);
ASSERT_EQ(1u, MockCache::low_pri_insert_count);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion db/db_compaction_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ TEST_F(DBTestCompactionFilter, CompactionFilterIgnoreSnapshot) {
cfilter_count = 0;
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
// The filter should delete 40 records.
ASSERT_EQ(40U, cfilter_count);
ASSERT_EQ(40, cfilter_count);

{
// Scan the entire database as of the snapshot to ensure
Expand Down
20 changes: 10 additions & 10 deletions db/db_compaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ TEST_F(DBCompactionTest, BGCompactionsAllowed) {

// Now all column families qualify compaction but only one should be
// scheduled, because no column family hits speed up condition.
ASSERT_EQ(1, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(1u, env_->GetThreadPoolQueueLen(Env::Priority::LOW));

// Create two more files for one column family, which triggers speed up
// condition, three compactions will be scheduled.
Expand All @@ -746,7 +746,7 @@ TEST_F(DBCompactionTest, BGCompactionsAllowed) {
ASSERT_EQ(options.level0_file_num_compaction_trigger + num + 1,
NumTableFilesAtLevel(0, 2));
}
ASSERT_EQ(3, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(3U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));

// Unblock all threads to unblock all compactions.
for (size_t i = 0; i < kTotalTasks; i++) {
Expand Down Expand Up @@ -777,7 +777,7 @@ TEST_F(DBCompactionTest, BGCompactionsAllowed) {

// Now all column families qualify compaction but only one should be
// scheduled, because no column family hits speed up condition.
ASSERT_EQ(1, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
ASSERT_EQ(1U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));

for (size_t i = 0; i < kTotalTasks; i++) {
sleeping_tasks[i].WakeUp();
Expand Down Expand Up @@ -4165,7 +4165,7 @@ TEST_F(DBCompactionTest, CompactionLimiter) {

const char* cf_names[] = {"default", "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
const int cf_count = sizeof cf_names / sizeof cf_names[0];
const unsigned int cf_count = sizeof cf_names / sizeof cf_names[0];

std::unordered_map<std::string, CompactionLimiter*> cf_to_limiter;

Expand All @@ -4184,7 +4184,7 @@ TEST_F(DBCompactionTest, CompactionLimiter) {
std::vector<Options> option_vector;
option_vector.reserve(cf_count);

for (int cf = 0; cf < cf_count; cf++) {
for (unsigned int cf = 0; cf < cf_count; cf++) {
ColumnFamilyOptions cf_opt(options);
if (cf == 0) {
// "Default" CF does't use compaction limiter
Expand All @@ -4202,7 +4202,7 @@ TEST_F(DBCompactionTest, CompactionLimiter) {
option_vector.emplace_back(DBOptions(options), cf_opt);
}

for (int cf = 1; cf < cf_count; cf++) {
for (unsigned int cf = 1; cf < cf_count; cf++) {
CreateColumnFamilies({cf_names[cf]}, option_vector[cf]);
}

Expand Down Expand Up @@ -4254,21 +4254,21 @@ TEST_F(DBCompactionTest, CompactionLimiter) {
int keyIndex = 0;

for (int n = 0; n < options.level0_file_num_compaction_trigger; n++) {
for (int cf = 0; cf < cf_count; cf++) {
for (unsigned int cf = 0; cf < cf_count; cf++) {
for (int i = 0; i < kNumKeysPerFile; i++) {
ASSERT_OK(Put(cf, Key(keyIndex++), ""));
}
// put extra key to trigger flush
ASSERT_OK(Put(cf, "", ""));
}

for (int cf = 0; cf < cf_count; cf++) {
for (unsigned int cf = 0; cf < cf_count; cf++) {
dbfull()->TEST_WaitForFlushMemTable(handles_[cf]);
}
}

// Enough L0 files to trigger compaction
for (int cf = 0; cf < cf_count; cf++) {
for (unsigned int cf = 0; cf < cf_count; cf++) {
ASSERT_EQ(NumTableFilesAtLevel(0, cf),
options.level0_file_num_compaction_trigger);
}
Expand All @@ -4295,7 +4295,7 @@ TEST_F(DBCompactionTest, CompactionLimiter) {
sleeping_compact_tasks[i].WaitUntilDone();
}

for (int cf = 0; cf < cf_count; cf++) {
for (unsigned int cf = 0; cf < cf_count; cf++) {
dbfull()->TEST_WaitForFlushMemTable(handles_[cf]);
}

Expand Down
2 changes: 1 addition & 1 deletion db/db_memtable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ TEST_F(DBMemTableTest, ColumnFamilyId) {
DestroyAndReopen(options);
CreateAndReopenWithCF({"pikachu"}, options);

for (int cf = 0; cf < 2; ++cf) {
for (uint32_t cf = 0; cf < 2; ++cf) {
ASSERT_OK(Put(cf, "key", "val"));
ASSERT_OK(Flush(cf));
ASSERT_EQ(
Expand Down
10 changes: 5 additions & 5 deletions db/db_options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,10 @@ TEST_F(DBOptionsTest, SetStatsDumpPeriodSec) {
options.stats_dump_period_sec = 5;
options.env = env_;
Reopen(options);
ASSERT_EQ(5, dbfull()->GetDBOptions().stats_dump_period_sec);
ASSERT_EQ(5u, dbfull()->GetDBOptions().stats_dump_period_sec);

for (int i = 0; i < 20; i++) {
int num = rand() % 5000 + 1;
unsigned int num = rand() % 5000 + 1;
ASSERT_OK(
dbfull()->SetDBOptions({{"stats_dump_period_sec", ToString(num)}}));
ASSERT_EQ(num, dbfull()->GetDBOptions().stats_dump_period_sec);
Expand All @@ -522,12 +522,12 @@ TEST_F(DBOptionsTest, SetOptionsStatsPersistPeriodSec) {
options.stats_persist_period_sec = 5;
options.env = env_;
Reopen(options);
ASSERT_EQ(5, dbfull()->GetDBOptions().stats_persist_period_sec);
ASSERT_EQ(5u, dbfull()->GetDBOptions().stats_persist_period_sec);

ASSERT_OK(dbfull()->SetDBOptions({{"stats_persist_period_sec", "12345"}}));
ASSERT_EQ(12345, dbfull()->GetDBOptions().stats_persist_period_sec);
ASSERT_EQ(12345u, dbfull()->GetDBOptions().stats_persist_period_sec);
ASSERT_NOK(dbfull()->SetDBOptions({{"stats_persist_period_sec", "abcde"}}));
ASSERT_EQ(12345, dbfull()->GetDBOptions().stats_persist_period_sec);
ASSERT_EQ(12345u, dbfull()->GetDBOptions().stats_persist_period_sec);
}

static void assert_candidate_files_empty(DBImpl* dbfull, const bool empty) {
Expand Down
2 changes: 1 addition & 1 deletion db/db_table_properties_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ TEST_F(DBTablePropertiesTest, GetColumnFamilyNameProperty) {

// Create one table per CF, then verify it was created with the column family
// name property.
for (int cf = 0; cf < 2; ++cf) {
for (uint32_t cf = 0; cf < 2; ++cf) {
Put(cf, "key", "val");
Flush(cf);

Expand Down
18 changes: 9 additions & 9 deletions db/db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4790,15 +4790,15 @@ TEST_F(DBTest, DynamicUniversalCompactionOptions) {
DestroyAndReopen(options);

// Initial defaults
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.size_ratio, 1);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.size_ratio, 1U);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.min_merge_width,
2);
2u);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.max_merge_width,
UINT_MAX);
ASSERT_EQ(dbfull()
->GetOptions()
.compaction_options_universal.max_size_amplification_percent,
200);
200u);
ASSERT_EQ(dbfull()
->GetOptions()
.compaction_options_universal.compression_size_percent,
Expand All @@ -4811,15 +4811,15 @@ TEST_F(DBTest, DynamicUniversalCompactionOptions) {

ASSERT_OK(dbfull()->SetOptions(
{{"compaction_options_universal", "{size_ratio=7;}"}}));
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.size_ratio, 7);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.size_ratio, 7u);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.min_merge_width,
2);
2u);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.max_merge_width,
UINT_MAX);
ASSERT_EQ(dbfull()
->GetOptions()
.compaction_options_universal.max_size_amplification_percent,
200);
200u);
ASSERT_EQ(dbfull()
->GetOptions()
.compaction_options_universal.compression_size_percent,
Expand All @@ -4832,15 +4832,15 @@ TEST_F(DBTest, DynamicUniversalCompactionOptions) {

ASSERT_OK(dbfull()->SetOptions(
{{"compaction_options_universal", "{min_merge_width=11;}"}}));
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.size_ratio, 7);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.size_ratio, 7u);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.min_merge_width,
11);
11u);
ASSERT_EQ(dbfull()->GetOptions().compaction_options_universal.max_merge_width,
UINT_MAX);
ASSERT_EQ(dbfull()
->GetOptions()
.compaction_options_universal.max_size_amplification_percent,
200);
200u);
ASSERT_EQ(dbfull()
->GetOptions()
.compaction_options_universal.compression_size_percent,
Expand Down
18 changes: 9 additions & 9 deletions db/db_universal_compaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -441,17 +441,17 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionSizeAmplification) {
ASSERT_EQ(dbfull()
->GetOptions(handles_[1])
.compaction_options_universal.max_size_amplification_percent,
200);
200U);
ASSERT_OK(dbfull()->SetOptions(handles_[1],
{{"compaction_options_universal",
"{max_size_amplification_percent=110;}"}}));
ASSERT_EQ(dbfull()
->GetOptions(handles_[1])
.compaction_options_universal.max_size_amplification_percent,
110);
110u);
ASSERT_OK(dbfull()->TEST_GetLatestMutableCFOptions(handles_[1],
&mutable_cf_options));
ASSERT_EQ(110, mutable_cf_options.compaction_options_universal
ASSERT_EQ(110u, mutable_cf_options.compaction_options_universal
.max_size_amplification_percent);

dbfull()->TEST_WaitForCompact();
Expand Down Expand Up @@ -522,20 +522,20 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionReadAmplification) {
ASSERT_EQ(dbfull()
->GetOptions(handles_[1])
.compaction_options_universal.min_merge_width,
2);
2u);
ASSERT_EQ(dbfull()
->GetOptions(handles_[1])
.compaction_options_universal.max_merge_width,
2);
2u);
ASSERT_EQ(
dbfull()->GetOptions(handles_[1]).compaction_options_universal.size_ratio,
100);
100u);

ASSERT_OK(dbfull()->TEST_GetLatestMutableCFOptions(handles_[1],
&mutable_cf_options));
ASSERT_EQ(mutable_cf_options.compaction_options_universal.size_ratio, 100);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.min_merge_width, 2);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.max_merge_width, 2);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.size_ratio, 100u);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.min_merge_width, 2u);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.max_merge_width, 2u);

dbfull()->TEST_WaitForCompact();

Expand Down
10 changes: 5 additions & 5 deletions db/version_edit_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ TEST_F(VersionEditTest, EncodeDecodeNewFile4) {
ASSERT_TRUE(new_files[0].second.marked_for_compaction);
ASSERT_TRUE(!new_files[1].second.marked_for_compaction);
ASSERT_TRUE(new_files[2].second.marked_for_compaction);
ASSERT_EQ(3, new_files[0].second.fd.GetPathId());
ASSERT_EQ(3, new_files[1].second.fd.GetPathId());
ASSERT_EQ(0, new_files[2].second.fd.GetPathId());
ASSERT_EQ(3u, new_files[0].second.fd.GetPathId());
ASSERT_EQ(3u, new_files[1].second.fd.GetPathId());
ASSERT_EQ(0u, new_files[2].second.fd.GetPathId());
}

TEST_F(VersionEditTest, ForwardCompatibleNewFile4) {
Expand Down Expand Up @@ -127,8 +127,8 @@ TEST_F(VersionEditTest, ForwardCompatibleNewFile4) {
auto& new_files = parsed.GetNewFiles();
ASSERT_TRUE(new_files[0].second.marked_for_compaction);
ASSERT_TRUE(!new_files[1].second.marked_for_compaction);
ASSERT_EQ(3, new_files[0].second.fd.GetPathId());
ASSERT_EQ(3, new_files[1].second.fd.GetPathId());
ASSERT_EQ(3u, new_files[0].second.fd.GetPathId());
ASSERT_EQ(3u, new_files[1].second.fd.GetPathId());
ASSERT_EQ(1u, parsed.GetDeletedFiles().size());
}

Expand Down
2 changes: 1 addition & 1 deletion db/version_set_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ TEST_F(VersionSetTest, SameColumnFamilyGroupCommit) {
SyncPoint::GetInstance()->SetCallBack(
"VersionSet::ProcessManifestWrites:SameColumnFamily", [&](void* arg) {
uint32_t* cf_id = reinterpret_cast<uint32_t*>(arg);
EXPECT_EQ(0, *cf_id);
EXPECT_EQ(0u, *cf_id);
++count;
});
SyncPoint::GetInstance()->EnableProcessing();
Expand Down
10 changes: 5 additions & 5 deletions db/write_batch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void WriteBatch::Clear() {
wal_term_point_.clear();
}

int WriteBatch::Count() const {
uint32_t WriteBatch::Count() const {
return WriteBatchInternal::Count(this);
}

Expand Down Expand Up @@ -538,7 +538,7 @@ Status WriteBatchInternal::Iterate(const WriteBatch* wb,
// batches. We do that by checking whether the accumulated batch is empty
// before seeing the next Noop.
bool empty_batch = true;
int found = 0;
uint32_t found = 0;
Status s;
char tag = 0;
uint32_t column_family = 0; // default
Expand Down Expand Up @@ -733,11 +733,11 @@ void WriteBatchInternal::SetAsLastestPersistentState(WriteBatch* b) {
b->is_latest_persistent_state_ = true;
}

int WriteBatchInternal::Count(const WriteBatch* b) {
uint32_t WriteBatchInternal::Count(const WriteBatch* b) {
return DecodeFixed32(b->rep_.data() + 8);
}

void WriteBatchInternal::SetCount(WriteBatch* b, int n) {
void WriteBatchInternal::SetCount(WriteBatch* b, uint32_t n) {
EncodeFixed32(&b->rep_[8], n);
}

Expand Down Expand Up @@ -1149,7 +1149,7 @@ Status WriteBatch::RollbackToSavePoint() {
save_points_->stack.pop();

assert(savepoint.size <= rep_.size());
assert(savepoint.count <= Count());
assert(static_cast<uint32_t>(savepoint.count) <= Count());

if (savepoint.size == rep_.size()) {
// No changes to rollback
Expand Down
Loading

0 comments on commit fbab991

Please sign in to comment.