ia64/xen-unstable

changeset 9786:a22ce69dd703

Fix the 15_create_smallmem_pos.py test, which was failing because the
set console.limit command in the test was never being run. The select in
Console.py was never timing out because there was always someting to read on
the fd, the OOM messages are constant. So the test would hang.

The fix includes:

1) Changing MEM in 15_create_smallmem_pos.py to 32MBs, which is the default
for the tools that should work.
2) Change the XmConsole init to add an argument to set the console limit
when it's created.
3) Set a default large limit for console so we won't hang in the future.
4) Added a new 16_create_smallmem_neg.py test to handle failure situation.
5) Added comment in README.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
author stekloff@dyn9047022152.beaverton.ibm.com
date Wed Apr 19 22:58:03 2006 +0100 (2006-04-19)
parents 5b1e10215e38
children addc26c4b4a6
files tools/xm-test/README tools/xm-test/lib/XmTestLib/Console.py tools/xm-test/tests/create/15_create_smallmem_pos.py tools/xm-test/tests/create/16_create_smallmem_neg.py tools/xm-test/tests/create/Makefile.am
line diff
     1.1 --- a/tools/xm-test/README	Wed Apr 19 22:54:49 2006 +0100
     1.2 +++ b/tools/xm-test/README	Wed Apr 19 22:58:03 2006 +0100
     1.3 @@ -212,6 +212,24 @@ use it with relatively few problems.
     1.4  Known Issues
     1.5  ============
     1.6  
     1.7 +If you create a domain with a small amount of memory, under 32MBs, you
     1.8 +may run into out of memory situations for the domain. There's no way
     1.9 +to know the amount of memory needed by the kernel and modules used. Xm-test
    1.10 +uses 64MBs as default and that should work. If there are out of memory
    1.11 +issues, the default can be changed. Edit xm-test/lib/XmTestLib/XenDomain.py
    1.12 +and change ParavirtDefaults and HVMDefaults "memory".
    1.13 +
    1.14 +There are two tests that work with small memory, 15_create_smallmem_pos.py 
    1.15 +and 16_create_smallmem_neg.py. The first makes sure the default 32 MBs 
    1.16 +limit works. The second checks a low memory fail situation. These tests
    1.17 +are located in the xm-test/tests/create directory and can be easily edited
    1.18 +to change the MEM value they should test. If the 32MBs test fails, the
    1.19 +failure should be reported to the Xen xen-devel mailing list. The Xen
    1.20 +tools use 32MBs as a lower acceptable limit for domain creation. The Xen
    1.21 +mailing lists are located here:
    1.22 +
    1.23 +http://lists.xensource.com/
    1.24 +
    1.25  
    1.26  Reporting Bugs
    1.27  ==============
     2.1 --- a/tools/xm-test/lib/XmTestLib/Console.py	Wed Apr 19 22:54:49 2006 +0100
     2.2 +++ b/tools/xm-test/lib/XmTestLib/Console.py	Wed Apr 19 22:58:03 2006 +0100
     2.3 @@ -46,7 +46,7 @@ class ConsoleError(Exception):
     2.4  
     2.5  class XmConsole:
     2.6  
     2.7 -    def __init__(self, domain, historyLimit=256, historySaveAll=True, historySaveCmds=False):
     2.8 +    def __init__(self, domain, historyLimit=256, historySaveAll=True, historySaveCmds=False, cLimit=131072):
     2.9          """
    2.10          Parameters:
    2.11            historyLimit:     specifies how many lines of history are maintained
    2.12 @@ -65,7 +65,7 @@ class XmConsole:
    2.13          self.historySaveAll   = historySaveAll
    2.14          self.historySaveCmds  = historySaveCmds
    2.15          self.debugMe          = False
    2.16 -        self.limit            = None
    2.17 +        self.limit            = cLimit
    2.18  
    2.19          consoleCmd = ["/usr/sbin/xm", "xm", "console", domain]
    2.20  
     3.1 --- a/tools/xm-test/tests/create/15_create_smallmem_pos.py	Wed Apr 19 22:54:49 2006 +0100
     3.2 +++ b/tools/xm-test/tests/create/15_create_smallmem_pos.py	Wed Apr 19 22:58:03 2006 +0100
     3.3 @@ -5,7 +5,8 @@
     3.4  
     3.5  from XmTestLib import *
     3.6  
     3.7 -MEM = 16
     3.8 +# 32MBs is the default lower limit for creating domains, it should work
     3.9 +MEM = 32
    3.10  
    3.11  domain = XmTestDomain(extraConfig={"memory": MEM,
    3.12                                     "extra" :"mem=%iM" % MEM})
    3.13 @@ -17,7 +18,6 @@ except DomainError, e:
    3.14  
    3.15  try:
    3.16      console = XmConsole(domain.getName())
    3.17 -    console.setLimit(65536)
    3.18      console.sendInput("input")
    3.19      console.runCmd("ls")
    3.20  except ConsoleError, e:
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/xm-test/tests/create/16_create_smallmem_neg.py	Wed Apr 19 22:58:03 2006 +0100
     4.3 @@ -0,0 +1,32 @@
     4.4 +#!/usr/bin/python
     4.5 +
     4.6 +# Copyright (C) International Business Machines Corp., 2005
     4.7 +# Author: Dan Smith <danms@us.ibm.com>
     4.8 +
     4.9 +from XmTestLib import *
    4.10 +
    4.11 +# This is under the default lower limit of 32 and we expect this test
    4.12 +# to fail. 16MBs isn't enough for the -xen kernel.
    4.13 +MEM = 16
    4.14 +
    4.15 +domain = XmTestDomain(extraConfig={"memory": MEM,
    4.16 +                                   "extra" :"mem=%iM" % MEM})
    4.17 +
    4.18 +try:
    4.19 +    domain.start()
    4.20 +except DomainError, e:
    4.21 +    FAIL("Unable to start a domain with %i MB" % MEM)
    4.22 +
    4.23 +try:
    4.24 +    console = XmConsole(domain.getName())
    4.25 +    console.sendInput("input")
    4.26 +    console.runCmd("ls")
    4.27 +except ConsoleError, e:
    4.28 +    if e.reason == RUNAWAY:
    4.29 +        print "Domain with %i MB has runaway console as expected" % MEM
    4.30 +    else:
    4.31 +        print "Starting a domain with %i MB failed as expected" % MEM
    4.32 +else:
    4.33 +    FAIL("Starting a console with %i MB passed, expected test to fail" % MEM)
    4.34 +
    4.35 +domain.destroy()
     5.1 --- a/tools/xm-test/tests/create/Makefile.am	Wed Apr 19 22:54:49 2006 +0100
     5.2 +++ b/tools/xm-test/tests/create/Makefile.am	Wed Apr 19 22:58:03 2006 +0100
     5.3 @@ -13,7 +13,8 @@ TESTS = 01_create_basic_pos.test \
     5.4  	12_create_concurrent_stress_pos.test \
     5.5  	13_create_multinic_pos.test \
     5.6  	14_create_blockroot_pos.test \
     5.7 -	15_create_smallmem_pos.test
     5.8 +	15_create_smallmem_pos.test \
     5.9 +	16_create_smallmem_neg.test
    5.10  
    5.11  EXTRA_DIST = $(TESTS)
    5.12