/* Wait till this process ended */
if(WaitForSingleObject(Process.GetProcessHandle(), ListTimeout) == WAIT_FAILED)
- FATAL("WaitForSingleObject failed for the test list\n");
+ TESTEXCEPTION("WaitForSingleObject failed for the test list\n");
}
/* Read the output data into a buffer */
if(!Pipe.Peek(NULL, 0, NULL, &BytesAvailable))
- FATAL("CPipe::Peek failed for the test list\n");
+ TESTEXCEPTION("CPipe::Peek failed for the test list\n");
/* Check if we got any */
if(!BytesAvailable)
stringstream ss;
ss << "The --list command did not return any data for " << UnicodeToAscii(m_CurrentFile) << endl;
- SSEXCEPTION;
+ TESTEXCEPTION(ss.str());
}
/* Read the data */
m_ListBuffer = new char[BytesAvailable];
if(!Pipe.Read(m_ListBuffer, BytesAvailable, &Temp))
- FATAL("CPipe::Read failed\n");
+ TESTEXCEPTION("CPipe::Read failed\n");
return BytesAvailable;
}
{
while(!m_CurrentFile.empty() || GetNextFile())
{
- while(GetNextTest())
+ try
{
- /* If the user specified a test through the command line, check this here */
- if(!Configuration.GetTest().empty() && Configuration.GetTest() != m_CurrentTest)
- continue;
-
+ while(GetNextTest())
{
- auto_ptr<CTestInfo> TestInfo(new CTestInfo());
- size_t UnderscorePosition;
+ /* If the user specified a test through the command line, check this here */
+ if(!Configuration.GetTest().empty() && Configuration.GetTest() != m_CurrentTest)
+ continue;
- /* Build the command line */
- TestInfo->CommandLine = m_TestPath;
- TestInfo->CommandLine += m_CurrentFile;
- TestInfo->CommandLine += ' ';
- TestInfo->CommandLine += AsciiToUnicode(m_CurrentTest);
+ {
+ auto_ptr<CTestInfo> TestInfo(new CTestInfo());
+ size_t UnderscorePosition;
- /* Store the Module name */
- UnderscorePosition = m_CurrentFile.find_last_of('_');
+ /* Build the command line */
+ TestInfo->CommandLine = m_TestPath;
+ TestInfo->CommandLine += m_CurrentFile;
+ TestInfo->CommandLine += ' ';
+ TestInfo->CommandLine += AsciiToUnicode(m_CurrentTest);
- if(UnderscorePosition == m_CurrentFile.npos)
- {
- stringstream ss;
+ /* Store the Module name */
+ UnderscorePosition = m_CurrentFile.find_last_of('_');
- ss << "Invalid test file name: " << UnicodeToAscii(m_CurrentFile) << endl;
- SSEXCEPTION;
- }
+ if(UnderscorePosition == m_CurrentFile.npos)
+ {
+ stringstream ss;
+
+ ss << "Invalid test file name: " << UnicodeToAscii(m_CurrentFile) << endl;
+ SSEXCEPTION;
+ }
- TestInfo->Module = UnicodeToAscii(m_CurrentFile.substr(0, UnderscorePosition));
+ TestInfo->Module = UnicodeToAscii(m_CurrentFile.substr(0, UnderscorePosition));
- /* Store the test */
- TestInfo->Test = m_CurrentTest;
+ /* Store the test */
+ TestInfo->Test = m_CurrentTest;
- return TestInfo.release();
+ return TestInfo.release();
+ }
}
}
+ catch(CTestException& e)
+ {
+ delete[] m_ListBuffer;
+ StringOut(e.GetMessage());
+ m_CurrentFile.clear();
+ }
}
return NULL;
StartTime = GetTickCount();
+ try
{
/* Execute the test */
CPipedProcess Process(TestInfo->CommandLine, Pipe);
TestInfo->Log += Buffer;
}
if(GetLastError() != ERROR_BROKEN_PIPE)
- FATAL("CPipe::Read failed for the test run\n");
+ TESTEXCEPTION("CPipe::Read failed for the test run\n");
+ }
+ catch(CTestException& e)
+ {
+ if(!tailString.empty())
+ StringOut(tailString);
+ tailString.clear();
+ StringOut(e.GetMessage());
+ TestInfo->Log += e.GetMessage();
}
/* Print what's left */
ssFinish << "Test " << TestInfo->Test << " completed in ";
ssFinish << setprecision(2) << fixed << TotalTime << " seconds." << endl;
StringOut(ssFinish.str());
+ TestInfo->Log += ssFinish.str();
}
/**