[PATCH] [TEST] Retrieve revision and changeset string

# HG changeset patch # User Zhengang Li <lizg@cn.ibm.com> # Date 1208344854 -28800 # Node ID 5d2e26fe8b594894946b95598aac5c43a6d3f0d0 # Parent e54b31ce89af19ca0d4c40ce4b097685e34aa2c7 [TEST] Retrieve revision and changeset string The two properties can be accessed in test cases as 'main.revision', 'main.changeset' Signed-off-by: Zhengang Li <lizg@cn.ibm.com> diff -r e54b31ce89af -r 5d2e26fe8b59 lib/CimTest/Globals.py --- a/lib/CimTest/Globals.py Wed Apr 16 16:10:52 2008 +0800 +++ b/lib/CimTest/Globals.py Wed Apr 16 19:20:54 2008 +0800 @@ -135,6 +135,7 @@ def do_main(types=['Xen'], p=parser): def do_try(): try: log_param(options.debug==True) + revision, changeset = get_version(options.virt, options.ip) from VirtLib.utils import setup_ssh_key from XenKvmLib.test_doms import destroy_and_undefine_all setup_ssh_key() @@ -148,3 +149,16 @@ def do_main(types=['Xen'], p=parser): return do_try return do_type +def get_version(virt, ip): + from pywbem import WBEMConnection + from XenKvmLib.classes import get_typed_class + conn = WBEMConnection('http://%s' % ip, (CIM_USER, CIM_PASS), CIM_NS) + vsms_cn = get_typed_class(virt, 'VirtualSystemManagementService') + try: + inst = conn.EnumerateInstances(vsms_cn) + revision = inst[0]['Revision'] + changeset = inst[0]['Changeset'] + except Exception: + return None, None + return revision, changeset +

ZL> # HG changeset patch ZL> # User Zhengang Li <lizg@cn.ibm.com> ZL> # Date 1208344854 -28800 ZL> # Node ID 5d2e26fe8b594894946b95598aac5c43a6d3f0d0 ZL> # Parent e54b31ce89af19ca0d4c40ce4b097685e34aa2c7 ZL> [TEST] Retrieve revision and changeset string ZL> The two properties can be accessed in test cases as ZL> 'main.revision', 'main.changeset' This is a fine way to do this, but I'm curious: how will it impact the performance of the test suite? If we do this before every test, will it make the suite take a measurable amount of additional time to run? These values won't change during a single run, so I had envisioned this being fetched once at the beginning and passed to each test case. That may not be feasible with the current architecture, so I have no real complaint here, I'm just wondering. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
ZL> # HG changeset patch ZL> # User Zhengang Li <lizg@cn.ibm.com> ZL> # Date 1208344854 -28800 ZL> # Node ID 5d2e26fe8b594894946b95598aac5c43a6d3f0d0 ZL> # Parent e54b31ce89af19ca0d4c40ce4b097685e34aa2c7 ZL> [TEST] Retrieve revision and changeset string
ZL> The two properties can be accessed in test cases as ZL> 'main.revision', 'main.changeset'
This is a fine way to do this, but I'm curious: how will it impact the performance of the test suite? If we do this before every test, will it make the suite take a measurable amount of additional time to run?
These values won't change during a single run, so I had envisioned this being fetched once at the beginning and passed to each test case. That may not be feasible with the current architecture, so I have no real complaint here, I'm just wondering.
suites/libvirt-cim/main.py calls each testcase as an individual program, so nothing really gets persisted except for the few things that get set as environment variables. I had originally thought do try was a good way to go, but the other problem with this is that it forces libvirt-cim implementation details into lib/CimTest/Globals.py, which is mostly implementation agnostic. I suppose you could set these values as env variables, which would provider faster access than writing the values out to a file or something similar. We have a fair number of env vars already, and I don't want to rely on them. But this might be a good place to argue the use of them. =) -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Dan Smith
-
Kaitlin Rupert
-
zli@linux.vnet.ibm.com