[PATCH]Add the revision and the changeset of Cimtest to the test report

# HG changeset patch # User Toshifumi Fujimura<fujimura.toshifumi@np.css.fujitsu.com> # Date 1225162881 -32400 # Node ID e735bda49b6b5dc2ab96c8626808e97a64711b57 # Parent 0f340004e1cd48f5ede60a68283a850ae60c9ebe [PATCH]Add the revision and the changeset of Cimtest to the test report Hi, This patch adds the revision and the changeset of Cimtest to the test report "run_report.txt". Since Cimtest updates frequently, we need to know the cimtest version in the test reports, After this change, the header is like follows. ================================================ KVM on Pegasus Test Run Summary for Oct 27 2008 ================================================= Distro: Fedora release 9.92 (Rawhide) Kernel: 2.6.27.3-34.rc1.fc10.i686.PAE libvirt: 0.4.6 Hypervisor: QEMU 0.9.1 CIMOM: Pegasus 2.7.1 Libvirt-cim revision: 725 Libvirt-cim changeset: e043f46f299e Cimtest revision: 459 Cimtest changeset: 0f340004e1cd ================================================= Signed-off-by: Toshifumi Fujimura <fujimura.toshifumi@np.css.fujitsu.com> diff -r 0f340004e1cd suites/libvirt-cim/lib/XenKvmLib/reporting.py --- a/suites/libvirt-cim/lib/XenKvmLib/reporting.py Fri Oct 24 01:04:38 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/reporting.py Tue Oct 28 09:52:47 2008 +0900 @@ -25,6 +25,14 @@ from time import gmtime, strftime from VirtLib import utils from XenKvmLib.const import get_provider_version + +def get_cimtest_revision(): + revision = commands.getoutput("hg parents --template \"{rev}\"") + return revision + +def get_cimtest_changeset(): + changeset = commands.getoutput("hg parents --template \"{node|short}\"") + return changeset def get_cmd_val(cmd, ip): rc, out = utils.run_remote(ip, cmd) @@ -137,6 +145,10 @@ cimom, cimom_ver = get_cimom_ver(ip) + cimtest_revision = get_cimtest_revision() + cimtest_changeset = get_cimtest_changeset() + cimtest_info = "Cimtest revision: %s\nCimtest changeset: %s\n" % (cimtest_revision, cimtest_changeset) + heading = "%s on %s Test Run Summary for %s" % (virt, cimom, date) sys_env = get_env_data(ip, virt) @@ -146,7 +158,7 @@ res, res_total, test_block = build_report_body(rvals, tstr, divider) - report = divider + heading + "\n" + divider + sys_env + divider + res \ + report = divider + heading + "\n" + divider + sys_env + cimtest_info + divider + res \ + res_total + divider + test_block + "Full report:\n" \ + run_output -- Toshifumi Fujimura.

Thanks so much for submitting a patch! =) I'm glad you got libvirt-cim and cimtest setup and running. Just a few minor changes..
+ +def get_cimtest_revision(): + revision = commands.getoutput("hg parents --template \"{rev}\"") + return revision + +def get_cimtest_changeset(): + changeset = commands.getoutput("hg parents --template \"{node|short}\"") + return changeset
If you check out the directory with user x, but then run "hg parents --template \"{rev}\"" from that directory as user y, you'll see something like the follwoing: [root@elm3b41 cimtest]# hg parents --template \"{rev}\"Not trusting file /tmp/cimtest/.hg/hgrc from untrusted user kaitlin, group cim Not trusting file /tmp/cimtest/.hg/hgrc from untrusted user kaitlin, group cim "459" Can you strip out everything but the revision number and changeset number?
def get_cmd_val(cmd, ip): rc, out = utils.run_remote(ip, cmd) @@ -137,6 +145,10 @@
cimom, cimom_ver = get_cimom_ver(ip)
+ cimtest_revision = get_cimtest_revision() + cimtest_changeset = get_cimtest_changeset() + cimtest_info = "Cimtest revision: %s\nCimtest changeset: %s\n" % (cimtest_revision, cimtest_changeset) +
This line wraps over 80 characters. Can you split it into 2 lines? Also, this block of code can be moved to the get_env_data() function. get_env_data() builds the header block for the test run.
heading = "%s on %s Test Run Summary for %s" % (virt, cimom, date) sys_env = get_env_data(ip, virt)
@@ -146,7 +158,7 @@
res, res_total, test_block = build_report_body(rvals, tstr, divider)
- report = divider + heading + "\n" + divider + sys_env + divider + res \ + report = divider + heading + "\n" + divider + sys_env + cimtest_info + divider + res \
So this can also be moved to get_env_data() - you can add cimtest_info to the return statement. Thanks again - this looks great! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

