mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:33:01 +00:00
- implement a basic boot detection algorithm
- sysreg can now recognize some user mode detection and blue screen of deaths - a few timing issues have to be sorted out in order make deployment ready svn path=/trunk/; revision=24588
This commit is contained in:
parent
ee5b1449f9
commit
b75f825406
4 changed files with 99 additions and 21 deletions
|
@ -11,10 +11,17 @@
|
||||||
|
|
||||||
#include "rosboot_test.h"
|
#include "rosboot_test.h"
|
||||||
#include "pipe_reader.h"
|
#include "pipe_reader.h"
|
||||||
|
#include "sym_file.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Sysreg_
|
namespace Sysreg_
|
||||||
{
|
{
|
||||||
|
@ -32,8 +39,9 @@ namespace Sysreg_
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
using System_::PipeReader;
|
using System_::PipeReader;
|
||||||
|
using System_::SymbolFile;
|
||||||
|
|
||||||
string RosBootTest::VARIABLE_NAME = _T("ROSBOOT_CMD");
|
string RosBootTest::VARIABLE_NAME = _T("ROSBOOT_CMD");
|
||||||
string RosBootTest::CLASS_NAME = _T("rosboot");
|
string RosBootTest::CLASS_NAME = _T("rosboot");
|
||||||
|
@ -108,7 +116,7 @@ namespace Sysreg_
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
bool RosBootTest::checkDebugData(string debug_data)
|
bool RosBootTest::checkDebugData(vector<string> & debug_data)
|
||||||
{
|
{
|
||||||
///
|
///
|
||||||
/// FIXME
|
/// FIXME
|
||||||
|
@ -118,9 +126,71 @@ namespace Sysreg_
|
||||||
/// TBD the information needs to be written into an provided log object
|
/// TBD the information needs to be written into an provided log object
|
||||||
/// which writes the info into HTML/log / sends etc ....
|
/// which writes the info into HTML/log / sends etc ....
|
||||||
|
|
||||||
// cerr << debug_data << endl;
|
bool clear = true;
|
||||||
return true;
|
|
||||||
|
|
||||||
|
for(size_t i = 0; i < debug_data.size();i++)
|
||||||
|
{
|
||||||
|
string line = debug_data[i];
|
||||||
|
|
||||||
|
if (line.find (_T("*** Fatal System Error")) != string::npos)
|
||||||
|
{
|
||||||
|
cerr << "BSOD detected" <<endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (line.find (_T("Unhandled exception")) != string::npos)
|
||||||
|
{
|
||||||
|
if (i + 3 >= debug_data.size ())
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// missing information is cut off -> try reconstruct at next call
|
||||||
|
///
|
||||||
|
clear = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cerr << "UM detected" <<endl;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// extract address from next line
|
||||||
|
///
|
||||||
|
|
||||||
|
string address = debug_data[i+2];
|
||||||
|
string::size_type pos = address.find_last_of (_T(" "));
|
||||||
|
address = address.substr (pos, address.length () - 1 - pos);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// extract module name
|
||||||
|
///
|
||||||
|
string modulename = debug_data[i+3];
|
||||||
|
pos = modulename.find_last_of (_T("\\"));
|
||||||
|
modulename = modulename.substr (pos + 1, modulename.length () - pos);
|
||||||
|
pos = modulename.find_last_of (_T("."));
|
||||||
|
modulename = modulename.substr (0, pos);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// resolve address
|
||||||
|
///
|
||||||
|
string result;
|
||||||
|
result.reserve (200);
|
||||||
|
|
||||||
|
SymbolFile::resolveAddress (modulename, address, result);
|
||||||
|
cerr << result << endl;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// TODO
|
||||||
|
///
|
||||||
|
/// resolve frame addresses
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clear)
|
||||||
|
{
|
||||||
|
debug_data.clear ();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
bool RosBootTest::isTimeout(double max_timeout)
|
bool RosBootTest::isTimeout(double max_timeout)
|
||||||
|
@ -150,7 +220,6 @@ namespace Sysreg_
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
bool RosBootTest::fetchDebugByPipe(string boot_cmd)
|
bool RosBootTest::fetchDebugByPipe(string boot_cmd)
|
||||||
{
|
{
|
||||||
struct timeval ts;
|
|
||||||
PipeReader pipe_reader;
|
PipeReader pipe_reader;
|
||||||
|
|
||||||
if (!pipe_reader.openPipe(boot_cmd, string(_T("rt"))))
|
if (!pipe_reader.openPipe(boot_cmd, string(_T("rt"))))
|
||||||
|
@ -159,9 +228,10 @@ namespace Sysreg_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string Buffer;
|
string Buffer;
|
||||||
Buffer.reserve (10000);
|
Buffer.reserve (500);
|
||||||
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
vector<string> vect;
|
||||||
|
|
||||||
while(!pipe_reader.isEof ())
|
while(!pipe_reader.isEof ())
|
||||||
{
|
{
|
||||||
|
@ -170,11 +240,11 @@ namespace Sysreg_
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
string::size_type size = pipe_reader.readPipe (Buffer);
|
pipe_reader.readPipe (Buffer);
|
||||||
cerr << "XXXsize_type " << size <<endl;
|
vect.push_back (Buffer);
|
||||||
|
|
||||||
|
|
||||||
if (!checkDebugData(Buffer))
|
if (!checkDebugData(vect))
|
||||||
{
|
{
|
||||||
ret = false;
|
ret = false;
|
||||||
break;
|
break;
|
||||||
|
@ -194,6 +264,12 @@ namespace Sysreg_
|
||||||
cerr << "Error: failed to open pipe with cmd: " << boot_cmd << endl;
|
cerr << "Error: failed to open pipe with cmd: " << boot_cmd << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXXME
|
||||||
|
// give the emulator some time to load freeloadr
|
||||||
|
_sleep( (clock_t)4 * CLOCKS_PER_SEC );
|
||||||
|
|
||||||
|
|
||||||
FILE * file = _tfopen(debug_log.c_str (), _T("rt"));
|
FILE * file = _tfopen(debug_log.c_str (), _T("rt"));
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
|
@ -202,15 +278,18 @@ namespace Sysreg_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TCHAR szBuffer[500];
|
TCHAR szBuffer[150];
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
vector<string> vect;
|
||||||
|
|
||||||
while(!pipe_reader.isEof ())
|
while(!pipe_reader.isEof ())
|
||||||
{
|
{
|
||||||
if (_fgetts(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), file))
|
if (_fgetts(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), file))
|
||||||
{
|
{
|
||||||
string buffer = szBuffer;
|
string line = szBuffer;
|
||||||
if (!checkDebugData(buffer))
|
vect.push_back (line);
|
||||||
|
|
||||||
|
if (!checkDebugData(vect))
|
||||||
{
|
{
|
||||||
ret = false;
|
ret = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,10 +12,12 @@
|
||||||
|
|
||||||
|
|
||||||
#include "reg_test.h"
|
#include "reg_test.h"
|
||||||
#include <winsock2.h>
|
#include <vector>
|
||||||
|
|
||||||
namespace Sysreg_
|
namespace Sysreg_
|
||||||
{
|
{
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
/// class RosBootTest
|
/// class RosBootTest
|
||||||
|
@ -100,7 +102,7 @@ namespace Sysreg_
|
||||||
/// Note: the received debug information should be written to an internal log object
|
/// Note: the received debug information should be written to an internal log object
|
||||||
/// to facilate post-processing of the results
|
/// to facilate post-processing of the results
|
||||||
|
|
||||||
bool checkDebugData(string debug_data);
|
bool checkDebugData(vector<string> & debug_data);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
|
|
@ -170,13 +170,10 @@ namespace System_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string pipe_cmd = m_SymResolver;
|
TCHAR szCmd[300];
|
||||||
pipe_cmd += _T("--exe=");
|
|
||||||
pipe_cmd += it->second;
|
|
||||||
|
|
||||||
pipe_cmd += _T(" ");
|
|
||||||
pipe_cmd += module_address;
|
|
||||||
|
|
||||||
|
_stprintf(szCmd, _T("%s --exe=%s %s"), m_SymResolver.c_str (), it->second.c_str (), module_address.c_str());
|
||||||
|
string pipe_cmd(szCmd);
|
||||||
|
|
||||||
PipeReader pipe_reader;
|
PipeReader pipe_reader;
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ int _tmain(int argc, TCHAR * argv[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout << "The regression test " << regtest->getName () << "failed" << endl;
|
cout << "The regression test " << regtest->getName () << " failed" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue