Author: cwittich Date: Tue Sep 2 16:30:18 2008 New Revision: 35881
URL: http://svn.reactos.org/svn/reactos?rev=35881&view=rev Log: -hackfix 2nd and 3rd stage (setting boot dev to cdrom) -test all three stages -return the status (fail|success) in ProcessDebugData
Modified: trunk/tools/sysreg2/console.c trunk/tools/sysreg2/sysreg.h trunk/tools/sysreg2/virt.c
Modified: trunk/tools/sysreg2/console.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/console.c?rev=35881&a... ============================================================================== --- trunk/tools/sysreg2/console.c [iso-8859-1] (original) +++ trunk/tools/sysreg2/console.c [iso-8859-1] Tue Sep 2 16:30:18 2008 @@ -2,19 +2,20 @@ #include <termios.h> #include <poll.h>
-void ProcessDebugData(const char* tty, int timeout, int stage ) +bool ProcessDebugData(const char* tty, int timeout, int stage ) { int ttyfd, i; struct termios ttyattr, rawattr; + bool Ret = true;
if ((ttyfd = open(tty, O_NOCTTY | O_RDWR)) < 0) { printf("error opening tty\n"); - return; + return false; }
if (tcgetattr(STDIN_FILENO, &ttyattr) < 0) - return; + return false;
rawattr = ttyattr; rawattr.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP @@ -25,7 +26,7 @@ rawattr.c_cflag |= CS8;
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &rawattr) < 0) - return; + return false;
while (1) { @@ -46,6 +47,7 @@ { /* timeout */ printf("timeout\n"); + Ret = false; goto cleanup; }
@@ -59,10 +61,13 @@ int got, sent = 0;
got = read(fds[i].fd, buf, sizeof(buf)); - if (got < 0) + if (got < 0) { goto cleanup; + } if (!got || got == 1 && buf[0] == '\33') + { goto cleanup; + }
if (fds[i].fd != STDIN_FILENO) { @@ -72,6 +77,7 @@ if ((done = safewrite(STDOUT_FILENO, buf + sent, got -sent)) <= 0) { + Ret = false; goto cleanup; } sent += done; @@ -86,7 +92,6 @@ cleanup: tcsetattr(STDIN_FILENO, TCSAFLUSH, &ttyattr); close(ttyfd); - - + return Ret; }
Modified: trunk/tools/sysreg2/sysreg.h URL: http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/sysreg.h?rev=35881&am... ============================================================================== --- trunk/tools/sysreg2/sysreg.h [iso-8859-1] (original) +++ trunk/tools/sysreg2/sysreg.h [iso-8859-1] Tue Sep 2 16:30:18 2008 @@ -33,4 +33,4 @@ bool LoadSettings(const char* XmlConfig);
/* console.c */ -void ProcessDebugData(const char* tty, int timeout, int stage); +bool ProcessDebugData(const char* tty, int timeout, int stage);
Modified: trunk/tools/sysreg2/virt.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/virt.c?rev=35881&... ============================================================================== --- trunk/tools/sysreg2/virt.c [iso-8859-1] (original) +++ trunk/tools/sysreg2/virt.c [iso-8859-1] Tue Sep 2 16:30:18 2008 @@ -56,7 +56,7 @@ return false;
numids = virConnectListDomains(vConn, &ids[0], maxids); - if (numids > -1) + if (numids > -1) { int i; for(i=0; i<numids; i++) @@ -139,17 +139,18 @@ { virConnectPtr vConn; virDomainPtr vDom; - virDomainInfo info; + virDomainInfo info; int Stage; - int Stages = 1; /* 1 for testing, should be set to 3 later */ + int Stages = 3; char qemu_img_cmdline[300]; FILE* file; - char config[255]; - - if (argc == 2) - strcpy(config, argv[1]); - else - strcpy(config, "sysreg.xml"); + char config[255]; + int Ret = EXIT_SUCCESS; + + if (argc == 2) + strcpy(config, argv[1]); + else + strcpy(config, "sysreg.xml");
if (!LoadSettings(config)) { @@ -189,20 +190,31 @@ { if (vDom) { + if (Stage > 0) + printf("\n\n\n\n\n"); + printf("Running stage %d...\n", Stage + 1); printf("Domain %s started.\n", virDomainGetName(vDom)); - ProcessDebugData(GetConsole(vDom), - AppSettings.Timeout, Stage); - - virDomainGetInfo(vDom, &info); - if (info.state != VIR_DOMAIN_SHUTOFF) + if (!ProcessDebugData(GetConsole(vDom), + AppSettings.Timeout, Stage)) + { + Ret = EXIT_FAILURE; + } + virDomainGetInfo(vDom, &info); + if (info.state != VIR_DOMAIN_SHUTOFF) virDomainDestroy(vDom); virDomainUndefine(vDom); virDomainFree(vDom); + if (Ret == EXIT_FAILURE) + break; } - } + } }
virConnectClose(vConn); - return EXIT_SUCCESS; -} - + if (Ret == EXIT_SUCCESS) + printf("Test succeeded!\n"); + else + printf("Test failed!\n"); + return Ret; +} +