direct-io.hg

changeset 7858:234b3d608c86

Make test 04_memset detect bug #380 and restart the console daemon.
This should allow the rest of the tests to run without reporting
failure because this test killed the console system.
author dan@guaranine.beaverton.ibm.com
date Thu Nov 17 11:56:13 2005 +0100 (2005-11-17)
parents 2ce5edc0ccbd
children c2f0ed9158ad
files tools/xm-test/lib/XmTestLib/Console.py tools/xm-test/tests/memset/04_memset_smallmem_pos.py
line diff
     1.1 --- a/tools/xm-test/lib/XmTestLib/Console.py	Thu Nov 17 11:54:52 2005 +0100
     1.2 +++ b/tools/xm-test/lib/XmTestLib/Console.py	Thu Nov 17 11:56:13 2005 +0100
     1.3 @@ -33,9 +33,13 @@ import select
     1.4  
     1.5  from Test import *
     1.6  
     1.7 +TIMEDOUT = 1
     1.8 +RUNAWAY  = 2
     1.9 +
    1.10  class ConsoleError(Exception):
    1.11 -    def __init__(self, msg):
    1.12 +    def __init__(self, msg, reason=TIMEDOUT):
    1.13          self.errMsg = msg
    1.14 +        self.reason = reason
    1.15  
    1.16      def __str__(self):
    1.17          return str(self.errMsg)
    1.18 @@ -149,7 +153,7 @@ class XmConsole:
    1.19  
    1.20              if self.limit and bytes >= self.limit:
    1.21                  raise ConsoleError("Console run-away (exceeded %i bytes)"
    1.22 -                                   % self.limit)
    1.23 +                                   % self.limit, RUNAWAY)
    1.24  
    1.25          if self.debugMe:
    1.26              print "Ignored %i bytes of miscellaneous console output" % bytes
    1.27 @@ -187,7 +191,7 @@ class XmConsole:
    1.28  
    1.29              if self.limit and bytes >= self.limit:
    1.30                  raise ConsoleError("Console run-away (exceeded %i bytes)"
    1.31 -                                   % self.limit)
    1.32 +                                   % self.limit, RUNAWAY)
    1.33  
    1.34              if str == "\n":
    1.35                  if lines > 0:
     2.1 --- a/tools/xm-test/tests/memset/04_memset_smallmem_pos.py	Thu Nov 17 11:54:52 2005 +0100
     2.2 +++ b/tools/xm-test/tests/memset/04_memset_smallmem_pos.py	Thu Nov 17 11:56:13 2005 +0100
     2.3 @@ -36,6 +36,17 @@ try:
     2.4      # See if this hits the byte limit
     2.5      console.runCmd("ls")
     2.6  except ConsoleError, e:
     2.7 -    FAIL(str(e))
     2.8 +    if e.reason == RUNAWAY:
     2.9 +        # Need to stop the domain before we restart the console daemon
    2.10 +        domain.destroy()
    2.11 +        if verbose:
    2.12 +            print "*** Attempting restart of xenconsoled"
    2.13 +            s, o = traceCommand("killall xenconsoled")
    2.14 +            s, o = traceCommand("xenconsoled")
    2.15 +            if s != 0:
    2.16 +                print "*** Starting xenconsoled failed: %i" % s
    2.17 +        FAIL("Bug #380: I crashed the console system")
    2.18 +    else:
    2.19 +        FAIL(str(e))
    2.20  
    2.21  domain.destroy()