mirror of
https://github.com/facebook/rocksdb.git
synced 2026-10-23 08:09:02 +03:00
maint: use ASSERT_TRUE, not ASSERT_EQ(true; same for false
Summary:
The usage I'm fixing here caused trouble on Fedora 21 when
compiling with the current gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC):
db/write_controller_test.cc: In member function ‘virtual void rocksdb::WriteControllerTest_SanityTest_Test::TestBody()’:
db/write_controller_test.cc:23:165: error: converting ‘false’ to pointer type for argument 1 of ‘char testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Werror=conversion-null]
ASSERT_EQ(false, controller.IsStopped());
^
This change was induced mechanically via:
git grep -l -E 'ASSERT_EQ\(false'|xargs perl -pi -e 's/ASSERT_EQ\(false, /ASSERT_FALSE(/'
git grep -l -E 'ASSERT_EQ\(true'|xargs perl -pi -e 's/ASSERT_EQ\(true, /ASSERT_TRUE(/'
Except for the three in utilities/backupable/backupable_db_test.cc for which
I ended up reformatting (joining lines) in the result.
As for why this problem is exhibited with that version of gcc, and none
of the others I've used (from 4.8.1 through gcc-5.0.0 and newer), I suspect
it's a bug in F21's gcc that has been fixed in gcc-5.0.0.
Test Plan:
"make" now succeed on Fedora 21
Reviewers: ljin, rven, igor.sugak, yhchiang, sdong, igor
Reviewed By: igor
Subscribers: dhruba
Differential Revision: https://reviews.facebook.net/D37329
This commit is contained in:
@@ -16,11 +16,11 @@ TEST_F(WriteControllerTest, SanityTest) {
|
||||
auto stop_token_1 = controller.GetStopToken();
|
||||
auto stop_token_2 = controller.GetStopToken();
|
||||
|
||||
ASSERT_EQ(true, controller.IsStopped());
|
||||
ASSERT_TRUE(controller.IsStopped());
|
||||
stop_token_1.reset();
|
||||
ASSERT_EQ(true, controller.IsStopped());
|
||||
ASSERT_TRUE(controller.IsStopped());
|
||||
stop_token_2.reset();
|
||||
ASSERT_EQ(false, controller.IsStopped());
|
||||
ASSERT_FALSE(controller.IsStopped());
|
||||
|
||||
auto delay_token_1 = controller.GetDelayToken(5);
|
||||
ASSERT_EQ(static_cast<uint64_t>(5), controller.GetDelay());
|
||||
@@ -32,7 +32,7 @@ TEST_F(WriteControllerTest, SanityTest) {
|
||||
delay_token_1.reset();
|
||||
ASSERT_EQ(static_cast<uint64_t>(0), controller.GetDelay());
|
||||
delay_token_1.reset();
|
||||
ASSERT_EQ(false, controller.IsStopped());
|
||||
ASSERT_FALSE(controller.IsStopped());
|
||||
}
|
||||
|
||||
} // namespace rocksdb
|
||||
|
||||
@@ -539,13 +539,10 @@ TEST_F(BackupableDBTest, NoDoubleCopy) {
|
||||
test_backup_env_->AssertWrittenFiles(should_have_written);
|
||||
|
||||
ASSERT_OK(db_->DeleteBackup(1));
|
||||
ASSERT_EQ(true,
|
||||
test_backup_env_->FileExists(backupdir_ + "/shared/00010.sst"));
|
||||
ASSERT_TRUE(test_backup_env_->FileExists(backupdir_ + "/shared/00010.sst"));
|
||||
// 00011.sst was only in backup 1, should be deleted
|
||||
ASSERT_EQ(false,
|
||||
test_backup_env_->FileExists(backupdir_ + "/shared/00011.sst"));
|
||||
ASSERT_EQ(true,
|
||||
test_backup_env_->FileExists(backupdir_ + "/shared/00015.sst"));
|
||||
ASSERT_FALSE(test_backup_env_->FileExists(backupdir_ + "/shared/00011.sst"));
|
||||
ASSERT_TRUE(test_backup_env_->FileExists(backupdir_ + "/shared/00015.sst"));
|
||||
|
||||
// MANIFEST file size should be only 100
|
||||
uint64_t size;
|
||||
@@ -924,14 +921,14 @@ TEST_F(BackupableDBTest, DeleteTmpFiles) {
|
||||
file_manager_->WriteToFile(shared_tmp, "tmp");
|
||||
file_manager_->CreateDir(private_tmp_dir);
|
||||
file_manager_->WriteToFile(private_tmp_file, "tmp");
|
||||
ASSERT_EQ(true, file_manager_->FileExists(private_tmp_dir));
|
||||
ASSERT_TRUE(file_manager_->FileExists(private_tmp_dir));
|
||||
OpenBackupableDB();
|
||||
// Need to call this explicitly to delete tmp files
|
||||
(void) db_->GarbageCollect();
|
||||
CloseBackupableDB();
|
||||
ASSERT_EQ(false, file_manager_->FileExists(shared_tmp));
|
||||
ASSERT_EQ(false, file_manager_->FileExists(private_tmp_file));
|
||||
ASSERT_EQ(false, file_manager_->FileExists(private_tmp_dir));
|
||||
ASSERT_FALSE(file_manager_->FileExists(shared_tmp));
|
||||
ASSERT_FALSE(file_manager_->FileExists(private_tmp_file));
|
||||
ASSERT_FALSE(file_manager_->FileExists(private_tmp_dir));
|
||||
}
|
||||
|
||||
TEST_F(BackupableDBTest, KeepLogFiles) {
|
||||
|
||||
Reference in New Issue
Block a user