| 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_CREASONERTESTFILETESTER_H |
| 22 |
#define KONCLUDE_TEST_CREASONERTESTFILETESTER_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QProcess> |
| 26 |
#include <QDir> |
| 27 |
|
| 28 |
// Namespace includes |
| 29 |
#include "CReasonerTestfileEvaluator.h" |
| 30 |
|
| 31 |
// Other includes |
| 32 |
#include "Test/Events/CTestTestfileEvent.h" |
| 33 |
#include "Test/Events/CEvaluateTestfileTestEvent.h" |
| 34 |
|
| 35 |
#include "Concurrent/CIntervalThread.h" |
| 36 |
|
| 37 |
#include "Config/CConfiguration.h" |
| 38 |
|
| 39 |
#include "Control/Command/Instructions/CTestTestfileCommand.h" |
| 40 |
|
| 41 |
#include "Control/Command/CCommandRecordRouter.h" |
| 42 |
|
| 43 |
#include "Control/Command/Records/CStartProcessCommandRecord.h" |
| 44 |
#include "Control/Command/Records/CStopProcessCommandRecord.h" |
| 45 |
#include "Control/Command/Records/CFinishProcessCommandRecord.h" |
| 46 |
#include "Control/Command/Records/CUnspecifiedMessageInformationRecord.h" |
| 47 |
|
| 48 |
// Logger includes |
| 49 |
#include "Logger/CLogger.h" |
| 50 |
#include "Logger/CLogIdentifier.h" |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
namespace Konclude { |
| 55 |
|
| 56 |
using namespace Config; |
| 57 |
using namespace Concurrent; |
| 58 |
using namespace Control::Command; |
| 59 |
using namespace Control::Command::Records; |
| 60 |
using namespace Control::Command::Instructions; |
| 61 |
|
| 62 |
namespace Test { |
| 63 |
|
| 64 |
using namespace Test::Events; |
| 65 |
|
| 66 |
|
| 67 |
/*! |
| 68 |
* |
| 69 |
* \class CReasonerTestfileTester |
| 70 |
* \author Andreas Steigmiller |
| 71 |
* \version 0.1 |
| 72 |
* \brief TODO |
| 73 |
* |
| 74 |
*/ |
| 75 |
class CReasonerTestfileTester : public CIntervalThread, public CLogIdentifier { |
| 76 |
Q_OBJECT |
| 77 |
|
| 78 |
// public methods |
| 79 |
public: |
| 80 |
//! Constructor |
| 81 |
CReasonerTestfileTester(CConfiguration *config, CWatchDog *watchDog = 0); |
| 82 |
|
| 83 |
//! Destructor |
| 84 |
virtual ~CReasonerTestfileTester(); |
| 85 |
|
| 86 |
virtual CReasonerTestfileTester *realizeTestCommand(CTestTestfileCommand *command, CReasonerTestfileEvaluator *testEvaluator); |
| 87 |
|
| 88 |
// protected methods |
| 89 |
protected: |
| 90 |
|
| 91 |
virtual bool processTimer(qint64 timerID); |
| 92 |
|
| 93 |
virtual bool processCustomsEvents(QEvent::Type type, CCustomEvent *event); |
| 94 |
|
| 95 |
// protected variables |
| 96 |
protected: |
| 97 |
QString testfile; |
| 98 |
QProcess *testProcess; |
| 99 |
CReasonerTestfileEvaluator *evaluator; |
| 100 |
CReasonerTestfileTest *testfileTest; |
| 101 |
CTestTestfileCommand *testCommand; |
| 102 |
CCommandRecordRouter *commandRecordRouter; |
| 103 |
|
| 104 |
QString reasonerString; |
| 105 |
QString reasonerConfigString; |
| 106 |
qint64 wCount; |
| 107 |
|
| 108 |
bool processCrashed; |
| 109 |
bool processTimedout; |
| 110 |
|
| 111 |
qint64 closeTimeout; |
| 112 |
qint64 killTimeout; |
| 113 |
qint64 runTimeout; |
| 114 |
|
| 115 |
const static qint64 TIMERCLOSEPROCESSID = 1; |
| 116 |
|
| 117 |
|
| 118 |
// private methods |
| 119 |
private: |
| 120 |
void startTestfileTest(); |
| 121 |
void evaluateTestfileTest(); |
| 122 |
|
| 123 |
virtual void sendEvaluateTestfileTestEvent(); |
| 124 |
virtual void sendStartTestfileTestEvent(); |
| 125 |
|
| 126 |
// private methods |
| 127 |
private slots: |
| 128 |
void processError(QProcess::ProcessError error); |
| 129 |
void processFinished(int exitCode, QProcess::ExitStatus exitStatus); |
| 130 |
|
| 131 |
// private variables |
| 132 |
private: |
| 133 |
|
| 134 |
}; |
| 135 |
|
| 136 |
}; // end namespace Test |
| 137 |
|
| 138 |
}; // end namespace Konclude |
| 139 |
|
| 140 |
#endif // KONCLUDE_TEST_CREASONERTESTFILETESTER_H |