Debian Codegraph @

Source/Test/Evaluation/CReasonerEvaluationExecutorThread.h

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONEXECUTORTHREAD_H
22 #define KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONEXECUTORTHREAD_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "CReasonerEvaluationExecutor.h"
29 #include "CReasonerEvaluationProvider.h"
30 #include "CConfigDependendReasonerEvaluationFactory.h"
31 #include "CReasonerEvaluationRequestClientOWLlinkThread.h"
32 #include "CReasonerEvaluationRequestClientSPARQLThread.h"
33 #include "CReasonerEvaluationEvaluator.h"
34 #include "CReasonerEvaluationEvaluatedCallbackContextData.h"
35 #include "CReasonerEvaluationExecutionCallbackContextData.h"
36 #include "CReasonerEvaluationPathConverter.h"
37 #include "CReasonerEvaluationFiltering.h"
38 #include "CCriticalSystemProcessTester.h"
39 #include "CReasonerEvaluationEvaluatorOWLlink.h"
40 #include "CReasonerEvaluationEvaluatorSPARQL.h"
41
42
43 // Other includes
44 #include "Test/Evaluation/Events/CReasonerEvaluationTestsuiteEvent.h"
45 #include "Test/Evaluation/Events/CReasonerEvaluationNextEvent.h"
46
47 #include "Config/CConfiguration.h"
48 #include "Config/CConfigDataReader.h"
49
50 #include "Concurrent/CIntervalThread.h"
51
52 #include "Control/Command/Events/CCommandProcessedCallbackEvent.h"
53
54 #include "Concurrent/Callback/CBlockingCallbackData.h"
55
56 #include "Control/Command/CCommanderManager.h"
57
58
59 // Logger includes
60 #include "Logger/CLogger.h"
61 #include "Logger/CLogIdentifier.h"
62
63
64
65 namespace Konclude {
66
67 using namespace Config;
68 using namespace Concurrent;
69 using namespace Concurrent::Callback;
70 using namespace Control::Command::Events;
71 using namespace Control::Command;
72
73 namespace Test {
74
75 namespace Evaluation {
76
77 using namespace Evaluation::Events;
78
79
80 /*!
81 *
82 * \class CReasonerEvaluationExecutorThread
83 * \author Andreas Steigmiller
84 * \version 0.1
85 * \brief TODO
86 *
87 */
88 class CReasonerEvaluationExecutorThread : public CThread, public CReasonerEvaluationExecutor, public CLogIdentifier {
89 // public methods
90 public:
91 //! Constructor
92 CReasonerEvaluationExecutorThread(CConfiguration *config, CWatchDog *watchDog = nullptr);
93
94 //! Destructor
95 virtual ~CReasonerEvaluationExecutorThread();
96
97 bool executeEvaluation(CReasonerEvaluationTestsuite* evaluationTestsuite, CCallbackData* callbackData);
98
99
100 // protected methods
101 protected:
102
103 bool processCustomsEvents(QEvent::Type type, CCustomEvent *event);
104 bool loadConfigurations();
105 bool initEvaluationTests();
106
107 bool finishEvaluationTests();
108 bool failedEvaluationTests();
109
110 QString nextEvaluationTestfile();
111
112 bool prepareNextEvaluationTest();
113
114
115 bool testSystemReadyForNextEvaluationTest();
116 void delayNextEvaluationTestUntilSystemReady();
117
118 bool executeNextEvaluationTest(const QString& testcaseInit, const QString& testcaseInput);
119 CReasonerEvaluationRequestClientBaseThread* getReasonerClientForTestfile(const QString& testFileNameString);
120 CReasonerEvaluationEvaluator* getReasonerEvaluatorForTestfile(const QString& testFileNameString, CReasonerEvaluationRequestClientBaseThread* reasonerClient);
121
122 bool evaluateExecutedTest(CReasonerEvaluationTerminationResult* terminationResults, CReasonerEvaluationRequestResult* requestResults, const QString& testcaseOutput, bool forceWriting);
123
124 QString getNumberString(cint64 number);
125 QString getNextOutputFileString();
126
127
128 bool testExistFile(const QString& fileString);
129
130 bool testFileFiltered(const QString& testFileNameString, const QString& testFilePathString, const QString& subDirPathString);
131
132
133 QString getCorrectedPathString(const QString& string);
134
135
136 // protected variables
137 protected:
138 CReasonerEvaluationTestsuite* mEvalTestsuite;
139 CConfiguration* mLoaderConfig;
140 CCommanderManager* mCommanderManager;
141 CConfiguration* mConfiguration;
142 CCallbackData* mExecutedCallback;
143 bool mExecutedTest;
144 bool mFirstTest;
145 cint64 mErrorCommBreakCount;
146 bool mErrorTestMaximalRetryWriting;
147 cint64 mErrorTestMaximalRetryCount;
148 cint64 mCurrentErrorTestRetryCount;
149 QString mPlatformName;
150
151 CReasonerEvaluationFiltering* mFiltering;
152
153 QString mInputDir;
154 QString mOutputDir;
155
156
157 QString mReasonerName;
158 QString mReasonerOutputDirectory;
159 QString mConfigName;
160
161
162 QStringList mRemainingSubDirs;
163 QStringList mRemainingFiles;
164
165 cint64 mTestCount;
166 cint64 mNumberStringSize;
167
168 QString mNextTestInputFile;
169 QString mNextTestOutputDir;
170 QString mReasonerInitFileString;
171 cint64 mNextTestRemainingExecutionCount;
172 cint64 mNextTestExecutionNumber;
173
174 cint64 mTestTimeout;
175 cint64 mWaitingTimeBetweenTests;
176 cint64 mSystemReadyRetestTimeForTests;
177 cint64 mWaitingTimeAfterReasonerCreation;
178
179 bool mFirstTestWarmUp;
180 bool mAllTestsWarmUp;
181
182
183 CReasonerEvaluationProvider* mReasonerProvider;
184 CReasonerEvaluationFactory* mReasonerEvalFactory;
185
186 CReasonerEvaluationEvaluatorOWLlink* mReasonerEvaluatorOWLlink;
187 CReasonerEvaluationEvaluatorSPARQL* mReasonerEvaluatorSPARQL;
188 CReasonerEvaluationEvaluator* mCurrentReasonerEvaluator;
189 CReasonerEvaluationRequestClientOWLlinkThread* mReasonerOWLlinkClient;
190 CReasonerEvaluationRequestClientSPARQLThread* mReasonerSPARQLClient;
191 CReasonerEvaluationRequestClientBaseThread* mCurrentReasonerClient;
192
193
194 CCriticalSystemProcessTester* mCriticalProcessesTester;
195
196 cint64 mConfTestcaseEvaluationExceptionLimit;
197
198 // private methods
199 private:
200
201 // private variables
202 private:
203
204 };
205
206 }; // end namespace Evaluation
207
208 }; // end namespace Test
209
210 }; // end namespace Konclude
211
212 #endif // KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONEXECUTORTHREAD_H