From 4dd80debd0710feae50d051040b132e834040c7f Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Wed, 30 May 2018 15:33:19 -0700 Subject: [PATCH] Remove tests from ROCKSDB_VALGRIND_RUN Summary: In order to make valgrind check test to pass in a day, remove some tests that run prohibitively slow under valgrind. Closes https://github.com/facebook/rocksdb/pull/3924 Differential Revision: D8210184 Pulled By: siying fbshipit-source-id: 5b06fb08f3cf57571d422d05a0dbddc9f9376f7a --- db/db_compaction_filter_test.cc | 7 +++++++ db/db_compaction_test.cc | 2 ++ db/db_test.cc | 2 ++ db/db_universal_compaction_test.cc | 6 +++++- memtable/inlineskiplist_test.cc | 2 ++ utilities/persistent_cache/persistent_cache_test.cc | 4 ++-- utilities/transactions/transaction_test.cc | 6 ++++++ utilities/transactions/write_prepared_transaction_test.cc | 6 ++++++ 8 files changed, 32 insertions(+), 3 deletions(-) diff --git a/db/db_compaction_filter_test.cc b/db/db_compaction_filter_test.cc index c5e8e547c..0c906948e 100644 --- a/db/db_compaction_filter_test.cc +++ b/db/db_compaction_filter_test.cc @@ -45,6 +45,7 @@ class DBTestCompactionFilterWithCompactParam } }; +#ifndef ROCKSDB_VALGRIND_RUN INSTANTIATE_TEST_CASE_P( DBTestCompactionFilterWithCompactOption, DBTestCompactionFilterWithCompactParam, @@ -53,6 +54,12 @@ INSTANTIATE_TEST_CASE_P( DBTestBase::OptionConfig::kUniversalCompactionMultiLevel, DBTestBase::OptionConfig::kLevelSubcompactions, DBTestBase::OptionConfig::kUniversalSubcompactions)); +#else +// Run fewer cases in valgrind +INSTANTIATE_TEST_CASE_P(DBTestCompactionFilterWithCompactOption, + DBTestCompactionFilterWithCompactParam, + ::testing::Values(DBTestBase::OptionConfig::kDefault)); +#endif // ROCKSDB_VALGRIND_RUN class KeepFilter : public CompactionFilter { public: diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc index 7092afa37..bd8c10ae6 100644 --- a/db/db_compaction_test.cc +++ b/db/db_compaction_test.cc @@ -251,6 +251,7 @@ const SstFileMetaData* PickFileRandomly( } } // anonymous namespace +#ifndef ROCKSDB_VALGRIND_RUN // All the TEST_P tests run once with sub_compactions disabled (i.e. // options.max_subcompactions = 1) and once with it enabled TEST_P(DBCompactionTestWithParam, CompactionDeletionTrigger) { @@ -293,6 +294,7 @@ TEST_P(DBCompactionTestWithParam, CompactionDeletionTrigger) { ASSERT_GT(db_size[0] / 3, db_size[1]); } } +#endif // ROCKSDB_VALGRIND_RUN TEST_P(DBCompactionTestWithParam, CompactionsPreserveDeletes) { // For each options type we test following diff --git a/db/db_test.cc b/db/db_test.cc index ac17606c1..14215be97 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -2561,6 +2561,7 @@ class ModelDB : public DB { std::string name_ = ""; }; +#ifndef ROCKSDB_VALGRIND_RUN static std::string RandomKey(Random* rnd, int minimum = 0) { int len; do { @@ -2717,6 +2718,7 @@ TEST_P(DBTestRandomized, Randomized) { if (model_snap != nullptr) model.ReleaseSnapshot(model_snap); if (db_snap != nullptr) db_->ReleaseSnapshot(db_snap); } +#endif // ROCKSDB_VALGRIND_RUN TEST_F(DBTest, BlockBasedTablePrefixIndexTest) { // create a DB with block prefix index diff --git a/db/db_universal_compaction_test.cc b/db/db_universal_compaction_test.cc index 528985758..c256ce0f3 100644 --- a/db/db_universal_compaction_test.cc +++ b/db/db_universal_compaction_test.cc @@ -662,7 +662,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTargetLevel) { ASSERT_EQ("0,0,0,0,1", FilesPerLevel(0)); } - +#ifndef ROCKSDB_VALGRIND_RUN class DBTestUniversalCompactionMultiLevels : public DBTestUniversalCompactionBase { public: @@ -698,6 +698,7 @@ TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionMultiLevels) { ASSERT_EQ(Get(1, Key(i % num_keys)), Key(i)); } } + // Tests universal compaction with trivial move enabled TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionTrivialMove) { int32_t trivial_move = 0; @@ -940,6 +941,7 @@ INSTANTIATE_TEST_CASE_P(DBTestUniversalCompactionParallel, DBTestUniversalCompactionParallel, ::testing::Combine(::testing::Values(1, 10), ::testing::Values(false))); +#endif // ROCKSDB_VALGRIND_RUN TEST_P(DBTestUniversalCompaction, UniversalCompactionOptions) { Options options = CurrentOptions(); @@ -1155,6 +1157,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionCompressRatio2) { ASSERT_LT(TotalSize(), 120000U * 12 * 0.8 + 120000 * 2); } +#ifndef ROCKSDB_VALGRIND_RUN // Test that checks trivial move in universal compaction TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest1) { int32_t trivial_move = 0; @@ -1247,6 +1250,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) { rocksdb::SyncPoint::GetInstance()->DisableProcessing(); } +#endif // ROCKSDB_VALGRIND_RUN TEST_P(DBTestUniversalCompaction, UniversalCompactionFourPaths) { Options options = CurrentOptions(); diff --git a/memtable/inlineskiplist_test.cc b/memtable/inlineskiplist_test.cc index 10667396c..b416ef7c5 100644 --- a/memtable/inlineskiplist_test.cc +++ b/memtable/inlineskiplist_test.cc @@ -309,6 +309,7 @@ TEST_F(InlineSkipTest, InsertWithHint_CompatibleWithInsertWithoutHint) { Validate(&list); } +#ifndef ROCKSDB_VALGRIND_RUN // We want to make sure that with a single writer and multiple // concurrent readers (with no synchronization other than when a // reader's iterator is created), the reader always observes all the @@ -635,6 +636,7 @@ TEST_F(InlineSkipTest, ConcurrentInsert1) { RunConcurrentInsert(1); } TEST_F(InlineSkipTest, ConcurrentInsert2) { RunConcurrentInsert(2); } TEST_F(InlineSkipTest, ConcurrentInsert3) { RunConcurrentInsert(3); } +#endif // ROCKSDB_VALGRIND_RUN } // namespace rocksdb int main(int argc, char** argv) { diff --git a/utilities/persistent_cache/persistent_cache_test.cc b/utilities/persistent_cache/persistent_cache_test.cc index 5affc4085..1f26c9a4e 100644 --- a/utilities/persistent_cache/persistent_cache_test.cc +++ b/utilities/persistent_cache/persistent_cache_test.cc @@ -157,7 +157,7 @@ TEST_F(PersistentCacheTierTest, DISABLED_BlockCacheInsertWithFileCreateError) { rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks(); } -#ifdef TRAVIS +#if defined(TRAVIS) || defined(ROCKSDB_VALGRIND_RUN) // 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 @@ -435,7 +435,7 @@ void PersistentCacheDBTest::RunTest( } } -#ifdef TRAVIS +#if defined(TRAVIS) || defined(ROCKSDB_VALGRIND_RUN) // 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 diff --git a/utilities/transactions/transaction_test.cc b/utilities/transactions/transaction_test.cc index 84f4be5bd..e7bd682ca 100644 --- a/utilities/transactions/transaction_test.cc +++ b/utilities/transactions/transaction_test.cc @@ -50,6 +50,9 @@ INSTANTIATE_TEST_CASE_P( StackableDBAsBaseDB, TransactionTest, ::testing::Values(std::make_tuple(true, true, WRITE_COMMITTED), std::make_tuple(true, true, WRITE_PREPARED))); + +// MySQLStyleTransactionTest takes far too long for valgrind to run. +#ifndef ROCKSDB_VALGRIND_RUN INSTANTIATE_TEST_CASE_P( MySQLStyleTransactionTest, MySQLStyleTransactionTest, ::testing::Values(std::make_tuple(false, false, WRITE_COMMITTED), @@ -60,6 +63,7 @@ INSTANTIATE_TEST_CASE_P( std::make_tuple(false, true, WRITE_PREPARED), std::make_tuple(true, false, WRITE_PREPARED), std::make_tuple(true, true, WRITE_PREPARED))); +#endif // ROCKSDB_VALGRIND_RUN TEST_P(TransactionTest, DoubleEmptyWrite) { WriteOptions write_options; @@ -4803,6 +4807,7 @@ TEST_P(TransactionTest, ExpiredTransactionDataRace1) { rocksdb::SyncPoint::GetInstance()->DisableProcessing(); } +#ifndef ROCKSDB_VALGRIND_RUN namespace { Status TransactionStressTestInserter(TransactionDB* db, const size_t num_transactions, @@ -4890,6 +4895,7 @@ TEST_P(MySQLStyleTransactionTest, TransactionStressTest) { !TAKE_SNAPSHOT); ASSERT_OK(s); } +#endif // ROCKSDB_VALGRIND_RUN TEST_P(TransactionTest, MemoryLimitTest) { TransactionOptions txn_options; diff --git a/utilities/transactions/write_prepared_transaction_test.cc b/utilities/transactions/write_prepared_transaction_test.cc index c24e575be..7558a3660 100644 --- a/utilities/transactions/write_prepared_transaction_test.cc +++ b/utilities/transactions/write_prepared_transaction_test.cc @@ -521,6 +521,7 @@ class WritePreparedTransactionTest std::get<2>(GetParam())){}; }; +#ifndef ROCKSDB_VALGRIND_RUN class SnapshotConcurrentAccessTest : public WritePreparedTransactionTestBase, virtual public ::testing::WithParamInterface< @@ -539,6 +540,7 @@ class SnapshotConcurrentAccessTest size_t split_id_; size_t split_cnt_; }; +#endif // ROCKSDB_VALGRIND_RUN class SeqAdvanceConcurrentTest : public WritePreparedTransactionTestBase, @@ -564,6 +566,7 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values(std::make_tuple(false, false, WRITE_PREPARED), std::make_tuple(false, true, WRITE_PREPARED))); +#ifndef ROCKSDB_VALGRIND_RUN INSTANTIATE_TEST_CASE_P( TwoWriteQueues, SnapshotConcurrentAccessTest, ::testing::Values(std::make_tuple(false, true, WRITE_PREPARED, 0, 20), @@ -635,6 +638,7 @@ INSTANTIATE_TEST_CASE_P( std::make_tuple(false, false, WRITE_PREPARED, 7, 10), std::make_tuple(false, false, WRITE_PREPARED, 8, 10), std::make_tuple(false, false, WRITE_PREPARED, 9, 10))); +#endif // ROCKSDB_VALGRIND_RUN TEST_P(WritePreparedTransactionTest, CommitMapTest) { WritePreparedTxnDB* wp_db = dynamic_cast(db); @@ -841,6 +845,7 @@ TEST_P(WritePreparedTransactionTest, CheckAgainstSnapshotsTest) { // This test is too slow for travis #ifndef TRAVIS +#ifndef ROCKSDB_VALGRIND_RUN // Test that CheckAgainstSnapshots will not miss a live snapshot if it is run in // parallel with UpdateSnapshots. TEST_P(SnapshotConcurrentAccessTest, SnapshotConcurrentAccessTest) { @@ -919,6 +924,7 @@ TEST_P(SnapshotConcurrentAccessTest, SnapshotConcurrentAccessTest) { } printf("\n"); } +#endif // ROCKSDB_VALGRIND_RUN #endif // TRAVIS // This test clarifies the contract of AdvanceMaxEvictedSeq method