From: Harry Butterworth <harry@hebutterworth.freeserve.co.uk>
To: xen-devel@lists.xensource.com, dfbp@us.ibm.com,
aliguori@us.ibm.com, ewan@xensource.com
Subject: [PATCH][XM-TEST] Fix bugzilla # 674 by changing the xm-test Console.py to wait for the command prompt.
Date: Mon, 19 Jun 2006 17:36:53 +0100 [thread overview]
Message-ID: <1150735014.14277.30.camel@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 995 bytes --]
On Fri, 2006-06-16 at 19:49 +0100, Harry Butterworth wrote:
> Lots of xm-test tests are failing with console timeouts on some machines
> at the moment. I reproduced the problem and found it was due to some
> probing activity in the boot process of the -xen kernel. The behaviour
> of the current xm-test code is to assume that the boot process has
> finished after performing three one-second waits for input---when the
> probing activity introduces more than three one-second delays the test
> suite breaks.
>
> The patch below changes the test suite to wait for the command prompt
> before attempting to submit a command. The timeout is increased from 3
> seconds to 3 minutes but the wait exits early when the prompt is found
> so the test suite doesn't take any longer to run.
This patch has now had adequate testing and David Barrera has shown that
it fixes a substantial chunk of the current breakage in xm-test.
Signed-off-by Harry Butterworth <butterwo@uk.ibm.com>
Please apply.
[-- Attachment #2: console-timeout.patch --]
[-- Type: text/x-patch, Size: 3576 bytes --]
diff -r ee3d10828937 -r 2dcc3cc7118e tools/xm-test/lib/XmTestLib/Console.py
--- a/tools/xm-test/lib/XmTestLib/Console.py Fri Jun 16 13:43:54 2006
+++ b/tools/xm-test/lib/XmTestLib/Console.py Fri Jun 16 18:28:52 2006
@@ -82,9 +82,6 @@
tty.setraw(self.consoleFd, termios.TCSANOW)
- self.__chewall(self.consoleFd)
-
-
def __addToHistory(self, line):
self.historyBuffer.append(line)
self.historyLines += 1
@@ -120,34 +117,47 @@
output"""
self.PROMPT = prompt
-
- def __chewall(self, fd):
+ def __getprompt(self, fd):
timeout = 0
- bytes = 0
-
- while timeout < 3:
- i, o, e = select.select([fd], [], [], 1)
- if fd in i:
- try:
- foo = os.read(fd, 1)
- if self.debugMe:
- sys.stdout.write(foo)
- bytes += 1
- except Exception, exn:
- raise ConsoleError(str(exn))
-
- else:
- timeout += 1
-
- if self.limit and bytes >= self.limit:
+ bytes = 0
+ while timeout < 180:
+ # eat anything while total bytes less than limit else raise RUNAWAY
+ while (not self.limit) or (bytes < self.limit):
+ i, o, e = select.select([fd], [], [], 1)
+ if fd in i:
+ try:
+ foo = os.read(fd, 1)
+ if self.debugMe:
+ sys.stdout.write(foo)
+ bytes += 1
+ except Exception, exn:
+ raise ConsoleError(str(exn))
+ else:
+ break
+ else:
raise ConsoleError("Console run-away (exceeded %i bytes)"
% self.limit, RUNAWAY)
-
- if self.debugMe:
- print "Ignored %i bytes of miscellaneous console output" % bytes
-
- return bytes
-
+ # press enter
+ os.write(self.consoleFd, "\n")
+ # look for prompt
+ for prompt_char in "\r\n" + self.PROMPT:
+ i, o, e = select.select([fd], [], [], 1)
+ if fd in i:
+ try:
+ foo = os.read(fd, 1)
+ if self.debugMe:
+ sys.stdout.write(foo)
+ if foo != prompt_char:
+ break
+ except Exception, exn:
+ raise ConsoleError(str(exn))
+ else:
+ timeout += 1
+ break
+ else:
+ break
+ else:
+ raise ConsoleError("Timed out waiting for console prompt")
def __runCmd(self, command, saveHistory=True):
output = ""
@@ -155,7 +165,7 @@
lines = 0
bytes = 0
- self.__chewall(self.consoleFd)
+ self.__getprompt(self.consoleFd)
if verbose:
print "[%s] Sending `%s'" % (self.domain, command)
@@ -176,7 +186,7 @@
"Failed to read from console (fd=%i): %s" %
(self.consoleFd, exn))
else:
- raise ConsoleError("Timed out waiting for console")
+ raise ConsoleError("Timed out waiting for console command")
if self.limit and bytes >= self.limit:
raise ConsoleError("Console run-away (exceeded %i bytes)"
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2006-06-19 16:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-19 16:36 Harry Butterworth [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-06-16 18:49 [PATCH][XM-TEST] Fix bugzilla # 674 by changing the xm-test Console.py to wait for the command prompt Harry Butterworth
2006-06-16 20:06 ` David F Barrera
2006-06-18 23:02 ` Harry Butterworth
2006-06-16 20:35 ` David F Barrera
2006-06-19 16:17 ` David F Barrera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1150735014.14277.30.camel@localhost.localdomain \
--to=harry@hebutterworth.freeserve.co.uk \
--cc=aliguori@us.ibm.com \
--cc=dfbp@us.ibm.com \
--cc=ewan@xensource.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.