Travis build break fix

Summary:
Travis times out with persistent_cache_test, there is no way to increase the
timeout, so lower the test case for Travis

Test Plan: Run on travis and sandcastle

Subscribers: leveldb, dhruba, andrewkr

Differential Revision: https://reviews.facebook.net/D61863
This commit is contained in:
krad 2016-08-10 13:26:15 -07:00
parent b693ba68b5
commit 67c1ae8831
2 changed files with 38 additions and 15 deletions

View File

@ -116,6 +116,24 @@ PersistentCacheTierTest::PersistentCacheTierTest()
#endif #endif
} }
#ifdef TRAVIS
// Travis is unable to handle the normal version of the tests running out of
// fds, out of space and timeouts. This is an easier version of the test
// specifically written for Travis
TEST_F(PersistentCacheTierTest, BasicTest) {
cache_ = std::make_shared<VolatileCacheTier>();
RunInsertTest(/*nthreads=*/1, /*max_keys=*/1024);
cache_ = NewBlockCache(Env::Default(), path_,
/*size=*/std::numeric_limits<uint64_t>::max(),
/*direct_writes=*/true);
RunInsertTest(/*nthreads=*/1, /*max_keys=*/1024);
cache_ = NewTieredCache(Env::Default(), path_,
/*memory_size=*/static_cast<size_t>(1 * 1024 * 1024));
RunInsertTest(/*nthreads=*/1, /*max_keys=*/1024);
}
#else
// Volatile cache tests // Volatile cache tests
TEST_F(PersistentCacheTierTest, VolatileCacheInsert) { TEST_F(PersistentCacheTierTest, VolatileCacheInsert) {
for (auto nthreads : {1, 5}) { for (auto nthreads : {1, 5}) {
@ -152,9 +170,6 @@ TEST_F(PersistentCacheTierTest, BlockCacheInsert) {
} }
} }
#ifndef TRAVIS
// the tests causes a lot of file deletions which Travis limited testing
// environment cannot handle
TEST_F(PersistentCacheTierTest, BlockCacheInsertWithEviction) { TEST_F(PersistentCacheTierTest, BlockCacheInsertWithEviction) {
for (auto nthreads : {1, 5}) { for (auto nthreads : {1, 5}) {
for (auto max_keys : {1 * 1024 * 1024 * kStressFactor}) { for (auto max_keys : {1 * 1024 * 1024 * kStressFactor}) {
@ -164,7 +179,6 @@ TEST_F(PersistentCacheTierTest, BlockCacheInsertWithEviction) {
} }
} }
} }
#endif
// Tiered cache tests // Tiered cache tests
TEST_F(PersistentCacheTierTest, TieredCacheInsert) { TEST_F(PersistentCacheTierTest, TieredCacheInsert) {
@ -178,7 +192,6 @@ TEST_F(PersistentCacheTierTest, TieredCacheInsert) {
} }
} }
#ifndef TRAVIS
// the tests causes a lot of file deletions which Travis limited testing // the tests causes a lot of file deletions which Travis limited testing
// environment cannot handle // environment cannot handle
TEST_F(PersistentCacheTierTest, TieredCacheInsertWithEviction) { TEST_F(PersistentCacheTierTest, TieredCacheInsertWithEviction) {
@ -234,16 +247,16 @@ PersistentCacheDBTest::PersistentCacheDBTest() : DBTestBase("/cache_test") {
// test template // test template
void PersistentCacheDBTest::RunTest( void PersistentCacheDBTest::RunTest(
const std::function<std::shared_ptr<PersistentCacheTier>(bool)>& const std::function<std::shared_ptr<PersistentCacheTier>(bool)>& new_pcache,
new_pcache) { const size_t max_keys = 100 * 1024, const size_t max_usecase = 5) {
if (!Snappy_Supported()) { if (!Snappy_Supported()) {
return; return;
} }
// number of insertion interations // number of insertion interations
int num_iter = static_cast<int>(100 * 1024 * kStressFactor); int num_iter = static_cast<int>(max_keys * kStressFactor);
for (int iter = 0; iter < 5; iter++) { for (size_t iter = 0; iter < max_usecase; iter++) {
Options options; Options options;
options.write_buffer_size = options.write_buffer_size =
static_cast<size_t>(64 * 1024 * kStressFactor); // small write buffer static_cast<size_t>(64 * 1024 * kStressFactor); // small write buffer
@ -366,21 +379,30 @@ void PersistentCacheDBTest::RunTest(
} }
} }
// test table with volatile page cache #ifdef TRAVIS
TEST_F(PersistentCacheDBTest, VolatileCacheTest) { // Travis is unable to handle the normal version of the tests running out of
RunTest(std::bind(&MakeVolatileCache, dbname_)); // fds, out of space and timeouts. This is an easier version of the test
// specifically written for Travis
TEST_F(PersistentCacheDBTest, BasicTest) {
RunTest(std::bind(&MakeBlockCache, dbname_), /*max_keys=*/1024,
/*max_usecase=*/1);
} }
#else
// test table with block page cache // test table with block page cache
TEST_F(PersistentCacheDBTest, BlockCacheTest) { TEST_F(PersistentCacheDBTest, BlockCacheTest) {
RunTest(std::bind(&MakeBlockCache, dbname_)); RunTest(std::bind(&MakeBlockCache, dbname_));
} }
// test table with volatile page cache
TEST_F(PersistentCacheDBTest, VolatileCacheTest) {
RunTest(std::bind(&MakeVolatileCache, dbname_));
}
// test table with tiered page cache // test table with tiered page cache
TEST_F(PersistentCacheDBTest, TieredCacheTest) { TEST_F(PersistentCacheDBTest, TieredCacheTest) {
RunTest(std::bind(&MakeTieredCache, dbname_)); RunTest(std::bind(&MakeTieredCache, dbname_));
} }
#endif
} // namespace rocksdb } // namespace rocksdb
int main(int argc, char** argv) { int main(int argc, char** argv) {

View File

@ -259,7 +259,8 @@ class PersistentCacheDBTest : public DBTestBase {
// test template // test template
void RunTest(const std::function<std::shared_ptr<PersistentCacheTier>(bool)>& void RunTest(const std::function<std::shared_ptr<PersistentCacheTier>(bool)>&
new_pcache); new_pcache,
const size_t max_keys, const size_t max_usecase);
}; };
} // namespace rocksdb } // namespace rocksdb