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

[Xen-changelog] [xen-unstable] Block device write-verify test.



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID f99ba86ad96b5c19a95592fa8b0cb4dfcf02dd57
# Parent  4142bfd01e0212afb8834b01a146ddfb609e6ac5
Block device write-verify test.

This test imports a ram disk device as a physical device into a domU.
The domU initialises the ram disk with data from /dev/urandom and
calculates the md5 checksum of the data (using tee as it is written so as to
avoid reading it back from the device which might potentially mask
problems).
The domU is stopped and the md5 checksum of the data on the device is
calculated by dom0.  The test succeeds if the checksums match, indicating
that all the data written by domU was sucessfully committed to the
device.

This patch also enables tee in BusyBox on the ramdisk and increments the
xm-test version number to 0.8.0.

The patch also installs the block-integrity tests in the default test
set so they get executed.

Signed-off-by: Harry Butterworth <butterwo@xxxxxxxxxx>
Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/xm-test/configure.ac                                          |    2 
 tools/xm-test/grouptest/default                                     |    1 
 tools/xm-test/ramdisk/configs/busybox                               |    4 
 tools/xm-test/tests/block-integrity/02_block_device_write_verify.py |   63 
++++++++++
 tools/xm-test/tests/block-integrity/Makefile.am                     |    3 
 5 files changed, 69 insertions(+), 4 deletions(-)

diff -r 4142bfd01e02 -r f99ba86ad96b tools/xm-test/configure.ac
--- a/tools/xm-test/configure.ac        Thu Jun 01 11:25:02 2006 +0100
+++ b/tools/xm-test/configure.ac        Thu Jun 01 11:47:00 2006 +0100
@@ -1,7 +1,7 @@
 # xm-test configure.ac input script
 
 # Basic header information
-AC_INIT([xm-test], [0.7.1])
+AC_INIT([xm-test], [0.8.0])
 AM_INIT_AUTOMAKE([1.7 foreign])
 
 # Check for dependencies
diff -r 4142bfd01e02 -r f99ba86ad96b tools/xm-test/grouptest/default
--- a/tools/xm-test/grouptest/default   Thu Jun 01 11:25:02 2006 +0100
+++ b/tools/xm-test/grouptest/default   Thu Jun 01 11:47:00 2006 +0100
@@ -1,6 +1,7 @@ block-create
 block-create
 block-destroy
 block-list
+block-integrity
 console
 create
 destroy
diff -r 4142bfd01e02 -r f99ba86ad96b tools/xm-test/ramdisk/configs/busybox
--- a/tools/xm-test/ramdisk/configs/busybox     Thu Jun 01 11:25:02 2006 +0100
+++ b/tools/xm-test/ramdisk/configs/busybox     Thu Jun 01 11:47:00 2006 +0100
@@ -127,8 +127,8 @@ CONFIG_SYNC=y
 CONFIG_SYNC=y
 CONFIG_TAIL=y
 CONFIG_FEATURE_FANCY_TAIL=n
-CONFIG_TEE=n
-CONFIG_FEATURE_TEE_USE_BLOCK_IO=n
+CONFIG_TEE=y
+CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
 CONFIG_TEST=y
 
 #
diff -r 4142bfd01e02 -r f99ba86ad96b 
tools/xm-test/tests/block-integrity/Makefile.am
--- a/tools/xm-test/tests/block-integrity/Makefile.am   Thu Jun 01 11:25:02 
2006 +0100
+++ b/tools/xm-test/tests/block-integrity/Makefile.am   Thu Jun 01 11:47:00 
2006 +0100
@@ -1,7 +1,8 @@
 
 SUBDIRS =
 
-TESTS = 01_block_device_read_verify.test
+TESTS = 01_block_device_read_verify.test \
+        02_block_device_write_verify.test
 
 XFAIL_TESTS = 
 
diff -r 4142bfd01e02 -r f99ba86ad96b 
tools/xm-test/tests/block-integrity/02_block_device_write_verify.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/tests/block-integrity/02_block_device_write_verify.py       
Thu Jun 01 11:47:00 2006 +0100
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author: Harry Butterworth <butterwo@xxxxxxxxxx>
+
+# This test imports a ram disk device as a physical device into a domU.
+# The domU initialises the ram disk with data from /dev/urandom and calculates
+# the md5 checksum of the data (using tee as it is written so as to avoid
+# reading it back from the device which might potentially mask problems).
+# The domU is stopped and the md5 checksum of the data on the device is
+# calculated by dom0.  The test succeeds if the checksums match, indicating
+# that all the data written by domU was sucessfully committed to the device.
+
+import re
+
+from XmTestLib import *
+from XmTestLib.block_utils import *
+
+if ENABLE_HVM_SUPPORT:
+    SKIP("Block-attach not supported for HVM domains")
+
+domain = XmTestDomain()
+
+try:
+    console = domain.start()
+except DomainError, e:
+    FAIL(str(e))
+
+console.setHistorySaveCmds(value=True)
+
+block_attach(domain, "phy:ram1", "hda1")
+
+console.setTimeout(120)
+
+try:
+    run = console.runCmd("dd if=/dev/urandom bs=512 count=`cat 
/sys/block/hda1/size` | tee /dev/hda1 | md5sum")
+except ConsoleError, e:
+    FAIL(str(e))
+
+domU_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", run["output"])
+
+domain.closeConsole()
+
+domain.stop()
+
+s, o = traceCommand("md5sum /dev/ram1")
+
+dom0_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", o)
+
+if domU_md5sum_match == None:
+    FAIL("Failed to get md5sum of data written in domU.")
+
+if dom0_md5sum_match == None:
+    FAIL("Failed to get md5sum of data read back in dom0.")
+
+if verbose:
+    print "md5sum domU:"
+    print domU_md5sum_match.group()
+    print "md5sum dom0:"
+    print dom0_md5sum_match.group()
+
+if domU_md5sum_match.group() != dom0_md5sum_match.group():
+    FAIL("MISCOMPARE: data read in dom0 did not match data written by 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®.