mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:42:57 +00:00
- hardcode the bios directory on linux system to /usr/share/qemu
- store the pid.txt in ROS_OUTPUT - check on linux system if the emulator was successfully launched svn path=/trunk/; revision=28787
This commit is contained in:
parent
3a3645aa1e
commit
b57a996929
2 changed files with 30 additions and 6 deletions
|
@ -230,6 +230,7 @@ namespace Sysreg_
|
||||||
bool RosBootTest::createBootCmd()
|
bool RosBootTest::createBootCmd()
|
||||||
{
|
{
|
||||||
string pipe;
|
string pipe;
|
||||||
|
string qemudir;
|
||||||
|
|
||||||
if (m_MaxMem.length() == 0)
|
if (m_MaxMem.length() == 0)
|
||||||
{
|
{
|
||||||
|
@ -240,15 +241,16 @@ namespace Sysreg_
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
pipe = _T("stdio");
|
pipe = _T("stdio");
|
||||||
m_Src = _T("");
|
m_Src = _T("");
|
||||||
|
qemudir = _T("/usr/share/qemu");
|
||||||
#else
|
#else
|
||||||
pipe = _T("pipe:qemu");
|
pipe = _T("pipe:qemu");
|
||||||
m_Src = _T("\\\\.\\pipe\\qemu");
|
m_Src = _T("\\\\.\\pipe\\qemu");
|
||||||
#endif
|
|
||||||
string qemudir;
|
|
||||||
if (!getQemuDir(qemudir))
|
if (!getQemuDir(qemudir))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
m_BootCmd = m_EmuPath + _T(" -L ") + qemudir + _T(" -m ") + m_MaxMem + _T(" -hda ") + m_HDDImage + _T(" -serial ") + pipe;
|
m_BootCmd = m_EmuPath + _T(" -L ") + qemudir + _T(" -m ") + m_MaxMem + _T(" -hda ") + m_HDDImage + _T(" -serial ") + pipe;
|
||||||
|
|
||||||
|
@ -268,7 +270,11 @@ namespace Sysreg_
|
||||||
* to terminate the emulator in case of errors
|
* to terminate the emulator in case of errors
|
||||||
* on windows we can get pid as return of CreateProcess
|
* on windows we can get pid as return of CreateProcess
|
||||||
*/
|
*/
|
||||||
m_BootCmd += _T(" -pidfile pid.txt");
|
m_PidFile = _T("output-i386");
|
||||||
|
EnvironmentVariable::getValue(_T("ROS_OUTPUT"), pid);
|
||||||
|
m_PidFile += _T("/pid.txt");
|
||||||
|
m_BootCmd += _T(" -pidfile ");
|
||||||
|
m_BootCmd += m_PidFile;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_BootCmd += _T(" -no-reboot ");
|
m_BootCmd += _T(" -no-reboot ");
|
||||||
|
@ -478,11 +484,11 @@ namespace Sysreg_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << "Opening Data Source:" << m_BootCmd << endl;
|
cerr << "Opening Data Source:" << m_BootCmd << endl;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
|
_tremove(m_PidFile.c_str ());
|
||||||
m_DataSource = new PipeReader();
|
m_DataSource = new PipeReader();
|
||||||
m_Src = m_BootCmd;
|
m_Src = m_BootCmd;
|
||||||
#else
|
#else
|
||||||
|
@ -539,6 +545,7 @@ namespace Sysreg_
|
||||||
{
|
{
|
||||||
m_DataSource->closeSource();
|
m_DataSource->closeSource();
|
||||||
OsSupport::sleep(3 * CLOCKS_PER_SEC);
|
OsSupport::sleep(3 * CLOCKS_PER_SEC);
|
||||||
|
|
||||||
if (m_Pid)
|
if (m_Pid)
|
||||||
{
|
{
|
||||||
OsSupport::terminateProcess (m_Pid);
|
OsSupport::terminateProcess (m_Pid);
|
||||||
|
@ -597,9 +604,25 @@ namespace Sysreg_
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
OsSupport::sleep(1000);
|
||||||
|
#ifdef __LINUX__
|
||||||
|
|
||||||
#ifndef __LINUX__
|
FILE * file = fopen(m_PidFile.c_str(), "r");
|
||||||
OsSupport::sleep(3000); //FIXME
|
if (!file)
|
||||||
|
{
|
||||||
|
cerr << "Error: failed to launch emulator" << endl;
|
||||||
|
cleanup();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
char buffer[128];
|
||||||
|
if (!fread(buffer, sizeof(buffer), 1, file))
|
||||||
|
{
|
||||||
|
cerr << "Error: pid file w/o pid!!! " << endl;
|
||||||
|
cleanup();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_Pid = atoi(buffer);
|
||||||
|
fclose(file);
|
||||||
#endif
|
#endif
|
||||||
bool ret = analyzeDebugData();
|
bool ret = analyzeDebugData();
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
|
@ -156,6 +156,7 @@ protected:
|
||||||
string m_MaxMem;
|
string m_MaxMem;
|
||||||
string m_BootCmd;
|
string m_BootCmd;
|
||||||
string m_Src;
|
string m_Src;
|
||||||
|
string m_PidFile;
|
||||||
|
|
||||||
DataSource * m_DataSource;
|
DataSource * m_DataSource;
|
||||||
OsSupport::ProcessID m_Pid;
|
OsSupport::ProcessID m_Pid;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue