aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/lib
diff options
context:
space:
mode:
authorEwan Mellor <ewan@xensource.com>2006-10-23 10:16:20 +0100
committerEwan Mellor <ewan@xensource.com>2006-10-23 10:16:20 +0100
commit1cbb1ec85e90017d6d89fbe40bed7f56090b9099 (patch)
treea9f4162cb4bccd054a535adde4ffc476fe045017 /tools/xm-test/lib
parent7c0553c867e4a218a5a0254001b26576432d63e9 (diff)
downloadxen-1cbb1ec85e90017d6d89fbe40bed7f56090b9099.tar.gz
xen-1cbb1ec85e90017d6d89fbe40bed7f56090b9099.tar.bz2
xen-1cbb1ec85e90017d6d89fbe40bed7f56090b9099.zip
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>
Diffstat (limited to 'tools/xm-test/lib')
-rwxr-xr-xtools/xm-test/lib/XmTestLib/Console.py5
-rw-r--r--tools/xm-test/lib/XmTestLib/arch.py20
2 files changed, 25 insertions, 0 deletions
diff --git a/tools/xm-test/lib/XmTestLib/Console.py b/tools/xm-test/lib/XmTestLib/Console.py
index 5507d3b1ec..b92f32bb3b 100755
--- a/tools/xm-test/lib/XmTestLib/Console.py
+++ b/tools/xm-test/lib/XmTestLib/Console.py
@@ -31,6 +31,7 @@ import termios
import fcntl
import select
+import arch
from Test import *
TIMEDOUT = 1
@@ -120,6 +121,7 @@ class XmConsole:
def __getprompt(self, fd):
timeout = 0
bytes = 0
+ buffer = ""
while timeout < 180:
# eat anything while total bytes less than limit else raise RUNAWAY
while (not self.limit) or (bytes < self.limit):
@@ -130,6 +132,7 @@ class XmConsole:
if self.debugMe:
sys.stdout.write(foo)
bytes += 1
+ buffer += foo
except Exception, exn:
raise ConsoleError(str(exn))
else:
@@ -137,6 +140,8 @@ class XmConsole:
else:
raise ConsoleError("Console run-away (exceeded %i bytes)"
% self.limit, RUNAWAY)
+ # Check to see if the buffer contains anything interetsing
+ arch.checkBuffer(buffer)
# press enter
os.write(self.consoleFd, "\n")
# look for prompt
diff --git a/tools/xm-test/lib/XmTestLib/arch.py b/tools/xm-test/lib/XmTestLib/arch.py
index 07df8a352d..d5a1aa55cb 100644
--- a/tools/xm-test/lib/XmTestLib/arch.py
+++ b/tools/xm-test/lib/XmTestLib/arch.py
@@ -25,6 +25,8 @@ import re
import config
import commands
+from Test import *
+
BLOCK_ROOT_DEV = "hda"
# This isn't truly platform related but it makes the code tidier
@@ -38,6 +40,9 @@ def getRdPath():
return rdpath
# Begin: Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors
+def ia_checkBuffer(buffer):
+ return
+
def ia_minSafeMem():
return 32
@@ -81,6 +86,19 @@ ia_HVMDefaults = {"memory" : 64,
# End : Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors
# Begin: PowerPC
+def ppc_checkBuffer(buffer):
+ checks = [
+ {"pattern" : re.compile("^\d+:mon>\s*$", re.MULTILINE),
+ "message" : "domain trapped into XMON"},
+ ]
+
+ for i in range(0, len(checks)):
+ check=checks[i]
+ if check.get('pattern').search(buffer):
+ FAIL(check.get('message'))
+
+ return
+
def ppc_minSafeMem():
return 64
@@ -116,6 +134,7 @@ _arch = _uname_to_arch_map.get(os.uname()[4], "Unknown")
if _arch == "x86" or _arch == "ia64":
minSafeMem = ia_minSafeMem
getDefaultKernel = ia_getDefaultKernel
+ checkBuffer = ia_checkBuffer
if config.ENABLE_HVM_SUPPORT:
configDefaults = ia_HVMDefaults
else:
@@ -123,6 +142,7 @@ if _arch == "x86" or _arch == "ia64":
elif _arch == "powerpc":
minSafeMem = ppc_minSafeMem
getDefaultKernel = ppc_getDefaultKernel
+ checkBuffer = ppc_checkBuffer
configDefaults = ppc_ParavirtDefaults
else:
raise ValueError, "Unknown architecture!"