[Libvirt-cim] [PATCH] [TEST][Addition] : Adding check_len() function to verify the lenght of the association, list etc

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Tue Apr 1 06:44:51 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1207032270 -19800
# Node ID 37958b18d9a91b23b833248f29e5edc6ab74144b
# Parent  5d47437104551b638aa75e2e525e49ec4b41e3ec
[TEST][Addition] : Adding check_len() function to verify the lenght of the association, list etc.


Signed-off-by: Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>

diff -r 5d4743710455 -r 37958b18d9a9 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Mon Mar 31 07:54:19 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Tue Apr 01 12:14:30 2008 +0530
@@ -187,3 +187,21 @@ def try_getinstance(conn, classname, key
 '%s' passed.", classname, field_name)
     return XFAIL_RC(bug_no)
 
+def check_len(an, assoc_list_info, qcn, crit='eq', exp_len=0):
+    if crit == 'ne':
+        expr = 'len(assoc_list_info) != exp_len'
+    elif crit == 'eq':
+        expr = 'len(assoc_list_info) == exp_len'
+    elif crit == 'lt':
+        expr = 'len(assoc_list_info) < exp_len'
+    elif crit == 'gt':
+        expr = 'len(assoc_list_info) > exp_len'
+    elif crit == 'le':
+        expr = 'len(assoc_list_info) <= exp_len'
+    else:
+        expr = 'len(assoc_list_info) <= exp_len'
+    if eval(expr) :
+        logger.error("%s returned %i %s objects, as compared with %i" % (an, len(assoc_list_info), qcn, exp_len))
+        return FAIL
+    return PASS
+




More information about the Libvirt-cim mailing list