# HG changeset patch # User Toshifumi Fujimura<fujimura.toshifumi@np.css.fujitsu.com> # Date 1225266738 -32400 # Node ID 743d9fcc2cc050f8a299bc29a598332baa754d7a # Parent 0f340004e1cd48f5ede60a68283a850ae60c9ebe [PATCH][TEST]#2 Add the revision and the changeset of Cimtest to the test report I modify two points. *strip out everything but the revision number and changeset number *move Cimtest strings to the get_env_data() diff -r 0f340004e1cd -r 743d9fcc2cc0 suites/libvirt-cim/lib/XenKvmLib/reporting.py --- a/suites/libvirt-cim/lib/XenKvmLib/reporting.py Fri Oct 24 01:04:38 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/reporting.py Wed Oct 29 16:52:18 2008 +0900 @@ -32,6 +32,11 @@ return "Unknown" return out +def get_cimtest_version(): + revision = commands.getoutput("hg parents --template \"{rev}\" 2>/dev/null") + changeset = commands.getoutput("hg parents --template \"{node|short}\" 2>/dev/null") + return revision, changeset + def get_libvirt_ver(ip): libvirt_ver = "Unknown" hyp_ver = "Unknown" @@ -80,11 +85,14 @@ % (distro, kernel_ver, libvirt_ver, hyp_ver, cimom, cimom_ver) 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" % \ (rev, changeset) + cimtest_ver = "Cimtest revision: %s\nCimtest changeset: %s\n" % \ + (cimtest_revision, cimtest_changeset) - return env + lc_ver + return env + lc_ver + cimtest_ver def parse_run_output(log_file): rvals = { 'PASS' : 0, -- Toshifumi Fujimura.

Toshifumi Fujimura wrote:
# HG changeset patch # User Toshifumi Fujimura<fujimura.toshifumi@np.css.fujitsu.com> # Date 1225266738 -32400 # Node ID 743d9fcc2cc050f8a299bc29a598332baa754d7a # Parent 0f340004e1cd48f5ede60a68283a850ae60c9ebe [PATCH][TEST]#2 Add the revision and the changeset of Cimtest to the test report I modify two points. *strip out everything but the revision number and changeset number *move Cimtest strings to the get_env_data()
You'll need to include your DCO here.
diff -r 0f340004e1cd -r 743d9fcc2cc0 suites/libvirt-cim/lib/XenKvmLib/reporting.py --- a/suites/libvirt-cim/lib/XenKvmLib/reporting.py Fri Oct 24 01:04:38 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/reporting.py Wed Oct 29 16:52:18 2008 +0900 @@ -32,6 +32,11 @@ return "Unknown" return out
+def get_cimtest_version(): + revision = commands.getoutput("hg parents --template \"{rev}\" 2>/dev/null") + changeset = commands.getoutput("hg parents --template \"{node|short}\" 2>/dev/null")
Can you split this line into two lines - it is longer than 80 characters. Also, I'm having trouble applying this patch. Can you send the next version as an attachment? Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Kaitlin Rupert
-
Toshifumi Fujimura