ia64/xen-unstable

changeset 8054:e2e18ef3b204

Add sanity checks that let us know if there are any problems before
we run the entire suite
author dan@elm3b196.beaverton.ibm.com
date Fri Nov 25 15:17:37 2005 +0000 (2005-11-25)
parents 421ea766aaa0
children 206731134e18
files tools/xm-test/configure.ac tools/xm-test/runtest.sh tools/xm-test/tests/_sanity/01_domu_proc.py tools/xm-test/tests/_sanity/Makefile.am
line diff
     1.1 --- a/tools/xm-test/configure.ac	Fri Nov 25 15:17:18 2005 +0000
     1.2 +++ b/tools/xm-test/configure.ac	Fri Nov 25 15:17:37 2005 +0000
     1.3 @@ -35,6 +35,7 @@ AC_CONFIG_FILES([
     1.4      Makefile 
     1.5      ramdisk/Makefile
     1.6      tests/Makefile
     1.7 +    tests/_sanity/Makefile
     1.8      tests/block-list/Makefile
     1.9      tests/block-create/Makefile
    1.10      tests/block-destroy/Makefile
     2.1 --- a/tools/xm-test/runtest.sh	Fri Nov 25 15:17:18 2005 +0000
     2.2 +++ b/tools/xm-test/runtest.sh	Fri Nov 25 15:17:37 2005 +0000
     2.3 @@ -86,6 +86,15 @@ runnable_tests() {
     2.4  	exit 1
     2.5      fi
     2.6  
     2.7 +    # Run a few sample tests to make sure things are working
     2.8 +    # before we take the plunge
     2.9 +    echo "Running sanity checks..."
    2.10 +    make -C tests/_sanity check 2>&1 | grep REASON
    2.11 +    if [ $? -eq 0 ]; then
    2.12 +	echo "Sanity checks failed"
    2.13 +	exit 1
    2.14 +    fi
    2.15 +
    2.16  }
    2.17  
    2.18  # Get contact info if needed
    2.19 @@ -119,7 +128,7 @@ get_contact_info() {
    2.20  # Run the tests
    2.21  run_tests() {
    2.22      output=$1
    2.23 -    echo Running tests...
    2.24 +    echo Running real tests...
    2.25      TEST_VERBOSE=1 make -k check > $output 2>&1
    2.26  }
    2.27  
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/xm-test/tests/_sanity/01_domu_proc.py	Fri Nov 25 15:17:37 2005 +0000
     3.3 @@ -0,0 +1,34 @@
     3.4 +#!/usr/bin/python
     3.5 +
     3.6 +# Copyright (C) International Business Machines Corp., 2005
     3.7 +# Author: Dan Smith <danms@us.ibm.com>
     3.8 +
     3.9 +#
    3.10 +# Test that the library and ramdisk are working to the point
    3.11 +# that we can start a DomU and read /proc
    3.12 +#
    3.13 +
    3.14 +from XmTestLib import *
    3.15 +
    3.16 +import re
    3.17 +
    3.18 +domain = XmTestDomain()
    3.19 +
    3.20 +try:
    3.21 +    domain.start()
    3.22 +except DomainError, e:
    3.23 +    FAIL(str(e))
    3.24 +
    3.25 +try:
    3.26 +    console = XmConsole(domain.getName())
    3.27 +    console.sendInput("foo")
    3.28 +    run = console.runCmd("cat /proc/cpuinfo")
    3.29 +except ConsoleError, e:
    3.30 +    FAIL(str(e))
    3.31 +
    3.32 +if run["return"] != 0:
    3.33 +    FAIL("Unable to read /proc/cpuinfo")
    3.34 +
    3.35 +if not re.search("processor", run["output"]):
    3.36 +    print run["output"]
    3.37 +    FAIL("/proc/cpuinfo looks wrong!")
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/xm-test/tests/_sanity/Makefile.am	Fri Nov 25 15:17:37 2005 +0000
     4.3 @@ -0,0 +1,21 @@
     4.4 +
     4.5 +SUBDIRS =
     4.6 +
     4.7 +TESTS = 01_domu_proc.test 
     4.8 +
     4.9 +XFAIL_TESTS = 
    4.10 +
    4.11 +EXTRA_DIST = $(TESTS) $(XFAIL_TESTS)
    4.12 +
    4.13 +TESTS_ENVIRONMENT=@TENV@
    4.14 +
    4.15 +%.test: %.py
    4.16 +	cp $< $@
    4.17 +	chmod +x $@
    4.18 +
    4.19 +clean-local: am_config_clean-local
    4.20 +
    4.21 +am_config_clean-local:
    4.22 +	rm -f *test
    4.23 +	rm -f *log
    4.24 +	rm -f *~