mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 16:55:56 +00:00
[ROSAUTOTEST]
If the last chunk of the string sent to StringOut isn't a whole line and forcePrint is set to false, send back what's left after processing. The caller is then responsible for prepending that string next time it calls StringOut. Should fix the rest of debug log corruptions. svn path=/trunk/; revision=55670
This commit is contained in:
parent
c0f7614fb0
commit
04135b7ce4
7 changed files with 40 additions and 25 deletions
|
@ -144,7 +144,7 @@ CJournaledTestList::WriteInitialJournalFile()
|
|||
CTestInfo* TestInfo;
|
||||
DWORD BytesWritten;
|
||||
|
||||
StringOut("Writing initial journal file...\n\n");
|
||||
StringOut("Writing initial journal file...\n\n", TRUE);
|
||||
|
||||
m_ListIterator = 0;
|
||||
|
||||
|
@ -189,7 +189,7 @@ CJournaledTestList::LoadJournalFile()
|
|||
DWORD BytesRead;
|
||||
DWORD RemainingSize;
|
||||
|
||||
StringOut("Loading journal file...\n\n");
|
||||
StringOut("Loading journal file...\n\n", TRUE);
|
||||
|
||||
OpenJournal(GENERIC_READ);
|
||||
RemainingSize = GetFileSize(m_hJournal, NULL);
|
||||
|
|
|
@ -207,7 +207,7 @@ CWebService::Submit(const char* TestType, CTestInfo* TestInfo)
|
|||
Response.reset(DoRequest(Data));
|
||||
|
||||
ss << "The server responded:" << endl << Response << endl;
|
||||
StringOut(ss.str());
|
||||
StringOut(ss.str(), TRUE);
|
||||
|
||||
if(strcmp(Response, "OK"))
|
||||
EXCEPTION("Aborted!\n");
|
||||
|
|
|
@ -266,9 +266,10 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
|||
stringstream ss, ssFinish;
|
||||
DWORD StartTime = GetTickCount();
|
||||
float TotalTime;
|
||||
string tailString;
|
||||
|
||||
ss << "Running Wine Test, Module: " << TestInfo->Module << ", Test: " << TestInfo->Test << endl;
|
||||
StringOut(ss.str());
|
||||
StringOut(ss.str(), TRUE);
|
||||
|
||||
StartTime = GetTickCount();
|
||||
|
||||
|
@ -299,9 +300,9 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
|||
if(!ReadFile(m_hReadPipe, Buffer, BytesAvailable, &Temp, NULL))
|
||||
FATAL("ReadFile failed for the test run\n");
|
||||
|
||||
/* Output all test output through StringOut, even while the test is still running */
|
||||
/* Output text through StringOut, even while the test is still running */
|
||||
Buffer[BytesAvailable] = 0;
|
||||
StringOut(string(Buffer));
|
||||
tailString = StringOut(tailString.append(string(Buffer)), FALSE);
|
||||
|
||||
if(Configuration.DoSubmit())
|
||||
TestInfo->Log += Buffer;
|
||||
|
@ -310,10 +311,14 @@ CWineTest::RunTest(CTestInfo* TestInfo)
|
|||
while(!BreakLoop);
|
||||
}
|
||||
|
||||
/* Print what's left */
|
||||
if(!tailString.empty())
|
||||
StringOut(tailString, TRUE);
|
||||
|
||||
TotalTime = ((float)GetTickCount() - StartTime)/1000;
|
||||
ssFinish << "Test " << TestInfo->Test << " completed in ";
|
||||
ssFinish << setprecision(2) << fixed << TotalTime << " seconds." << endl;
|
||||
StringOut(ssFinish.str());
|
||||
StringOut(ssFinish.str(), TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -370,6 +375,6 @@ CWineTest::Run()
|
|||
if(Configuration.DoSubmit() && !TestInfo->Log.empty())
|
||||
WebService->Submit("wine", TestInfo);
|
||||
|
||||
StringOut("\n\n");
|
||||
StringOut("\n\n", TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ wmain(int argc, wchar_t* argv[])
|
|||
|
||||
ss << "\n\nSystem uptime " << setprecision(2) << fixed ;
|
||||
ss << ((float)GetTickCount()/1000) << " seconds\n";
|
||||
StringOut(ss.str());
|
||||
StringOut(ss.str(), TRUE);
|
||||
|
||||
/* Run the tests */
|
||||
WineTest.Run();
|
||||
|
@ -76,7 +76,7 @@ wmain(int argc, wchar_t* argv[])
|
|||
}
|
||||
catch(CSimpleException& e)
|
||||
{
|
||||
StringOut(e.GetMessage());
|
||||
StringOut(e.GetMessage(), TRUE);
|
||||
}
|
||||
catch(CFatalException& e)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ wmain(int argc, wchar_t* argv[])
|
|||
<< "File: " << e.GetFile() << endl
|
||||
<< "Line: " << e.GetLine() << endl
|
||||
<< "Last Win32 Error: " << GetLastError() << endl;
|
||||
StringOut(ss.str());
|
||||
StringOut(ss.str(), TRUE);
|
||||
}
|
||||
|
||||
/* For sysreg2 to notice if rosautotest itself failed */
|
||||
|
|
|
@ -51,7 +51,7 @@ string EscapeString(const char* Input);
|
|||
string EscapeString(const string& Input);
|
||||
string GetINIValue(PCWCH AppName, PCWCH KeyName, PCWCH FileName);
|
||||
bool IsNumber(const char* Input);
|
||||
void StringOut(const string& String);
|
||||
string StringOut(const string& String, const BOOL forcePrint);
|
||||
string UnicodeToAscii(PCWSTR UnicodeString);
|
||||
string UnicodeToAscii(const wstring& UnicodeString);
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@ bool ShutdownSystem()
|
|||
|
||||
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
|
||||
{
|
||||
StringOut("OpenProcessToken failed\n");
|
||||
StringOut("OpenProcessToken failed\n", TRUE);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get the LUID for the Shutdown privilege */
|
||||
if (!LookupPrivilegeValueW(NULL, SE_SHUTDOWN_NAME, &Privileges.Privileges[0].Luid))
|
||||
{
|
||||
StringOut("LookupPrivilegeValue failed\n");
|
||||
StringOut("LookupPrivilegeValue failed\n", TRUE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -37,14 +37,14 @@ bool ShutdownSystem()
|
|||
|
||||
if (!AdjustTokenPrivileges(hToken, FALSE, &Privileges, 0, NULL, NULL))
|
||||
{
|
||||
StringOut("AdjustTokenPrivileges failed\n");
|
||||
StringOut("AdjustTokenPrivileges failed\n", TRUE);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Finally shut down the system */
|
||||
if(!ExitWindowsEx(EWX_POWEROFF, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED))
|
||||
{
|
||||
StringOut("ExitWindowsEx failed\n");
|
||||
StringOut("ExitWindowsEx failed\n", TRUE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ IsNumber(const char* Input)
|
|||
* @param String
|
||||
* The std::string to output
|
||||
*/
|
||||
void
|
||||
StringOut(const string& String)
|
||||
string
|
||||
StringOut(const string& String, const BOOL forcePrint)
|
||||
{
|
||||
char DbgString[DBGPRINT_BUFSIZE + 1];
|
||||
size_t i, start = 0, last_newline = 0, size = 0, curr_pos = 0;
|
||||
|
@ -122,7 +122,7 @@ StringOut(const string& String)
|
|||
if((curr_pos - start) >= DBGPRINT_BUFSIZE)
|
||||
{
|
||||
/* No newlines so far, or the string just fits */
|
||||
if(last_newline <= start || (curr_pos - start) == DBGPRINT_BUFSIZE)
|
||||
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);
|
||||
|
@ -143,14 +143,24 @@ StringOut(const string& String)
|
|||
}
|
||||
}
|
||||
|
||||
/* The rest of the string is <= DBGPRINT_BUFSIZE so just print it*/
|
||||
size = curr_pos - start;
|
||||
memcpy(DbgString, NewString.c_str() + start, size);
|
||||
DbgString[size] = 0;
|
||||
DbgPrint(DbgString);
|
||||
|
||||
/* Output the string */
|
||||
cout << NewString;
|
||||
|
||||
size = curr_pos - start;
|
||||
|
||||
/* Only print if forced to or if the rest is a whole line */
|
||||
if(forcePrint == true || NewString[curr_pos - 1] == '\n')
|
||||
{
|
||||
memcpy(DbgString, NewString.c_str() + start, size);
|
||||
DbgString[size] = 0;
|
||||
DbgPrint(DbgString);
|
||||
|
||||
NewString.clear();
|
||||
return NewString;
|
||||
}
|
||||
|
||||
/* Return the remaining chunk */
|
||||
return NewString.substr(start, size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue