mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:31:40 +00:00
[ROSAUTOTEST]
- Continue the testing process in case a test fails to execute ONLINE-441 svn path=/trunk/; revision=66504
This commit is contained in:
parent
5dfd2fc11e
commit
b3777ffecc
6 changed files with 72 additions and 39 deletions
|
@ -23,7 +23,7 @@ CProcess::CProcess(const wstring& CommandLine, LPSTARTUPINFOW StartupInfo)
|
||||||
wcscpy(CommandLinePtr, CommandLine.c_str());
|
wcscpy(CommandLinePtr, CommandLine.c_str());
|
||||||
|
|
||||||
if(!CreateProcessW(NULL, CommandLinePtr, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, StartupInfo, &m_ProcessInfo))
|
if(!CreateProcessW(NULL, CommandLinePtr, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, StartupInfo, &m_ProcessInfo))
|
||||||
FATAL("CreateProcessW failed\n");
|
TESTEXCEPTION("CreateProcessW failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
* You should always use the EXCEPTION or SSEXCEPTION macro for throwing this exception.
|
* You should always use the EXCEPTION or SSEXCEPTION macro for throwing this exception.
|
||||||
*
|
*
|
||||||
* @param Message
|
* @param Message
|
||||||
* Constant pointer to a char array containing a short message about the exception
|
* String containing a short message about the exception
|
||||||
*/
|
*/
|
||||||
CSimpleException::CSimpleException(const char* Message)
|
CSimpleException::CSimpleException(const string& Message)
|
||||||
: m_Message(Message)
|
: m_Message(Message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ private:
|
||||||
string m_Message;
|
string m_Message;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSimpleException(const char* Message);
|
CSimpleException(const string& Message);
|
||||||
|
|
||||||
const string& GetMessage() const { return m_Message; }
|
const string& GetMessage() const { return m_Message; }
|
||||||
};
|
};
|
||||||
|
|
12
rostests/rosautotest/CTestException.h
Normal file
12
rostests/rosautotest/CTestException.h
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS Automatic Testing Utility
|
||||||
|
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||||
|
* PURPOSE: Simple exception during test execution that can be skipped over
|
||||||
|
* COPYRIGHT: Copyright 2015 Thomas Faber <thomas.faber@reactos.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CTestException : public CSimpleException
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CTestException(const string& Message) : CSimpleException(Message) { }
|
||||||
|
};
|
|
@ -121,12 +121,12 @@ CWineTest::DoListCommand()
|
||||||
|
|
||||||
/* Wait till this process ended */
|
/* Wait till this process ended */
|
||||||
if(WaitForSingleObject(Process.GetProcessHandle(), ListTimeout) == WAIT_FAILED)
|
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 */
|
/* Read the output data into a buffer */
|
||||||
if(!Pipe.Peek(NULL, 0, NULL, &BytesAvailable))
|
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 */
|
/* Check if we got any */
|
||||||
if(!BytesAvailable)
|
if(!BytesAvailable)
|
||||||
|
@ -134,14 +134,14 @@ CWineTest::DoListCommand()
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
|
|
||||||
ss << "The --list command did not return any data for " << UnicodeToAscii(m_CurrentFile) << endl;
|
ss << "The --list command did not return any data for " << UnicodeToAscii(m_CurrentFile) << endl;
|
||||||
SSEXCEPTION;
|
TESTEXCEPTION(ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the data */
|
/* Read the data */
|
||||||
m_ListBuffer = new char[BytesAvailable];
|
m_ListBuffer = new char[BytesAvailable];
|
||||||
|
|
||||||
if(!Pipe.Read(m_ListBuffer, BytesAvailable, &Temp))
|
if(!Pipe.Read(m_ListBuffer, BytesAvailable, &Temp))
|
||||||
FATAL("CPipe::Read failed\n");
|
TESTEXCEPTION("CPipe::Read failed\n");
|
||||||
|
|
||||||
return BytesAvailable;
|
return BytesAvailable;
|
||||||
}
|
}
|
||||||
|
@ -208,41 +208,50 @@ CWineTest::GetNextTestInfo()
|
||||||
{
|
{
|
||||||
while(!m_CurrentFile.empty() || GetNextFile())
|
while(!m_CurrentFile.empty() || GetNextFile())
|
||||||
{
|
{
|
||||||
while(GetNextTest())
|
try
|
||||||
{
|
{
|
||||||
/* If the user specified a test through the command line, check this here */
|
while(GetNextTest())
|
||||||
if(!Configuration.GetTest().empty() && Configuration.GetTest() != m_CurrentTest)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto_ptr<CTestInfo> TestInfo(new CTestInfo());
|
/* If the user specified a test through the command line, check this here */
|
||||||
size_t UnderscorePosition;
|
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);
|
|
||||||
|
|
||||||
/* Store the Module name */
|
|
||||||
UnderscorePosition = m_CurrentFile.find_last_of('_');
|
|
||||||
|
|
||||||
if(UnderscorePosition == m_CurrentFile.npos)
|
|
||||||
{
|
{
|
||||||
stringstream ss;
|
auto_ptr<CTestInfo> TestInfo(new CTestInfo());
|
||||||
|
size_t UnderscorePosition;
|
||||||
|
|
||||||
ss << "Invalid test file name: " << UnicodeToAscii(m_CurrentFile) << endl;
|
/* Build the command line */
|
||||||
SSEXCEPTION;
|
TestInfo->CommandLine = m_TestPath;
|
||||||
|
TestInfo->CommandLine += m_CurrentFile;
|
||||||
|
TestInfo->CommandLine += ' ';
|
||||||
|
TestInfo->CommandLine += AsciiToUnicode(m_CurrentTest);
|
||||||
|
|
||||||
|
/* Store the Module name */
|
||||||
|
UnderscorePosition = m_CurrentFile.find_last_of('_');
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
/* Store the test */
|
||||||
|
TestInfo->Test = m_CurrentTest;
|
||||||
|
|
||||||
|
return TestInfo.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
TestInfo->Module = UnicodeToAscii(m_CurrentFile.substr(0, UnderscorePosition));
|
|
||||||
|
|
||||||
/* Store the test */
|
|
||||||
TestInfo->Test = m_CurrentTest;
|
|
||||||
|
|
||||||
return TestInfo.release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(CTestException& e)
|
||||||
|
{
|
||||||
|
delete[] m_ListBuffer;
|
||||||
|
StringOut(e.GetMessage());
|
||||||
|
m_CurrentFile.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -271,6 +280,7 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
||||||
|
|
||||||
StartTime = GetTickCount();
|
StartTime = GetTickCount();
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/* Execute the test */
|
/* Execute the test */
|
||||||
CPipedProcess Process(TestInfo->CommandLine, Pipe);
|
CPipedProcess Process(TestInfo->CommandLine, Pipe);
|
||||||
|
@ -286,7 +296,15 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
||||||
TestInfo->Log += Buffer;
|
TestInfo->Log += Buffer;
|
||||||
}
|
}
|
||||||
if(GetLastError() != ERROR_BROKEN_PIPE)
|
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 */
|
/* Print what's left */
|
||||||
|
@ -297,6 +315,7 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
||||||
ssFinish << "Test " << TestInfo->Test << " completed in ";
|
ssFinish << "Test " << TestInfo->Test << " completed in ";
|
||||||
ssFinish << setprecision(2) << fixed << TotalTime << " seconds." << endl;
|
ssFinish << setprecision(2) << fixed << TotalTime << " seconds." << endl;
|
||||||
StringOut(ssFinish.str());
|
StringOut(ssFinish.str());
|
||||||
|
TestInfo->Log += ssFinish.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,6 +34,7 @@ using namespace std;
|
||||||
#include "CProcess.h"
|
#include "CProcess.h"
|
||||||
#include "CPipedProcess.h"
|
#include "CPipedProcess.h"
|
||||||
#include "CSimpleException.h"
|
#include "CSimpleException.h"
|
||||||
|
#include "CTestException.h"
|
||||||
#include "CTestInfo.h"
|
#include "CTestInfo.h"
|
||||||
#include "CTest.h"
|
#include "CTest.h"
|
||||||
#include "CTestList.h"
|
#include "CTestList.h"
|
||||||
|
@ -45,9 +46,10 @@ using namespace std;
|
||||||
#include <rosautotestmsg.h>
|
#include <rosautotestmsg.h>
|
||||||
|
|
||||||
/* Useful macros */
|
/* Useful macros */
|
||||||
#define EXCEPTION(Message) throw CSimpleException(Message)
|
#define EXCEPTION(Message) throw CSimpleException(Message)
|
||||||
#define FATAL(Message) throw CFatalException(__FILE__, __LINE__, Message)
|
#define FATAL(Message) throw CFatalException(__FILE__, __LINE__, Message)
|
||||||
#define SSEXCEPTION throw CSimpleException(ss.str().c_str())
|
#define SSEXCEPTION throw CSimpleException(ss.str())
|
||||||
|
#define TESTEXCEPTION(Message) throw CTestException(Message)
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
extern CConfiguration Configuration;
|
extern CConfiguration Configuration;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue