Reduce dependency on gtest dependency in release code (#6907)

Summary:
Release code now depends on gtest, indirectly through including "test_util/testharness.h". This creates multiple problems. One important reason is the definition of IGNORE_STATUS_IF_ERROR() in test_util/testharness.h. Move it to sync_point.h instead.
Note that utilities/cassandra/format.h still depends on "test_util/testharness.h". This will be resolved in a separate diff.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6907

Test Plan: Run all existing tests.

Reviewed By: ajkr

Differential Revision: D21829884

fbshipit-source-id: 9253c19ffde2936f3ae68998210f8e54f645a6e6
This commit is contained in:
sdong 2020-06-02 12:09:48 -07:00 committed by Facebook GitHub Bot
parent 8d87e9cea1
commit 298b00a396
8 changed files with 14 additions and 20 deletions

View File

@ -17,7 +17,6 @@
#include "monitoring/iostats_context_imp.h"
#include "port/port.h"
#include "test_util/sync_point.h"
#include "test_util/testharness.h"
#include "util/random.h"
#include "util/rate_limiter.h"

View File

@ -14,7 +14,6 @@
#include "monitoring/perf_context_imp.h"
#include "rocksdb/filter_policy.h"
#include "table/block_based/block_based_table_reader.h"
#include "test_util/testharness.h"
#include "util/coding.h"
#include "util/string_util.h"

View File

@ -55,7 +55,6 @@
#include "table/sst_file_writer_collectors.h"
#include "table/two_level_iterator.h"
#include "test_util/testharness.h"
#include "monitoring/perf_context_imp.h"
#include "port/lang.h"
#include "test_util/sync_point.h"

View File

@ -11,7 +11,6 @@
#include "port/port.h"
#include "rocksdb/filter_policy.h"
#include "table/block_based/block_based_table_reader.h"
#include "test_util/testharness.h"
#include "util/coding.h"
namespace ROCKSDB_NAMESPACE {

View File

@ -13,7 +13,6 @@
#include "rocksdb/filter_policy.h"
#include "table/block_based/block.h"
#include "table/block_based/block_based_table_reader.h"
#include "test_util/testharness.h"
#include "util/coding.h"
namespace ROCKSDB_NAMESPACE {

View File

@ -8,7 +8,6 @@
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include "table/block_based/partitioned_index_reader.h"
#include "table/block_based/partitioned_index_iterator.h"
#include "test_util/testharness.h"
namespace ROCKSDB_NAMESPACE {
Status PartitionIndexReader::Create(

View File

@ -142,3 +142,17 @@ class SyncPoint {
#define INIT_SYNC_POINT_SINGLETONS() \
(void)ROCKSDB_NAMESPACE::SyncPoint::GetInstance();
#endif // NDEBUG
// Callback sync point for any read IO errors that should be ignored by
// the fault injection framework
// Disable in release mode
#ifdef NDEBUG
#define IGNORE_STATUS_IF_ERROR(_status_)
#else
#define IGNORE_STATUS_IF_ERROR(_status_) \
{ \
if (!_status_.ok()) { \
TEST_SYNC_POINT("FaultInjectionIgnoreError"); \
} \
}
#endif // NDEBUG

View File

@ -43,18 +43,4 @@ int RandomSeed();
EXPECT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s)
#define EXPECT_NOK(s) EXPECT_FALSE((s).ok())
} // namespace test
// Callback sync point for any read IO errors that should be ignored by
// the fault injection framework
#ifdef NDEBUG
// Disable in release mode
#define IGNORE_STATUS_IF_ERROR(_status_)
#else
#define IGNORE_STATUS_IF_ERROR(_status_) \
{ \
if (!_status_.ok()) { \
TEST_SYNC_POINT("FaultInjectionIgnoreError"); \
} \
}
#endif // NDEBUG
} // namespace ROCKSDB_NAMESPACE