[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XM-TEST] Fix 02_block_device_write_verify.py test to parse md5sum output correctly.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 5d4b9dc8821809768c2948f625e6f7e5597f4b5c
# Parent  0de8a4a023d05f5468e7e2130d6b29ab5b99faa7
[XM-TEST] Fix 02_block_device_write_verify.py test to parse md5sum output 
correctly.

The 02_block_device_write_verify.py test that I wrote is failing because
the regular expression to extract the md5sum is only looking at the
first line of output and the sum is in a subsequent line (after the
output from dd).

This patch fixes the test by adding the multiline flag to the search
parameters so that the search looks in all lines of the output for the
md5sum.  I added the multiline flag in all searches to make the tests
more robust against changes in the output format of the commands used.

I'm not exactly sure how this slipped through my testing.  I suspect
that I forgot to install the new python file after updating the test to
use dd and then tested the old version a second time by accident.
Either that or it really did work when I tested it and the output format
has changed for some reason.

I tested this patch against xen-unstable 10326 and the 02 test fails
without the patch and succeeds with it.

Thanks to James Dykman for some help with this.

Signed-off-by Harry Butterworth <butterwo@xxxxxxxxxx>
---
 tools/xm-test/tests/block-integrity/01_block_device_read_verify.py  |    4 ++--
 tools/xm-test/tests/block-integrity/02_block_device_write_verify.py |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -r 0de8a4a023d0 -r 5d4b9dc88218 
tools/xm-test/tests/block-integrity/01_block_device_read_verify.py
--- a/tools/xm-test/tests/block-integrity/01_block_device_read_verify.py        
Tue Jun 13 15:38:58 2006 +0100
+++ b/tools/xm-test/tests/block-integrity/01_block_device_read_verify.py        
Tue Jun 13 15:41:27 2006 +0100
@@ -31,7 +31,7 @@ traceCommand("cat /dev/urandom > /dev/ra
 
 s, o = traceCommand("md5sum /dev/ram1")
 
-dom0_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", o)
+dom0_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", o, re.M)
 
 block_attach(domain, "phy:ram1", "hda1")
 
@@ -40,7 +40,7 @@ except ConsoleError, e:
 except ConsoleError, e:
     FAIL(str(e))
 
-domU_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", run["output"])
+domU_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", run["output"], re.M)
 
 domain.closeConsole()
 
diff -r 0de8a4a023d0 -r 5d4b9dc88218 
tools/xm-test/tests/block-integrity/02_block_device_write_verify.py
--- a/tools/xm-test/tests/block-integrity/02_block_device_write_verify.py       
Tue Jun 13 15:38:58 2006 +0100
+++ b/tools/xm-test/tests/block-integrity/02_block_device_write_verify.py       
Tue Jun 13 15:41:27 2006 +0100
@@ -37,7 +37,7 @@ except ConsoleError, e:
 except ConsoleError, e:
     FAIL(str(e))
 
-domU_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", run["output"])
+domU_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", run["output"], re.M)
 
 domain.closeConsole()
 
@@ -45,7 +45,7 @@ domain.stop()
 
 s, o = traceCommand("md5sum /dev/ram1")
 
-dom0_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", o)
+dom0_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", o, re.M)
 
 if domU_md5sum_match == None:
     FAIL("Failed to get md5sum of data written in domU.")

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.