ia64/xen-unstable

changeset 10043:6b7c54556ac8

I am adding one more test case for vTPM migration. The new one does
local network migration without the 'live' parameter 3 times. The test
'04' that does live migration now tests local live migration 3 times.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 11 13:43:09 2006 +0100 (2006-05-11)
parents f6ebf236faee
children d5d46dbfde22
files tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py tools/xm-test/tests/vtpm/Makefile.am
line diff
     1.1 --- a/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py	Thu May 11 13:42:20 2006 +0100
     1.2 +++ b/tools/xm-test/tests/vtpm/04_vtpm-loc_migr.py	Thu May 11 13:43:09 2006 +0100
     1.3 @@ -6,6 +6,7 @@
     1.4  # Positive Test: create domain with virtual TPM attached at build time,
     1.5  #                check list of pcrs; locally migrate the domain and
     1.6  #                check list of pcrs again
     1.7 +#                This test does local live migration.
     1.8  
     1.9  from XmTestLib import *
    1.10  from vtpm_utils import *
    1.11 @@ -50,40 +51,44 @@ domain.closeConsole()
    1.12  
    1.13  old_domid = domid(domName)
    1.14  
    1.15 -try:
    1.16 -    status, ouptut = traceCommand("xm migrate -l %s localhost" %
    1.17 -                                  domName,
    1.18 -                                  timeout=90)
    1.19 -except TimeoutError, e:
    1.20 -    saveLog(consoleHistory)
    1.21 -    vtpm_cleanup(domName)
    1.22 -    FAIL(str(e))
    1.23 +loop = 0
    1.24 +while loop < 3:
    1.25 +    try:
    1.26 +        status, ouptut = traceCommand("xm migrate -l %s localhost" %
    1.27 +                                      domName,
    1.28 +                                      timeout=90)
    1.29 +    except TimeoutError, e:
    1.30 +        saveLog(consoleHistory)
    1.31 +        vtpm_cleanup(domName)
    1.32 +        FAIL(str(e))
    1.33  
    1.34 -if status != 0:
    1.35 -    saveLog(consoleHistory)
    1.36 -    vtpm_cleanup(domName)
    1.37 -    FAIL("xm migrate did not succeed. External device migration activated?")
    1.38 +    if status != 0:
    1.39 +        saveLog(consoleHistory)
    1.40 +        vtpm_cleanup(domName)
    1.41 +        FAIL("xm migrate did not succeed. External device migration activated?")
    1.42  
    1.43  
    1.44 -domName = domain.getName()
    1.45 -new_domid = domid(domName)
    1.46 -
    1.47 -if (old_domid == new_domid):
    1.48 -    vtpm_cleanup(domName)
    1.49 -    FAIL("xm migrate failed, domain id is still %s" % old_domid)
    1.50 +    domName = domain.getName()
    1.51 +    new_domid = domid(domName)
    1.52  
    1.53 -try:
    1.54 -    console = domain.getConsole()
    1.55 -except ConsoleError, e:
    1.56 -    vtpm_cleanup(domName)
    1.57 -    FAIL(str(e))
    1.58 +    if (old_domid == new_domid):
    1.59 +        vtpm_cleanup(domName)
    1.60 +        FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
    1.61 +             (old_domid,loop))
    1.62  
    1.63 -try:
    1.64 -    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
    1.65 -except ConsoleError, e:
    1.66 -    saveLog(console.getHistory())
    1.67 -    vtpm_cleanup(domName)
    1.68 -    FAIL(str(e))
    1.69 +    try:
    1.70 +        console = domain.getConsole()
    1.71 +    except ConsoleError, e:
    1.72 +        vtpm_cleanup(domName)
    1.73 +        FAIL(str(e))
    1.74 +
    1.75 +    try:
    1.76 +        run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
    1.77 +    except ConsoleError, e:
    1.78 +        saveLog(console.getHistory())
    1.79 +        vtpm_cleanup(domName)
    1.80 +        FAIL(str(e))
    1.81 +    loop += 1
    1.82  
    1.83  domain.closeConsole()
    1.84  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/xm-test/tests/vtpm/05_vtpm-loc_migr.py	Thu May 11 13:43:09 2006 +0100
     2.3 @@ -0,0 +1,100 @@
     2.4 +#!/usr/bin/python
     2.5 +
     2.6 +# Copyright (C) International Business Machines Corp., 2006
     2.7 +# Author: Stefan Berger <stefanb@us.ibm.com>
     2.8 +
     2.9 +# Positive Test: create domain with virtual TPM attached at build time,
    2.10 +#                check list of pcrs; locally migrate the domain and
    2.11 +#                check list of pcrs again
    2.12 +#                This test does local (non-live) migration.
    2.13 +
    2.14 +from XmTestLib import *
    2.15 +from vtpm_utils import *
    2.16 +import commands
    2.17 +import os
    2.18 +import os.path
    2.19 +
    2.20 +config = {"vtpm":"instance=1,backend=0"}
    2.21 +domain = XmTestDomain(extraConfig=config)
    2.22 +consoleHistory = ""
    2.23 +
    2.24 +try:
    2.25 +    console = domain.start()
    2.26 +except DomainError, e:
    2.27 +    if verbose:
    2.28 +        print e.extra
    2.29 +    vtpm_cleanup(domain.getName())
    2.30 +    FAIL("Unable to create domain")
    2.31 +
    2.32 +domName = domain.getName()
    2.33 +
    2.34 +try:
    2.35 +    console.sendInput("input")
    2.36 +except ConsoleError, e:
    2.37 +    saveLog(console.getHistory())
    2.38 +    vtpm_cleanup(domName)
    2.39 +    FAIL(str(e))
    2.40 +
    2.41 +try:
    2.42 +    run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
    2.43 +except ConsoleError, e:
    2.44 +    saveLog(console.getHistory())
    2.45 +    vtpm_cleanup(domName)
    2.46 +    FAIL(str(e))
    2.47 +
    2.48 +if re.search("No such file",run["output"]):
    2.49 +    vtpm_cleanup(domName)
    2.50 +    FAIL("TPM frontend support not compiled into (domU?) kernel")
    2.51 +
    2.52 +consoleHistory = console.getHistory()
    2.53 +domain.closeConsole()
    2.54 +
    2.55 +old_domid = domid(domName)
    2.56 +
    2.57 +loop = 0
    2.58 +while loop < 3:
    2.59 +    try:
    2.60 +        status, ouptut = traceCommand("xm migrate %s localhost" %
    2.61 +                                      domName,
    2.62 +                                      timeout=90)
    2.63 +    except TimeoutError, e:
    2.64 +        saveLog(consoleHistory)
    2.65 +        vtpm_cleanup(domName)
    2.66 +        FAIL(str(e))
    2.67 +
    2.68 +    if status != 0:
    2.69 +        saveLog(consoleHistory)
    2.70 +        vtpm_cleanup(domName)
    2.71 +        FAIL("xm migrate did not succeed. External device migration activated?")
    2.72 +
    2.73 +
    2.74 +    domName = domain.getName()
    2.75 +    new_domid = domid(domName)
    2.76 +
    2.77 +    if (old_domid == new_domid):
    2.78 +        vtpm_cleanup(domName)
    2.79 +        FAIL("xm migrate failed, domain id is still %s (loop=%d)" %
    2.80 +             (old_domid,loop))
    2.81 +
    2.82 +    try:
    2.83 +        console = domain.getConsole()
    2.84 +    except ConsoleError, e:
    2.85 +        vtpm_cleanup(domName)
    2.86 +        FAIL(str(e))
    2.87 +
    2.88 +    try:
    2.89 +        run = console.runCmd("cat /sys/devices/platform/tpm_vtpm/pcrs")
    2.90 +    except ConsoleError, e:
    2.91 +        saveLog(console.getHistory())
    2.92 +        vtpm_cleanup(domName)
    2.93 +        FAIL(str(e))
    2.94 +    loop += 1
    2.95 +
    2.96 +domain.closeConsole()
    2.97 +
    2.98 +domain.stop()
    2.99 +
   2.100 +vtpm_cleanup(domName)
   2.101 +
   2.102 +if not re.search("PCR-00:",run["output"]):
   2.103 +	FAIL("Virtual TPM is not working correctly on /dev/vtpm on backend side")
     3.1 --- a/tools/xm-test/tests/vtpm/Makefile.am	Thu May 11 13:42:20 2006 +0100
     3.2 +++ b/tools/xm-test/tests/vtpm/Makefile.am	Thu May 11 13:43:09 2006 +0100
     3.3 @@ -3,7 +3,8 @@ SUBDIRS =
     3.4  TESTS = 01_vtpm-list_pos.test \
     3.5          02_vtpm-cat_pcrs.test \
     3.6          03_vtpm-susp_res.test \
     3.7 -        04_vtpm-loc_migr.test
     3.8 +        04_vtpm-loc_migr.test \
     3.9 +        05_vtpm-loc_migr.test
    3.10  
    3.11  XFAIL_TESTS =
    3.12