[ros-diffs] [janderwald] 28787: - 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

janderwald at svn.reactos.org janderwald at svn.reactos.org
Sun Sep 2 23:11:12 CEST 2007


Author: janderwald
Date: Mon Sep  3 01:11:12 2007
New Revision: 28787

URL: http://svn.reactos.org/svn/reactos?rev=28787&view=rev
Log:
- 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

Modified:
    trunk/reactos/tools/sysreg/rosboot_test.cpp
    trunk/reactos/tools/sysreg/rosboot_test.h

Modified: trunk/reactos/tools/sysreg/rosboot_test.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.cpp?rev=28787&r1=28786&r2=28787&view=diff
==============================================================================
--- trunk/reactos/tools/sysreg/rosboot_test.cpp (original)
+++ trunk/reactos/tools/sysreg/rosboot_test.cpp Mon Sep  3 01:11:12 2007
@@ -230,6 +230,7 @@
     bool RosBootTest::createBootCmd()
     {
         string pipe;
+        string qemudir;
 
         if (m_MaxMem.length() == 0)
         {
@@ -240,15 +241,16 @@
 #ifdef __LINUX__
 		pipe = _T("stdio");
 		m_Src = _T("");
+        qemudir = _T("/usr/share/qemu");
 #else		
 		pipe = _T("pipe:qemu");
 		m_Src = _T("\\\\.\\pipe\\qemu");
+        if (!getQemuDir(qemudir))
+        {
+            return false;
+        }
 #endif	 
-        string qemudir;
-        if (!getQemuDir(qemudir))
-        {
-            return false;
-        }
+
         
         m_BootCmd = m_EmuPath + _T(" -L ") + qemudir + _T(" -m ") + m_MaxMem + _T(" -hda ") + m_HDDImage + _T(" -serial ") + pipe;
 
@@ -268,7 +270,11 @@
                  * to terminate the emulator in case of errors
                  * 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
 
         m_BootCmd += _T(" -no-reboot ");
@@ -478,11 +484,11 @@
                 return false;
             }
         }
- 
         cerr << "Opening Data Source:" << m_BootCmd << endl;
 
 
 #ifdef __LINUX__
+        _tremove(m_PidFile.c_str ());
         m_DataSource = new PipeReader();
         m_Src = m_BootCmd;
 #else
@@ -539,6 +545,7 @@
 	{
         m_DataSource->closeSource();
         OsSupport::sleep(3 * CLOCKS_PER_SEC);
+
         if (m_Pid)
         {
 			OsSupport::terminateProcess (m_Pid);
@@ -597,9 +604,25 @@
             cleanup();
             return false;
         }
-
-#ifndef __LINUX__
-        OsSupport::sleep(3000); //FIXME
+        OsSupport::sleep(1000); 
+#ifdef __LINUX__
+
+        FILE * file = fopen(m_PidFile.c_str(), "r");
+        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
         bool ret = analyzeDebugData();
 	cleanup();

Modified: trunk/reactos/tools/sysreg/rosboot_test.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.h?rev=28787&r1=28786&r2=28787&view=diff
==============================================================================
--- trunk/reactos/tools/sysreg/rosboot_test.h (original)
+++ trunk/reactos/tools/sysreg/rosboot_test.h Mon Sep  3 01:11:12 2007
@@ -156,6 +156,7 @@
     string m_MaxMem;
     string m_BootCmd;
     string m_Src;
+    string m_PidFile;
 
     DataSource * m_DataSource;
     OsSupport::ProcessID m_Pid;




More information about the Ros-diffs mailing list