# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208311225 25200
# Node ID e4907400a5165206046e4d4733d905c067772bf2
# Parent b9ce0dcc277e51d5865b611ebd092874e856bbe2
[TEST].2# add more verification and update status description in Processor tc
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r b9ce0dcc277e -r e4907400a516 suites/libvirt-cim/cimtest/Processor/01_processor.py
--- a/suites/libvirt-cim/cimtest/Processor/01_processor.py Mon Apr 14 01:16:57 2008 -0700
+++ b/suites/libvirt-cim/cimtest/Processor/01_processor.py Tue Apr 15 19:00:25 2008 -0700
@@ -32,6 +32,7 @@ from XenKvmLib.vxml import XenXML, KVMXM
from XenKvmLib.vxml import XenXML, KVMXML, get_class
from CimTest.Globals import log_param, logger
from CimTest.Globals import do_main
+from CimTest.ReturnCodes import PASS, FAIL
SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV']
@@ -42,7 +43,7 @@ def main():
def main():
options = main.options
log_param()
- status = 0
+ status = PASS
vsxml = get_class(options.virt)(test_dom, vcpus=test_vcpus)
vsxml.define(options.ip)
vsxml.start(options.ip)
@@ -50,7 +51,7 @@ def main():
# Processor instance enumerate need the domain to be active
domlist = live.active_domain_list(options.ip, options.virt)
if test_dom not in domlist:
- status = 1
+ status = FAIL
logger.error("Domain not started, we're not able to check vcpu")
else:
for i in range(0, test_vcpus):
@@ -62,7 +63,10 @@ def main():
}
try:
dev = eval(('devices.' + get_typed_class(options.virt,
'Processor')))(options.ip, key_list)
- logger.info("Checked device %s" % devid)
+ if dev.DeviceID == devid:
+ logger.info("Checked device %s" % devid)
+ else:
+ logger.error("Mismatching device, returned %s instead %s" %
(dev.DeviceID, devid))
except Exception, details:
logger.error("Error check device %s: %s" % (devid, details))
status = 1
diff -r b9ce0dcc277e -r e4907400a516
suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py
--- a/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Mon Apr 14 01:16:57
2008 -0700
+++ b/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Tue Apr 15 19:00:25
2008 -0700
@@ -39,6 +39,7 @@ from XenKvmLib.common_util import create
from XenKvmLib.common_util import create_using_definesystem
from XenKvmLib.devices import get_dom_proc_insts
from CimTest.Globals import log_param, logger, do_main
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV']
@@ -49,28 +50,28 @@ def check_processors(procs):
if len(procs) != test_vcpus:
logger.error("%d vcpu instances were returned. %d expected",
len(procs), test_vcpus)
- return 1
+ return FAIL
for proc in procs:
if proc['SystemName'] != default_dom:
logger.error("Inst returned is for guesst %s, expected guest %s.",
procs['SystemName'], default_dom)
- return 1
+ return FAIL
devid = "%s/%s" % (default_dom, test_vcpus - 1)
if proc['DeviceID'] != devid:
logger.error("DeviceID %s does not match expected %s.",
procs['DeviceID'], devid)
- return 1
+ return FAIL
- return 0
+ return PASS
@do_main(sup_types)
def main():
options = main.options
log_param()
- status = 0
+ status = PASS
undefine_test_domain(default_dom, options.ip)
@@ -94,7 +95,7 @@ def main():
except Exception, detail:
logger.error("Exception: %s" % detail)
- status = 1
+ status = FAIL
finally:
undefine_test_domain(default_dom, options.ip)