ia64/xen-unstable

changeset 10317:f99ba86ad96b

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@uk.ibm.com>
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Thu Jun 01 11:47:00 2006 +0100 (2006-06-01)
parents 4142bfd01e02
children 057c5554f8c3
files tools/xm-test/configure.ac tools/xm-test/grouptest/default tools/xm-test/ramdisk/configs/busybox tools/xm-test/tests/block-integrity/02_block_device_write_verify.py tools/xm-test/tests/block-integrity/Makefile.am
line diff
     1.1 --- a/tools/xm-test/configure.ac	Thu Jun 01 11:25:02 2006 +0100
     1.2 +++ b/tools/xm-test/configure.ac	Thu Jun 01 11:47:00 2006 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  # xm-test configure.ac input script
     1.5  
     1.6  # Basic header information
     1.7 -AC_INIT([xm-test], [0.7.1])
     1.8 +AC_INIT([xm-test], [0.8.0])
     1.9  AM_INIT_AUTOMAKE([1.7 foreign])
    1.10  
    1.11  # Check for dependencies
     2.1 --- a/tools/xm-test/grouptest/default	Thu Jun 01 11:25:02 2006 +0100
     2.2 +++ b/tools/xm-test/grouptest/default	Thu Jun 01 11:47:00 2006 +0100
     2.3 @@ -1,6 +1,7 @@
     2.4  block-create
     2.5  block-destroy
     2.6  block-list
     2.7 +block-integrity
     2.8  console
     2.9  create
    2.10  destroy
     3.1 --- a/tools/xm-test/ramdisk/configs/busybox	Thu Jun 01 11:25:02 2006 +0100
     3.2 +++ b/tools/xm-test/ramdisk/configs/busybox	Thu Jun 01 11:47:00 2006 +0100
     3.3 @@ -127,8 +127,8 @@ CONFIG_STTY=y
     3.4  CONFIG_SYNC=y
     3.5  CONFIG_TAIL=y
     3.6  CONFIG_FEATURE_FANCY_TAIL=n
     3.7 -CONFIG_TEE=n
     3.8 -CONFIG_FEATURE_TEE_USE_BLOCK_IO=n
     3.9 +CONFIG_TEE=y
    3.10 +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
    3.11  CONFIG_TEST=y
    3.12  
    3.13  #
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/xm-test/tests/block-integrity/02_block_device_write_verify.py	Thu Jun 01 11:47:00 2006 +0100
     4.3 @@ -0,0 +1,63 @@
     4.4 +#!/usr/bin/python
     4.5 +
     4.6 +# Copyright (C) International Business Machines Corp., 2006
     4.7 +# Author: Harry Butterworth <butterwo@uk.ibm.com>
     4.8 +
     4.9 +# This test imports a ram disk device as a physical device into a domU.
    4.10 +# The domU initialises the ram disk with data from /dev/urandom and calculates
    4.11 +# the md5 checksum of the data (using tee as it is written so as to avoid
    4.12 +# reading it back from the device which might potentially mask problems).
    4.13 +# The domU is stopped and the md5 checksum of the data on the device is
    4.14 +# calculated by dom0.  The test succeeds if the checksums match, indicating
    4.15 +# that all the data written by domU was sucessfully committed to the device.
    4.16 +
    4.17 +import re
    4.18 +
    4.19 +from XmTestLib import *
    4.20 +from XmTestLib.block_utils import *
    4.21 +
    4.22 +if ENABLE_HVM_SUPPORT:
    4.23 +    SKIP("Block-attach not supported for HVM domains")
    4.24 +
    4.25 +domain = XmTestDomain()
    4.26 +
    4.27 +try:
    4.28 +    console = domain.start()
    4.29 +except DomainError, e:
    4.30 +    FAIL(str(e))
    4.31 +
    4.32 +console.setHistorySaveCmds(value=True)
    4.33 +
    4.34 +block_attach(domain, "phy:ram1", "hda1")
    4.35 +
    4.36 +console.setTimeout(120)
    4.37 +
    4.38 +try:
    4.39 +    run = console.runCmd("dd if=/dev/urandom bs=512 count=`cat /sys/block/hda1/size` | tee /dev/hda1 | md5sum")
    4.40 +except ConsoleError, e:
    4.41 +    FAIL(str(e))
    4.42 +
    4.43 +domU_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", run["output"])
    4.44 +
    4.45 +domain.closeConsole()
    4.46 +
    4.47 +domain.stop()
    4.48 +
    4.49 +s, o = traceCommand("md5sum /dev/ram1")
    4.50 +
    4.51 +dom0_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", o)
    4.52 +
    4.53 +if domU_md5sum_match == None:
    4.54 +    FAIL("Failed to get md5sum of data written in domU.")
    4.55 +
    4.56 +if dom0_md5sum_match == None:
    4.57 +    FAIL("Failed to get md5sum of data read back in dom0.")
    4.58 +
    4.59 +if verbose:
    4.60 +    print "md5sum domU:"
    4.61 +    print domU_md5sum_match.group()
    4.62 +    print "md5sum dom0:"
    4.63 +    print dom0_md5sum_match.group()
    4.64 +
    4.65 +if domU_md5sum_match.group() != dom0_md5sum_match.group():
    4.66 +    FAIL("MISCOMPARE: data read in dom0 did not match data written by domU.")
     5.1 --- a/tools/xm-test/tests/block-integrity/Makefile.am	Thu Jun 01 11:25:02 2006 +0100
     5.2 +++ b/tools/xm-test/tests/block-integrity/Makefile.am	Thu Jun 01 11:47:00 2006 +0100
     5.3 @@ -1,7 +1,8 @@
     5.4  
     5.5  SUBDIRS =
     5.6  
     5.7 -TESTS = 01_block_device_read_verify.test
     5.8 +TESTS = 01_block_device_read_verify.test \
     5.9 +        02_block_device_write_verify.test
    5.10  
    5.11  XFAIL_TESTS = 
    5.12