Merge pull request #99 from caiosba/master
Make it compile on Debian/GCC 4.7
This commit is contained in:
commit
30447b7251
@ -451,7 +451,7 @@ TEST(LogTest, TruncatedTrailingRecordIsIgnored) {
|
|||||||
ShrinkSize(4); // Drop all payload as well as a header byte
|
ShrinkSize(4); // Drop all payload as well as a header byte
|
||||||
ASSERT_EQ("EOF", Read());
|
ASSERT_EQ("EOF", Read());
|
||||||
// Truncated last record is ignored, not treated as an error
|
// Truncated last record is ignored, not treated as an error
|
||||||
ASSERT_EQ(0, DroppedBytes());
|
ASSERT_EQ(0U, DroppedBytes());
|
||||||
ASSERT_EQ("", ReportMessage());
|
ASSERT_EQ("", ReportMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ TEST(LogTest, BadLengthAtEndIsIgnored) {
|
|||||||
Write("foo");
|
Write("foo");
|
||||||
ShrinkSize(1);
|
ShrinkSize(1);
|
||||||
ASSERT_EQ("EOF", Read());
|
ASSERT_EQ("EOF", Read());
|
||||||
ASSERT_EQ(0, DroppedBytes());
|
ASSERT_EQ(0U, DroppedBytes());
|
||||||
ASSERT_EQ("", ReportMessage());
|
ASSERT_EQ("", ReportMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ TEST(LogTest, MissingLastIsIgnored) {
|
|||||||
ShrinkSize(14);
|
ShrinkSize(14);
|
||||||
ASSERT_EQ("EOF", Read());
|
ASSERT_EQ("EOF", Read());
|
||||||
ASSERT_EQ("", ReportMessage());
|
ASSERT_EQ("", ReportMessage());
|
||||||
ASSERT_EQ(0, DroppedBytes());
|
ASSERT_EQ(0U, DroppedBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LogTest, PartialLastIsIgnored) {
|
TEST(LogTest, PartialLastIsIgnored) {
|
||||||
@ -537,7 +537,7 @@ TEST(LogTest, PartialLastIsIgnored) {
|
|||||||
ShrinkSize(1);
|
ShrinkSize(1);
|
||||||
ASSERT_EQ("EOF", Read());
|
ASSERT_EQ("EOF", Read());
|
||||||
ASSERT_EQ("", ReportMessage());
|
ASSERT_EQ("", ReportMessage());
|
||||||
ASSERT_EQ(0, DroppedBytes());
|
ASSERT_EQ(0U, DroppedBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LogTest, ErrorJoinsRecords) {
|
TEST(LogTest, ErrorJoinsRecords) {
|
||||||
|
@ -172,8 +172,8 @@ TEST(EnvPosixTest, TwoPools) {
|
|||||||
env_->SetBackgroundThreads(kLowPoolSize);
|
env_->SetBackgroundThreads(kLowPoolSize);
|
||||||
env_->SetBackgroundThreads(kHighPoolSize, Env::Priority::HIGH);
|
env_->SetBackgroundThreads(kHighPoolSize, Env::Priority::HIGH);
|
||||||
|
|
||||||
ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
||||||
ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
||||||
|
|
||||||
// schedule same number of jobs in each pool
|
// schedule same number of jobs in each pool
|
||||||
for (int i = 0; i < kJobs; i++) {
|
for (int i = 0; i < kJobs; i++) {
|
||||||
@ -182,10 +182,11 @@ TEST(EnvPosixTest, TwoPools) {
|
|||||||
}
|
}
|
||||||
// Wait a short while for the jobs to be dispatched.
|
// Wait a short while for the jobs to be dispatched.
|
||||||
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
Env::Default()->SleepForMicroseconds(kDelayMicros);
|
||||||
ASSERT_EQ(kJobs - kLowPoolSize, env_->GetThreadPoolQueueLen());
|
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize),
|
||||||
ASSERT_EQ(kJobs - kLowPoolSize,
|
env_->GetThreadPoolQueueLen());
|
||||||
|
ASSERT_EQ((unsigned int)(kJobs - kLowPoolSize),
|
||||||
env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
||||||
ASSERT_EQ(kJobs - kHighPoolSize,
|
ASSERT_EQ((unsigned int)(kJobs - kHighPoolSize),
|
||||||
env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
||||||
|
|
||||||
// wait for all jobs to finish
|
// wait for all jobs to finish
|
||||||
@ -194,8 +195,8 @@ TEST(EnvPosixTest, TwoPools) {
|
|||||||
env_->SleepForMicroseconds(kDelayMicros);
|
env_->SleepForMicroseconds(kDelayMicros);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::LOW));
|
||||||
ASSERT_EQ(0, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
ASSERT_EQ(0U, env_->GetThreadPoolQueueLen(Env::Priority::HIGH));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSingleVarint(const std::string& s) {
|
bool IsSingleVarint(const std::string& s) {
|
||||||
@ -296,18 +297,18 @@ TEST(EnvPosixTest, AllocateTest) {
|
|||||||
|
|
||||||
struct stat f_stat;
|
struct stat f_stat;
|
||||||
stat(fname.c_str(), &f_stat);
|
stat(fname.c_str(), &f_stat);
|
||||||
ASSERT_EQ(data.size(), f_stat.st_size);
|
ASSERT_EQ((unsigned int)data.size(), f_stat.st_size);
|
||||||
// verify that blocks are preallocated
|
// verify that blocks are preallocated
|
||||||
ASSERT_EQ(kPreallocateSize / kBlockSize, f_stat.st_blocks);
|
ASSERT_EQ((unsigned int)(kPreallocateSize / kBlockSize), f_stat.st_blocks);
|
||||||
|
|
||||||
// close the file, should deallocate the blocks
|
// close the file, should deallocate the blocks
|
||||||
wfile.reset();
|
wfile.reset();
|
||||||
|
|
||||||
stat(fname.c_str(), &f_stat);
|
stat(fname.c_str(), &f_stat);
|
||||||
ASSERT_EQ(data.size(), f_stat.st_size);
|
ASSERT_EQ((unsigned int)data.size(), f_stat.st_size);
|
||||||
// verify that preallocated blocks were deallocated on file close
|
// verify that preallocated blocks were deallocated on file close
|
||||||
size_t data_blocks_pages = ((data.size() + kPageSize - 1) / kPageSize);
|
size_t data_blocks_pages = ((data.size() + kPageSize - 1) / kPageSize);
|
||||||
ASSERT_EQ(data_blocks_pages * kPageSize / kBlockSize, f_stat.st_blocks);
|
ASSERT_EQ((unsigned int)(data_blocks_pages * kPageSize / kBlockSize), f_stat.st_blocks);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user