summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-06-10 20:18:49 +0200
committerMattes D <github@xoft.cz>2016-06-18 13:12:10 +0200
commit36eefbf0f25c93ed30bcff9d7abbb8b8696964df (patch)
tree31a06620dfde39de250b4778c67658eaccfcdab3 /src
parentSelfTests: Fixed HTTPMessageParser tests for out-of-source builds. (diff)
downloadcuberite-36eefbf0f25c93ed30bcff9d7abbb8b8696964df.tar
cuberite-36eefbf0f25c93ed30bcff9d7abbb8b8696964df.tar.gz
cuberite-36eefbf0f25c93ed30bcff9d7abbb8b8696964df.tar.bz2
cuberite-36eefbf0f25c93ed30bcff9d7abbb8b8696964df.tar.lz
cuberite-36eefbf0f25c93ed30bcff9d7abbb8b8696964df.tar.xz
cuberite-36eefbf0f25c93ed30bcff9d7abbb8b8696964df.tar.zst
cuberite-36eefbf0f25c93ed30bcff9d7abbb8b8696964df.zip
Diffstat (limited to '')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Generating/PieceGenerator.cpp1
-rw-r--r--src/Generating/PrefabPiecePool.cpp1
-rw-r--r--src/OSSupport/NetworkInterfaceEnum.cpp1
-rw-r--r--src/Root.cpp6
-rw-r--r--src/SelfTests.cpp71
-rw-r--r--src/SelfTests.h51
7 files changed, 0 insertions, 133 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5c57be1c9..76a18801d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -63,7 +63,6 @@ SET (SRCS
RCONServer.cpp
Root.cpp
Scoreboard.cpp
- SelfTests.cpp
Server.cpp
SetChunkData.cpp
SpawnPrepare.cpp
@@ -140,7 +139,6 @@ SET (HDRS
RCONServer.h
Root.h
Scoreboard.h
- SelfTests.h
Server.h
SetChunkData.h
SettingsRepositoryInterface.h
diff --git a/src/Generating/PieceGenerator.cpp b/src/Generating/PieceGenerator.cpp
index d6204ce85..842ac349b 100644
--- a/src/Generating/PieceGenerator.cpp
+++ b/src/Generating/PieceGenerator.cpp
@@ -6,7 +6,6 @@
#include "Globals.h"
#include "PieceGenerator.h"
-#include "../SelfTests.h"
#include "VerticalStrategy.h"
#include "VerticalLimit.h"
diff --git a/src/Generating/PrefabPiecePool.cpp b/src/Generating/PrefabPiecePool.cpp
index e1bb9f684..417f8ce7e 100644
--- a/src/Generating/PrefabPiecePool.cpp
+++ b/src/Generating/PrefabPiecePool.cpp
@@ -6,7 +6,6 @@
#include "Globals.h"
#include "PrefabPiecePool.h"
#include "../Bindings/LuaState.h"
-#include "SelfTests.h"
#include "WorldStorage/SchematicFileSerializer.h"
#include "VerticalStrategy.h"
#include "../StringCompression.h"
diff --git a/src/OSSupport/NetworkInterfaceEnum.cpp b/src/OSSupport/NetworkInterfaceEnum.cpp
index c7339c408..d3a254c23 100644
--- a/src/OSSupport/NetworkInterfaceEnum.cpp
+++ b/src/OSSupport/NetworkInterfaceEnum.cpp
@@ -6,7 +6,6 @@
#include "Globals.h"
#include "Network.h"
#include "event2/util.h"
-#include "../SelfTests.h"
#ifdef _WIN32
#include <IPHlpApi.h>
diff --git a/src/Root.cpp b/src/Root.cpp
index bd8e026f3..1eca73cb2 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -22,7 +22,6 @@
#include "IniFile.h"
#include "SettingsRepositoryInterface.h"
#include "OverridesSettingsRepository.h"
-#include "SelfTests.h"
#include "Logger.h"
#include <iostream>
@@ -128,11 +127,6 @@ void cRoot::Start(std::unique_ptr<cSettingsRepositoryInterface> a_OverridesRepo)
LOG("from commit id: " BUILD_COMMIT_ID " built at: " BUILD_DATETIME);
#endif
- // Run the self-tests registered previously via cSelfTests::Register():
- #ifdef SELF_TEST
- cSelfTests::ExecuteAll();
- #endif
-
cDeadlockDetect dd;
auto BeginTime = std::chrono::steady_clock::now();
diff --git a/src/SelfTests.cpp b/src/SelfTests.cpp
deleted file mode 100644
index 7e35e675e..000000000
--- a/src/SelfTests.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-
-// SelfTests.h
-
-// Implements the cSelfTests class representing the singleton used for registering self-tests
-// This class is only declared if SELF_TEST macro is defined.
-
-#include "Globals.h"
-#include "SelfTests.h"
-
-
-
-
-
-#ifdef SELF_TEST
- cSelfTests::cSelfTests(void):
- m_AllowRegistering(true)
- {
- }
-
-
-
-
-
- cSelfTests & cSelfTests::Get(void)
- {
- static cSelfTests singleton;
- return singleton;
- }
-
-
-
-
-
- void cSelfTests::Register(cSelfTests::SelfTestFunction a_FnToExecute, const AString & a_TestName)
- {
- ASSERT(Get().m_AllowRegistering);
- Get().m_SelfTests.push_back(std::make_pair(a_FnToExecute, a_TestName));
- }
-
-
-
-
-
- void cSelfTests::ExecuteAll(void)
- {
- Get().m_AllowRegistering = false;
- LOG("--- Performing self-tests ---");
- for (auto & test: Get().m_SelfTests)
- {
- LOG("Performing self-test: %s", test.second.c_str());
- try
- {
- test.first();
- }
- catch (const std::exception & exc)
- {
- LOGWARNING("Exception in test %s: %s", test.second.c_str(), exc.what());
- }
- catch (...)
- {
- LOGWARNING("Unknown exception in test %s", test.second.c_str());
- }
- } // for test - m_SelfTests[]
- LOG("--- Self-tests finished ---");
- }
-
-#endif // SELF_TEST
-
-
-
-
diff --git a/src/SelfTests.h b/src/SelfTests.h
deleted file mode 100644
index 03a3b5faa..000000000
--- a/src/SelfTests.h
+++ /dev/null
@@ -1,51 +0,0 @@
-
-// SelfTests.h
-
-// Declares the cSelfTests class representing the singleton used for registering self-tests
-// This class is only declared if SELF_TEST macro is defined.
-
-
-
-
-
-#pragma once
-
-
-
-
-
-#ifdef SELF_TEST
- /** Singleton containing registered self-tests.
- Used to schedule self-tests to run after the logging framework is initialized (#2228). */
- class cSelfTests
- {
- public:
- /** Returns the singleton instance of this class. */
- static cSelfTests & Get(void);
-
- // typedef void (* SelfTestFunction)(void);
- typedef std::function<void(void)> SelfTestFunction;
-
- /** Registers a self-test to be executed once the logging framework is initialized. */
- static void Register(SelfTestFunction a_FnToExecute, const AString & a_TestName);
-
- /** Executes all the registered self-tests. */
- static void ExecuteAll(void);
-
- protected:
- typedef std::vector<std::pair<SelfTestFunction, AString>> SelfTestFunctions;
-
- /** Functions (registered self-tests) to call once the logging framework is initialized. */
- SelfTestFunctions m_SelfTests;
-
- /** If true, tests may be registered. Set to false once the tests are executed, to detect tests that are registered too late. */
- bool m_AllowRegistering;
-
-
- cSelfTests(void);
- };
-#endif // SELF_TEST
-
-
-
-