ia64/xen-unstable

changeset 11952:1c74ee519776

Add ability to inspect messages from domain for arbitrary strings.

Used on PowerPC to FAIL(), if the guest domain hits a BUG() and enters XMON.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Oct 23 10:16:20 2006 +0100 (2006-10-23)
parents 8bd3107a72f0
children c67821622c04
files tools/xm-test/lib/XmTestLib/Console.py tools/xm-test/lib/XmTestLib/arch.py
line diff
     1.1 --- a/tools/xm-test/lib/XmTestLib/Console.py	Mon Oct 23 10:15:39 2006 +0100
     1.2 +++ b/tools/xm-test/lib/XmTestLib/Console.py	Mon Oct 23 10:16:20 2006 +0100
     1.3 @@ -31,6 +31,7 @@ import termios
     1.4  import fcntl
     1.5  import select
     1.6  
     1.7 +import arch
     1.8  from Test import *
     1.9  
    1.10  TIMEDOUT = 1
    1.11 @@ -120,6 +121,7 @@ class XmConsole:
    1.12      def __getprompt(self, fd):
    1.13          timeout = 0
    1.14          bytes = 0
    1.15 +        buffer = ""
    1.16          while timeout < 180:
    1.17              # eat anything while total bytes less than limit else raise RUNAWAY
    1.18              while (not self.limit) or (bytes < self.limit):
    1.19 @@ -130,6 +132,7 @@ class XmConsole:
    1.20                          if self.debugMe:
    1.21                              sys.stdout.write(foo)
    1.22                          bytes += 1
    1.23 +                        buffer += foo
    1.24                      except Exception, exn:
    1.25                          raise ConsoleError(str(exn))
    1.26                  else:
    1.27 @@ -137,6 +140,8 @@ class XmConsole:
    1.28              else:
    1.29                  raise ConsoleError("Console run-away (exceeded %i bytes)"
    1.30                                     % self.limit, RUNAWAY)
    1.31 +            # Check to see if the buffer contains anything interetsing
    1.32 +            arch.checkBuffer(buffer)
    1.33              # press enter
    1.34              os.write(self.consoleFd, "\n")
    1.35              # look for prompt
     2.1 --- a/tools/xm-test/lib/XmTestLib/arch.py	Mon Oct 23 10:15:39 2006 +0100
     2.2 +++ b/tools/xm-test/lib/XmTestLib/arch.py	Mon Oct 23 10:16:20 2006 +0100
     2.3 @@ -25,6 +25,8 @@ import re
     2.4  import config
     2.5  import commands
     2.6  
     2.7 +from Test import *
     2.8 +
     2.9  BLOCK_ROOT_DEV = "hda"
    2.10  
    2.11  # This isn't truly platform related but it makes the code tidier
    2.12 @@ -38,6 +40,9 @@ def getRdPath():
    2.13      return rdpath
    2.14  
    2.15  # Begin: Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors
    2.16 +def ia_checkBuffer(buffer):
    2.17 +    return
    2.18 +
    2.19  def ia_minSafeMem():
    2.20      return 32
    2.21  
    2.22 @@ -81,6 +86,19 @@ ia_HVMDefaults =      {"memory"       : 
    2.23  # End  : Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors
    2.24  
    2.25  # Begin: PowerPC
    2.26 +def ppc_checkBuffer(buffer):
    2.27 +    checks = [
    2.28 +        {"pattern" : re.compile("^\d+:mon>\s*$", re.MULTILINE),
    2.29 +         "message" : "domain trapped into XMON"},
    2.30 +    ]
    2.31 +
    2.32 +    for i in range(0, len(checks)):
    2.33 +        check=checks[i]
    2.34 +        if check.get('pattern').search(buffer):
    2.35 +		FAIL(check.get('message'))
    2.36 +
    2.37 +    return
    2.38 +
    2.39  def ppc_minSafeMem():
    2.40      return 64
    2.41  
    2.42 @@ -116,6 +134,7 @@ ppc_ParavirtDefaults = {"memory"  : 64,
    2.43  if _arch == "x86" or _arch == "ia64":
    2.44      minSafeMem = ia_minSafeMem
    2.45      getDefaultKernel = ia_getDefaultKernel
    2.46 +    checkBuffer = ia_checkBuffer
    2.47      if config.ENABLE_HVM_SUPPORT:
    2.48          configDefaults = ia_HVMDefaults
    2.49      else:
    2.50 @@ -123,6 +142,7 @@ if _arch == "x86" or _arch == "ia64":
    2.51  elif _arch == "powerpc":
    2.52      minSafeMem = ppc_minSafeMem
    2.53      getDefaultKernel = ppc_getDefaultKernel
    2.54 +    checkBuffer = ppc_checkBuffer
    2.55      configDefaults = ppc_ParavirtDefaults
    2.56  else:
    2.57      raise ValueError, "Unknown architecture!"