1
0
Fork 0

expose ARANGODB_USE_CATCH_TESTS define, make TEST_VIRTUAL be based on it (#8410)

This commit is contained in:
Jan 2019-03-14 12:53:57 +01:00 committed by GitHub
parent b211277870
commit a1897d4e84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 17 deletions

View File

@ -766,9 +766,7 @@ endif ()
option(USE_CATCH_TESTS "Compile catch C++ tests" ON)
if (USE_CATCH_TESTS)
add_definitions("-DTEST_VIRTUAL=virtual")
else()
add_definitions("-DTEST_VIRTUAL=")
add_definitions("-DARANGODB_USE_CATCH_TESTS=1")
endif()
include(debugInformation)

View File

@ -49,7 +49,7 @@
namespace arangodb {
// used by catch tests
#ifdef USE_CATCH_TESTS
#ifdef ARANGODB_USE_CATCH_TESTS
/*static*/ FlushFeature::DefaultFlushSubscription FlushFeature::_defaultFlushSubscription;
#endif
@ -656,7 +656,7 @@ std::shared_ptr<FlushFeature::FlushSubscription> FlushFeature::registerFlushSubs
return subscription;
}
#ifdef USE_CATCH_TESTS
#ifdef ARANGODB_USE_CATCH_TESTS
if (_defaultFlushSubscription) {
struct DelegatingFlushSubscription: public FlushSubscriptionBase {
DefaultFlushSubscription _delegate;

View File

@ -23,16 +23,6 @@
#ifndef ARANGODB_REST_SERVER_FLUSH_FEATURE_H
#define ARANGODB_REST_SERVER_FLUSH_FEATURE_H 1
#if !defined(USE_CATCH_TESTS) && !defined(EXPAND_ARANGODB_REST_SERVER_FLUSH_FEATURE_H)
#define DO_EXPAND_ARANGODB_REST_SERVER_FLUSH_FEATURE_H(VAL) VAL ## 1
#define EXPAND_ARANGODB_REST_SERVER_FLUSH_FEATURE_H(VAL) DO_EXPAND_ARANGODB_REST_SERVER_FLUSH_FEATURE_H(VAL)
#if defined(TEST_VIRTUAL) && (EXPAND_ARANGODB_REST_SERVER_FLUSH_FEATURE_H(TEST_VIRTUAL) != 1)
#define USE_CATCH_TESTS
#endif
#undef EXPAND_ARANGODB_REST_SERVER_FLUSH_FEATURE_H
#undef DO_EXPAND_ARANGODB_REST_SERVER_FLUSH_FEATURE_H
#endif
#include "ApplicationFeatures/ApplicationFeature.h"
#include "Basics/ReadWriteLock.h"
@ -60,7 +50,7 @@ class FlushFeature final : public application_features::ApplicationFeature {
class FlushSubscriptionBase; // forward declaration
// used by catch tests
#ifdef USE_CATCH_TESTS
#ifdef ARANGODB_USE_CATCH_TESTS
typedef std::function<Result(std::string const&, TRI_vocbase_t const&, velocypack::Slice const&)> DefaultFlushSubscription;
static DefaultFlushSubscription _defaultFlushSubscription;
#endif
@ -117,4 +107,4 @@ class FlushFeature final : public application_features::ApplicationFeature {
} // namespace arangodb
#endif
#endif

View File

@ -192,6 +192,13 @@ typedef long suseconds_t;
// Windows debug mode also seems to define DEBUG preproc symbol
#undef DEBUG
#endif
#ifdef ARANGODB_USE_CATCH_TESTS
#define TEST_VIRTUAL virtual
#else
#define TEST_VIRTUAL
#endif
/// @brief helper macro for calculating strlens for static strings at
/// a compile-time (unless compiled with fno-builtin-strlen etc.)