Debian Codegraph @

Source/Test/CReasonerTestsuiteTester.cpp

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 #include "CReasonerTestsuiteTester.h"
22
23
24 namespace Konclude {
25
26 namespace Test {
27
28
29
30 CReasonerTestsuiteTester::CReasonerTestsuiteTester(CConfiguration *config) : CLogIdentifier("::Konclude::Test::ReasonerTestsuiteTester",this) {
31 configuration = config;
32 testFileTester = new CReasonerTestfileTester(config);
33 testErrorEvaluator = new CReasonerTestfileErrorEvaluator();
34 }
35
36
37 CReasonerTestsuiteTester::~CReasonerTestsuiteTester() {
38 delete testFileTester;
39 delete testErrorEvaluator;
40 }
41
42
43 CReasonerTestsuiteTester *CReasonerTestsuiteTester::realizeTestCommand(CTestTestsuiteCommand *command) {
44 CCommandRecordRouter commandRecordRouter(command,this);
45 CStartProcessCommandRecord::makeRecord(&commandRecordRouter);
46
47
48 QTime totalTestTimer;
49 totalTestTimer.start();
50
51 CReasonerTestsuiteTest *testsuiteTest = command->getTestsuiteTest();
52
53 CLinker<CCommand *> *subCommandIt = command->getSubCommandLinker();
54 while (subCommandIt) {
55 CCommand *subCommand = subCommandIt->getData();
56 CTestTestfileCommand *testTestfileCommand = dynamic_cast<CTestTestfileCommand *>(subCommand);
57 if (testTestfileCommand) {
58 QTime testTimer;
59 testTimer.start();
60 QString testfile = testTestfileCommand->getReasonerTestfileTest()->getTestRequestFile();
61 LOG(INFO,getLogDomain(),logTr("Starting tests for testfile '%1'.").arg(testfile),this);
62 testFileTester->realizeTestCommand(testTestfileCommand,testErrorEvaluator);
63 CCommandExecutedBlocker::waitExecutedCommand(testTestfileCommand);
64 // go sure that thread doesn't operate on command any more
65 testFileTester->waitSynchronization();
66 qint64 testTimeElapsed = testTimer.elapsed();
67 LOG(INFO,getLogDomain(),logTr("Testing testfile '%1' takes %2 ms.").arg(testfile).arg(testTimeElapsed),this);
68 }
69 subCommandIt = subCommandIt->getNext();
70 }
71
72 qint64 totalTestTimeElapsed = totalTestTimer.elapsed();
73 testsuiteTest->getTestsuiteResult()->setTotalTestingTime(totalTestTimeElapsed);
74
75
76 CStopProcessCommandRecord::makeRecord(&commandRecordRouter);
77 CFinishProcessCommandRecord::makeRecord(&commandRecordRouter);
78 return this;
79 }
80
81
82 }; // end namespace Test
83
84 }; // end namespace Konclude