mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[ROSAUTOTEST]
- Revert r66855 to make the upcoming commit's diff show my actual changes. ROSTESTS-178 ROSTESTS-158 svn path=/trunk/; revision=68245
This commit is contained in:
parent
f710a888d6
commit
77ad885551
3 changed files with 73 additions and 22 deletions
|
@ -276,6 +276,7 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
||||||
stringstream ss, ssFinish;
|
stringstream ss, ssFinish;
|
||||||
DWORD StartTime;
|
DWORD StartTime;
|
||||||
float TotalTime;
|
float TotalTime;
|
||||||
|
string tailString;
|
||||||
CPipe Pipe;
|
CPipe Pipe;
|
||||||
char Buffer[1024];
|
char Buffer[1024];
|
||||||
|
|
||||||
|
@ -294,7 +295,7 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
||||||
{
|
{
|
||||||
/* Output text through StringOut, even while the test is still running */
|
/* Output text through StringOut, even while the test is still running */
|
||||||
Buffer[BytesAvailable] = 0;
|
Buffer[BytesAvailable] = 0;
|
||||||
StringOut(string(Buffer));
|
tailString = StringOut(tailString.append(string(Buffer)), false);
|
||||||
|
|
||||||
if(Configuration.DoSubmit())
|
if(Configuration.DoSubmit())
|
||||||
TestInfo->Log += Buffer;
|
TestInfo->Log += Buffer;
|
||||||
|
@ -304,10 +305,17 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
||||||
}
|
}
|
||||||
catch(CTestException& e)
|
catch(CTestException& e)
|
||||||
{
|
{
|
||||||
|
if(!tailString.empty())
|
||||||
|
StringOut(tailString);
|
||||||
|
tailString.clear();
|
||||||
StringOut(e.GetMessage());
|
StringOut(e.GetMessage());
|
||||||
TestInfo->Log += e.GetMessage();
|
TestInfo->Log += e.GetMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print what's left */
|
||||||
|
if(!tailString.empty())
|
||||||
|
StringOut(tailString);
|
||||||
|
|
||||||
TotalTime = ((float)GetTickCount() - StartTime)/1000;
|
TotalTime = ((float)GetTickCount() - StartTime)/1000;
|
||||||
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;
|
||||||
|
|
|
@ -69,7 +69,7 @@ string EscapeString(const char* Input);
|
||||||
string EscapeString(const string& Input);
|
string EscapeString(const string& Input);
|
||||||
string GetINIValue(PCWCH AppName, PCWCH KeyName, PCWCH FileName);
|
string GetINIValue(PCWCH AppName, PCWCH KeyName, PCWCH FileName);
|
||||||
bool IsNumber(const char* Input);
|
bool IsNumber(const char* Input);
|
||||||
void StringOut(const string& InputString);
|
string StringOut(const string& String, bool forcePrint = true);
|
||||||
string UnicodeToAscii(PCWSTR UnicodeString);
|
string UnicodeToAscii(PCWSTR UnicodeString);
|
||||||
string UnicodeToAscii(const wstring& UnicodeString);
|
string UnicodeToAscii(const wstring& UnicodeString);
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
* PROJECT: ReactOS Automatic Testing Utility
|
* PROJECT: ReactOS Automatic Testing Utility
|
||||||
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
||||||
* PURPOSE: Various helper functions
|
* PURPOSE: Various helper functions
|
||||||
* COPYRIGHT: Copyright 2008-2015 Colin Finck <colin@reactos.org>
|
* COPYRIGHT: Copyright 2008-2009 Colin Finck <colin@reactos.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
#define DBGPRINT_BUFSIZE 511
|
||||||
static const char HexCharacters[] = "0123456789ABCDEF";
|
static const char HexCharacters[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,43 +87,85 @@ IsNumber(const char* Input)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs a string through the standard output and the debug output.
|
* Outputs a string through the standard output and the debug output.
|
||||||
* The input string may have LF or CRLF line endings.
|
* The string may have LF or CRLF line endings.
|
||||||
*
|
*
|
||||||
* @param InputString
|
* @param String
|
||||||
* The std::string to output
|
* The std::string to output
|
||||||
*/
|
*/
|
||||||
void
|
string
|
||||||
StringOut(const string& InputString)
|
StringOut(const string& String, bool forcePrint)
|
||||||
{
|
{
|
||||||
const char* pInput = InputString.c_str();
|
char DbgString[DBGPRINT_BUFSIZE + 1];
|
||||||
char* OutputString = new char[InputString.size() + 1];
|
size_t i, start = 0, last_newline = 0, size = 0, curr_pos = 0;
|
||||||
char* pOutput = OutputString;
|
string NewString;
|
||||||
|
|
||||||
/* Unify the line endings (the piped output of the tests may use CRLF) */
|
/* Unify the line endings (the piped output of the tests may use CRLF) */
|
||||||
while (*pInput)
|
for(i = 0; i < String.size(); i++)
|
||||||
{
|
{
|
||||||
/* If this is a CRLF line-ending, only copy a \n to the new string and skip the next character */
|
/* If this is a CRLF line-ending, only copy a \n to the new string and skip the next character */
|
||||||
if (*pInput == '\r' && *(pInput + 1) == '\n')
|
if(String[i] == '\r' && String[i + 1] == '\n')
|
||||||
{
|
{
|
||||||
*pOutput = '\n';
|
NewString += '\n';
|
||||||
++pInput;
|
++i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pOutput = *pInput;
|
/* Otherwise copy the string */
|
||||||
|
NewString += String[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
++pInput;
|
curr_pos = NewString.size();
|
||||||
++pOutput;
|
|
||||||
|
/* Try to print whole lines but obey the 512 bytes chunk size limit*/
|
||||||
|
if(NewString[curr_pos - 1] == '\n' || (curr_pos - start) == DBGPRINT_BUFSIZE)
|
||||||
|
{
|
||||||
|
if((curr_pos - start) >= DBGPRINT_BUFSIZE)
|
||||||
|
{
|
||||||
|
/* No newlines so far, or the string just fits */
|
||||||
|
if(last_newline <= start || ((curr_pos - start == DBGPRINT_BUFSIZE) && NewString[curr_pos - 1] == '\n'))
|
||||||
|
{
|
||||||
|
size = curr_pos - start;
|
||||||
|
memcpy(DbgString, NewString.c_str() + start, size);
|
||||||
|
start = curr_pos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size = last_newline - start;
|
||||||
|
memcpy(DbgString, NewString.c_str() + start, size);
|
||||||
|
start = last_newline;
|
||||||
|
}
|
||||||
|
|
||||||
|
DbgString[size] = 0;
|
||||||
|
OutputDebugStringA(DbgString);
|
||||||
|
}
|
||||||
|
|
||||||
|
last_newline = curr_pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*pOutput = 0;
|
size = curr_pos - start;
|
||||||
OutputDebugStringA(OutputString);
|
|
||||||
|
|
||||||
if (Configuration.DoPrint())
|
/* Only print if forced to or if the rest is a whole line */
|
||||||
cout << OutputString << flush;
|
if(forcePrint == true || NewString[curr_pos - 1] == '\n')
|
||||||
|
{
|
||||||
|
/* Output the whole string */
|
||||||
|
if(Configuration.DoPrint())
|
||||||
|
cout << NewString;
|
||||||
|
|
||||||
delete[] OutputString;
|
memcpy(DbgString, NewString.c_str() + start, size);
|
||||||
|
DbgString[size] = 0;
|
||||||
|
OutputDebugStringA(DbgString);
|
||||||
|
|
||||||
|
NewString.clear();
|
||||||
|
return NewString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Output full lines only */
|
||||||
|
if(Configuration.DoPrint())
|
||||||
|
cout << NewString.substr(0, start);
|
||||||
|
|
||||||
|
/* Return the remaining chunk */
|
||||||
|
return NewString.substr(start, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue