55#include < autotest/testtreemodel.h>
66
77#include < QDebug>
8+ #include < algorithm>
89
910using namespace Autotest ::Internal;
1011
@@ -36,6 +37,7 @@ void TmcResultReader::testProject(Project *project)
3637 qDebug () << " Testing project null!" ;
3738 return ;
3839 }
40+
3941 m_testResults.clear ();
4042 m_project = project;
4143 TestRunner *runner = TestRunner::instance ();
@@ -92,6 +94,14 @@ void TmcResultReader::readTestResult(const TestResultPtr &result) {
9294 // emit testResultReady(TmcTestResult(TmcResult::TestCaseEnd));
9395 break ;
9496
97+ case Result::MessageFatal:
98+ // Test runner has most likely crashed, mark the test as invalid
99+ m_openResult.setResult (TmcResult::Invalid);
100+ m_openResult.setMessage (" Test runner failed to run. It may have crashed or failed to build." );
101+ m_testResults.append (m_openResult);
102+ emit testResultReady (m_openResult);
103+ break ;
104+
95105 default :
96106 break ;
97107 }
@@ -104,16 +114,12 @@ void TmcResultReader::resultsReady() {
104114 return ;
105115 }
106116
107- bool testsPassed = true ;
108- foreach (TmcTestResult r, m_testResults) {
109- qDebug () << r.name () << r.result () << r.points ();
110- if (r.result () != TmcResult::Pass) {
111- testsPassed = false ;
112- }
113- }
114-
115117 emit testRunFinished ();
116118
119+ auto not_passing = std::find_if (m_testResults.begin (), m_testResults.end (),
120+ [](TmcTestResult r) { return r.result () != TmcResult::Pass; });
121+ bool testsPassed = not_passing == m_testResults.end ();
122+
117123 if (testsPassed) {
118124 qDebug (" Project tests passed" );
119125 emit projectTestsPassed (m_project);
0 commit comments