ia64/xen-unstable

changeset 10338:a1b83fedc4ed

Add sched-credit xm tests but don't run them by default yet...
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
author ack@localhost.localdomain
date Thu Jun 08 11:35:27 2006 +0100 (2006-06-08)
parents fe35ddc5fd38
children 2db7b3627da4
files tools/xm-test/configure.ac tools/xm-test/tests/Makefile.am tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py tools/xm-test/tests/sched-credit/Makefile.am
line diff
     1.1 --- a/tools/xm-test/configure.ac	Thu Jun 08 10:24:48 2006 +0100
     1.2 +++ b/tools/xm-test/configure.ac	Thu Jun 08 11:35:27 2006 +0100
     1.3 @@ -118,6 +118,7 @@ AC_CONFIG_FILES([
     1.4      tests/reboot/Makefile
     1.5      tests/restore/Makefile
     1.6      tests/save/Makefile
     1.7 +    tests/sched-credit/Makefile
     1.8      tests/sedf/Makefile
     1.9      tests/shutdown/Makefile
    1.10      tests/sysrq/Makefile
     2.1 --- a/tools/xm-test/tests/Makefile.am	Thu Jun 08 10:24:48 2006 +0100
     2.2 +++ b/tools/xm-test/tests/Makefile.am	Thu Jun 08 11:35:27 2006 +0100
     2.3 @@ -18,6 +18,7 @@ SUBDIRS = 	               	\
     2.4  		network-attach	\
     2.5  		pause		\
     2.6  		reboot 		\
     2.7 +		sched-credit	\
     2.8  		sedf		\
     2.9  		shutdown	\
    2.10  		sysrq		\
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py	Thu Jun 08 11:35:27 2006 +0100
     3.3 @@ -0,0 +1,65 @@
     3.4 +#!/usr/bin/python
     3.5 +#
     3.6 +# Sched-credit tests modified from SEDF tests
     3.7 +#
     3.8 +from XmTestLib import *
     3.9 +
    3.10 +def get_sched_credit_params(domain):
    3.11 +    status, output = traceCommand("xm sched-credit -d %s" %(domain.getName()))
    3.12 +    params = output.strip('{}').split(', ')
    3.13 +    cap = int(params[0].split(':')[1].strip(' '))
    3.14 +    weight = int(params[1].split(':')[1].strip(' '))
    3.15 +    return (status, (weight, cap))
    3.16 +
    3.17 +def set_sched_credit_weight(domain, weight):
    3.18 +    status, output = traceCommand("xm sched-credit -d %s -w %d" %(domain.getName(), weight))
    3.19 +    return status
    3.20 +
    3.21 +def set_sched_credit_cap(domain, cap):
    3.22 +    status, output = traceCommand("xm sched-credit -d %s -c %d" %(domain.getName(), cap))
    3.23 +    return status
    3.24 +
    3.25 +
    3.26 +domain = XmTestDomain()
    3.27 +
    3.28 +try:
    3.29 +    domain.start(noConsole=True)
    3.30 +except DomainError, e:
    3.31 +    if verbose:
    3.32 +        print "Failed to create test domain because:"
    3.33 +        print e.extra
    3.34 +    FAIL(str(e))
    3.35 +
    3.36 +# check default param values
    3.37 +(status, params) = get_sched_credit_params(domain)
    3.38 +if status != 0:
    3.39 +    FAIL("Getting sched-credit parameters return non-zero rv (%d)", status)
    3.40 +
    3.41 +(weight, cap) = params
    3.42 +if weight != 256:
    3.43 +    FAIL("default weight is 256 (got %d)", weight)
    3.44 +if cap != 0:
    3.45 +    FAIL("default cap is 0 (got %d)", cap)
    3.46 +
    3.47 +# set new parameters
    3.48 +status = set_sched_credit_weight(domain, 512)
    3.49 +if status != 0:
    3.50 +    FAIL("Setting sched-credit weight return non-zero rv (%d)", status)
    3.51 +
    3.52 +status = set_sched_credit_cap(domain, 100)
    3.53 +if status != 0:
    3.54 +    FAIL("Setting sched-credit cap return non-zero rv (%d)", status)
    3.55 +
    3.56 +# check new param values
    3.57 +(status, params) = get_sched_credit_params(domain)
    3.58 +if status != 0:
    3.59 +    FAIL("Getting sched-credit parameters return non-zero rv (%d)", status)
    3.60 +
    3.61 +(weight, cap) = params
    3.62 +if weight != 512:
    3.63 +    FAIL("expected weight of 512 (got %d)", weight)
    3.64 +if cap != 100:
    3.65 +    FAIL("expected cap of 100 (got %d)", cap)
    3.66 +
    3.67 +# Stop the domain (nice shutdown)
    3.68 +domain.stop()
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/xm-test/tests/sched-credit/Makefile.am	Thu Jun 08 11:35:27 2006 +0100
     4.3 @@ -0,0 +1,20 @@
     4.4 +SUBDIRS =
     4.5 +
     4.6 +TESTS = 01_sched_credit_weight_cap_pos.test
     4.7 +
     4.8 +XFAIL_TESTS = 
     4.9 +
    4.10 +EXTRA_DIST = $(TESTS) $(XFAIL_TESTS)
    4.11 +
    4.12 +TESTS_ENVIRONMENT=@TENV@
    4.13 +
    4.14 +%.test: %.py
    4.15 +	cp $< $@
    4.16 +	chmod +x $@
    4.17 +
    4.18 +clean-local: am_config_clean-local
    4.19 +
    4.20 +am_config_clean-local:
    4.21 +	rm -f *test
    4.22 +	rm -f *log
    4.23 +	rm -f *~