[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Add a read-verify block device test to xm-test.
# HG changeset patch # User harry@xxxxxxxxxxxxxxxxxxxxx # Node ID 9b11eeab4558a43c7c6f979d7e231f3245e6ce71 # Parent 224e9878c6d45d36d8d215706406d4ba91b3d6bb Add a read-verify block device test to xm-test. --- tools/xm-test/configure.ac | 1 tools/xm-test/tests/Makefile.am | 7 - tools/xm-test/tests/block-integrity/01_block_device_read_verify.py | 62 ++++++++++ tools/xm-test/tests/block-integrity/Makefile.am | 21 +++ 4 files changed, 88 insertions(+), 3 deletions(-) diff -r 224e9878c6d4 -r 9b11eeab4558 tools/xm-test/configure.ac --- a/tools/xm-test/configure.ac Fri May 19 16:29:34 2006 +0100 +++ b/tools/xm-test/configure.ac Fri May 19 16:30:21 2006 +0100 @@ -99,6 +99,7 @@ AC_CONFIG_FILES([ tests/block-list/Makefile tests/block-create/Makefile tests/block-destroy/Makefile + tests/block-integrity/Makefile tests/console/Makefile tests/create/Makefile tests/destroy/Makefile diff -r 224e9878c6d4 -r 9b11eeab4558 tools/xm-test/tests/Makefile.am --- a/tools/xm-test/tests/Makefile.am Fri May 19 16:29:34 2006 +0100 +++ b/tools/xm-test/tests/Makefile.am Fri May 19 16:30:21 2006 +0100 @@ -1,14 +1,15 @@ SUBDIRS = \ SUBDIRS = \ block-create \ - block-list \ - block-destroy \ + block-list \ + block-destroy \ + block-integrity \ console \ create \ destroy \ dmesg \ domid \ domname \ - help \ + help \ info \ list \ memmax \ diff -r 224e9878c6d4 -r 9b11eeab4558 tools/xm-test/tests/block-integrity/01_block_device_read_verify.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/xm-test/tests/block-integrity/01_block_device_read_verify.py Fri May 19 16:30:21 2006 +0100 @@ -0,0 +1,62 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2006 +# Author: Harry Butterworth <butterwo@xxxxxxxxxx> + +# This test initialises a ram disk in dom0 with data from /dev/urandom and +# then imports the ram disk device as a physical device into a domU. The md5 +# checksum of the data in the ramdisk is calculated in dom0 and also +# calculated by the domU reading the data through the blk frontend and +# backend drivers. The test succeeds if the checksums match indicating that +# the domU successfully read all the correct data from 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) + +traceCommand("cat /dev/urandom > /dev/ram1") + +s, o = traceCommand("md5sum /dev/ram1") + +dom0_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", o) + +block_attach(domain, "phy:ram1", "hda1") + +try: + run = console.runCmd("md5sum /dev/hda1") +except ConsoleError, e: + FAIL(str(e)) + +domU_md5sum_match = re.search(r"^[\dA-Fa-f]{32}", run["output"]) + +domain.closeConsole() + +domain.stop() + +if dom0_md5sum_match == None: + FAIL("Failed to get md5sum of test ram disk in dom0.") + +if domU_md5sum_match == None: + FAIL("Failed to get md5sum of test ram disk in domU.") + +if verbose: + print "md5sum dom0:" + print dom0_md5sum_match.group() + print "md5sum domU:" + print domU_md5sum_match.group() + +if dom0_md5sum_match.group() != domU_md5sum_match.group(): + FAIL("MISCOMPARE: data read in domU did not match data provided by domO.") diff -r 224e9878c6d4 -r 9b11eeab4558 tools/xm-test/tests/block-integrity/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/xm-test/tests/block-integrity/Makefile.am Fri May 19 16:30:21 2006 +0100 @@ -0,0 +1,21 @@ + +SUBDIRS = + +TESTS = 01_block_device_read_verify.test + +XFAIL_TESTS = + +EXTRA_DIST = $(TESTS) $(XFAIL_TESTS) + +TESTS_ENVIRONMENT=@TENV@ + +%.test: %.py + cp $< $@ + chmod +x $@ + +clean-local: am_config_clean-local + +am_config_clean-local: + rm -f *test + rm -f *log + rm -f *~ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |