Commit 4a7fae9 changed the revision returned by get_provider_version
to a string. However, the revision has to be a number because (since
git is used) it's basically the number of commits in HEAD.
Comparing a string against an int in Python 2.x will always result in
the string value being greater than the int value. Since there
are a lot of compares against revision numbers all over the test
scripts, this change is probably the most economic.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
Not being a python guy I got wacked myself when I was testing
my (soon to come) cimtest changes against a pre-console libvirt-cim.
'1272' > 1276 silently returned True leading to epic failures :-(
suites/libvirt-cim/lib/XenKvmLib/const.py | 4 +++-
suites/libvirt-cim/lib/XenKvmLib/reporting.py | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/suites/libvirt-cim/lib/XenKvmLib/const.py
b/suites/libvirt-cim/lib/XenKvmLib/const.py
index a8d0254..a454b2f 100755
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py
@@ -179,7 +179,9 @@ def get_provider_version(virt, ip):
revision = revision.strip("+")
if revision.isdigit():
revision = int(revision)
+ else:
+ raise Exception("revision %s is not a digit", revision)
- return str(revision), str(changeset)
+ return revision, changeset
diff --git a/suites/libvirt-cim/lib/XenKvmLib/reporting.py
b/suites/libvirt-cim/lib/XenKvmLib/reporting.py
index 67ec974..88375b0 100644
--- a/suites/libvirt-cim/lib/XenKvmLib/reporting.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/reporting.py
@@ -101,7 +101,7 @@ def get_env_data(ip, virt):
rev, changeset = get_provider_version(virt, ip)
cimtest_revision, cimtest_changeset = get_cimtest_version()
- lc_ver = "Libvirt-cim revision: %s\nLibvirt-cim changeset: %s\n" % \
+ lc_ver = "Libvirt-cim revision: %d\nLibvirt-cim changeset: %s\n" % \
(rev, changeset)
cimtest_ver = "Cimtest revision: %s\nCimtest changeset: %s\n" % \
(cimtest_revision, cimtest_changeset)
--
1.7.9.5