diff --git a/CMakeLists.txt b/CMakeLists.txt index acaa0fbba4..795b436ea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/arangod/RestServer/FlushFeature.cpp b/arangod/RestServer/FlushFeature.cpp index 7b095c4dd1..70104e5b5e 100644 --- a/arangod/RestServer/FlushFeature.cpp +++ b/arangod/RestServer/FlushFeature.cpp @@ -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::registerFlushSubs return subscription; } - #ifdef USE_CATCH_TESTS + #ifdef ARANGODB_USE_CATCH_TESTS if (_defaultFlushSubscription) { struct DelegatingFlushSubscription: public FlushSubscriptionBase { DefaultFlushSubscription _delegate; diff --git a/arangod/RestServer/FlushFeature.h b/arangod/RestServer/FlushFeature.h index aa882748e9..54805d5382 100644 --- a/arangod/RestServer/FlushFeature.h +++ b/arangod/RestServer/FlushFeature.h @@ -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 DefaultFlushSubscription; static DefaultFlushSubscription _defaultFlushSubscription; #endif @@ -117,4 +107,4 @@ class FlushFeature final : public application_features::ApplicationFeature { } // namespace arangodb -#endif \ No newline at end of file +#endif diff --git a/lib/Basics/Common.h b/lib/Basics/Common.h index b88845e4de..c2007d6f07 100644 --- a/lib/Basics/Common.h +++ b/lib/Basics/Common.h @@ -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.)