[Libvirt-cim] [PATCH] [TEST] Initalise status=FAIL in the exception block otherwise it returns a PASS even when there is an exception in the tc

yunguol at cn.ibm.com yunguol at cn.ibm.com
Thu Sep 4 02:46:57 UTC 2008


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1220496411 25200
# Node ID 2d36d729130e1e0a796a3c25b9ee200cad29a9d4
# Parent  3c04faaa67e001ecaf578a13da75f88235257576
[TEST] Initalise status=FAIL in the exception block otherwise it returns a PASS even when there is an exception in the tc

Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>

diff -r 3c04faaa67e0 -r 2d36d729130e suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py	Tue Sep 02 23:10:52 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py	Wed Sep 03 19:46:51 2008 -0700
@@ -27,7 +27,7 @@ from XenKvmLib import enumclass
 from XenKvmLib import enumclass
 from VirtLib import live
 from VirtLib import utils
-from CimTest import Globals
+from CimTest.Globals import logger
 from CimTest.ReturnCodes import PASS, FAIL
 
 SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -47,20 +47,22 @@ def main():
                 idx = live_cs.index(name)
                 del live_cs[idx]
             except ValueError, detail:
-                Globals.logger.error("Provider reports system `%s', \
+                logger.error("Provider reports system `%s', \
 but virsh does not" % name)
                 status = FAIL
 
         for system in live_cs:
-            Globals.logger.error("Provider does not report system `%s', \
+            logger.error("Provider does not report system `%s', \
 but virsh does" % system)
             status = FAIL
 
     except IndexError, detail:
-        Globals.logger.error("Exception: %s", detail)
+        logger.error("Exception: %s", detail)
+        status = FAIL
     except Exception, detail:
-        Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, 'ComputerSystem')
-        Globals.logger.error("Exception: %s", detail)
+        logger.error(Globals.CIM_ERROR_ENUMERATE, 'ComputerSystem')
+        logger.error("Exception: %s", detail)
+        status = FAIL
 
     return status
 




More information about the Libvirt-cim mailing list