ia64/xen-unstable

changeset 9933:55f73916d319

Xm-tests 01_memset_basic_pos.test and 03_memset_random_pos.test start
domUs with 64MB of memory,
and assume that all of that memory is available in the domU. They then
perform various xm memset tests
based on the assumed starting conditions.

When netback & blkback are comiled into the domU kernel, they eat about
5MB. This mismatch will cause
01_memset_basic_pos.test to fail every time. 03_memset_random_pos.test
will probably fail, but can
pass with some lucky numbers from the random number generator.

This patch changes both tests to read the starting memory allocation from
the balloon driver in the domU.

Signed-off-by: Jim Dykman <dykman@us.ibm.com>
author emellor@leeni.uk.xensource.com
date Tue May 02 18:17:59 2006 +0100 (2006-05-02)
parents decf309fb47b
children 51484df99be1
files tools/xm-test/tests/memset/01_memset_basic_pos.py tools/xm-test/tests/memset/03_memset_random_pos.py
line diff
     1.1 --- a/tools/xm-test/tests/memset/01_memset_basic_pos.py	Tue May 02 17:23:21 2006 +0100
     1.2 +++ b/tools/xm-test/tests/memset/01_memset_basic_pos.py	Tue May 02 18:17:59 2006 +0100
     1.3 @@ -44,8 +44,20 @@ try:
     1.4  except ConsoleError, e:
     1.5      FAIL(str(e))
     1.6      
     1.7 +try:
     1.8 +    run = console.runCmd("cat /proc/xen/balloon | grep Current");
     1.9 +except ConsoleError, e:
    1.10 +    FAIL(str(e))
    1.11 +
    1.12 +match = re.match("[^0-9]+([0-9]+)", run["output"])
    1.13 +if not match:
    1.14 +    FAIL("Invalid domU meminfo line")
    1.15 +        
    1.16 +origmem = int(match.group(1)) / 1024
    1.17 +newmem = origmem - 1
    1.18 +
    1.19  # set mem-set for less than default
    1.20 -cmd = "xm mem-set %s %i" % (domain.getName(), 63)
    1.21 +cmd = "xm mem-set %s %i" % (domain.getName(), newmem)
    1.22  status, output = traceCommand(cmd)
    1.23  if status != 0:
    1.24      if verbose:
    1.25 @@ -55,7 +67,7 @@ if status != 0:
    1.26  
    1.27  for i in [1,2,3,4,5,6,7,8,9,10]:
    1.28      mem = getDomMem(domain.getName())
    1.29 -    if mem == 63:
    1.30 +    if mem == newmem:
    1.31          break
    1.32      time.sleep(1)
    1.33  
    1.34 @@ -63,8 +75,8 @@ for i in [1,2,3,4,5,6,7,8,9,10]:
    1.35  mem = getDomMem(domain.getName())
    1.36  if not mem:
    1.37      FAIL("Failed to get memory amount for domain %s" % domain.getName())
    1.38 -elif mem != 63:
    1.39 -    FAIL("Dom0 failed to verify 63 MB; got %i MB" % mem)
    1.40 +elif mem != newmem:
    1.41 +    FAIL("Dom0 failed to verify %i MB; got %i MB" % newmem,mem)
    1.42  
    1.43  # verify memory set internally
    1.44  try:
    1.45 @@ -79,7 +91,7 @@ if not m:
    1.46  
    1.47  domUmem = int(m.group(1)) / 1024
    1.48  
    1.49 -if domUmem != 63:
    1.50 +if domUmem != newmem:
    1.51      FAIL("DomU reported incorrect memory amount: %i MB" % (domUmem))
    1.52  
    1.53  # quiesce everything
     2.1 --- a/tools/xm-test/tests/memset/03_memset_random_pos.py	Tue May 02 17:23:21 2006 +0100
     2.2 +++ b/tools/xm-test/tests/memset/03_memset_random_pos.py	Tue May 02 18:17:59 2006 +0100
     2.3 @@ -22,8 +22,6 @@ except DomainError, e:
     2.4      FAIL(str(e))
     2.5  
     2.6  times = random.randint(10,50)
     2.7 -origmem = domain.config.getOpt("memory")
     2.8 -currmem = domain.config.getOpt("memory")
     2.9  
    2.10  try:
    2.11      console = XmConsole(domain.getName())
    2.12 @@ -31,6 +29,18 @@ try:
    2.13  except ConsoleError, e:
    2.14      FAIL(str(e))
    2.15  
    2.16 +try:
    2.17 +    run = console.runCmd("cat /proc/xen/balloon | grep Current");
    2.18 +except ConsoleError, e:
    2.19 +    FAIL(str(e))
    2.20 +
    2.21 +match = re.match("[^0-9]+([0-9]+)", run["output"])
    2.22 +if not match:
    2.23 +    FAIL("Invalid domU meminfo line")
    2.24 +        
    2.25 +origmem = int(match.group(1)) / 1024
    2.26 +currmem = origmem
    2.27 +
    2.28  for i in range(0,times):
    2.29      amt = random.randint(-10,10)
    2.30