# HG changeset patch
# User ack@xxxxxxxxxxxxxxxxxxxxx
# Node ID a1b83fedc4edcc00941d972484ff398e98a62186
# Parent fe35ddc5fd380f8c1cbc41b6f8df49874051effd
Add sched-credit xm tests but don't run them by default yet...
Signed-off-by: Emmanuel Ackaouy <ack@xxxxxxxxxxxxx>
---
tools/xm-test/configure.ac | 1
tools/xm-test/tests/Makefile.am | 1
tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py | 65
++++++++++
tools/xm-test/tests/sched-credit/Makefile.am | 20 +++
4 files changed, 87 insertions(+)
diff -r fe35ddc5fd38 -r a1b83fedc4ed tools/xm-test/configure.ac
--- a/tools/xm-test/configure.ac Thu Jun 08 10:24:48 2006 +0100
+++ b/tools/xm-test/configure.ac Thu Jun 08 11:35:27 2006 +0100
@@ -118,6 +118,7 @@ AC_CONFIG_FILES([
tests/reboot/Makefile
tests/restore/Makefile
tests/save/Makefile
+ tests/sched-credit/Makefile
tests/sedf/Makefile
tests/shutdown/Makefile
tests/sysrq/Makefile
diff -r fe35ddc5fd38 -r a1b83fedc4ed tools/xm-test/tests/Makefile.am
--- a/tools/xm-test/tests/Makefile.am Thu Jun 08 10:24:48 2006 +0100
+++ b/tools/xm-test/tests/Makefile.am Thu Jun 08 11:35:27 2006 +0100
@@ -18,6 +18,7 @@ SUBDIRS = \
network-attach \
pause \
reboot \
+ sched-credit \
sedf \
shutdown \
sysrq \
diff -r fe35ddc5fd38 -r a1b83fedc4ed
tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py
Thu Jun 08 11:35:27 2006 +0100
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+#
+# Sched-credit tests modified from SEDF tests
+#
+from XmTestLib import *
+
+def get_sched_credit_params(domain):
+ status, output = traceCommand("xm sched-credit -d %s" %(domain.getName()))
+ params = output.strip('{}').split(', ')
+ cap = int(params[0].split(':')[1].strip(' '))
+ weight = int(params[1].split(':')[1].strip(' '))
+ return (status, (weight, cap))
+
+def set_sched_credit_weight(domain, weight):
+ status, output = traceCommand("xm sched-credit -d %s -w %d"
%(domain.getName(), weight))
+ return status
+
+def set_sched_credit_cap(domain, cap):
+ status, output = traceCommand("xm sched-credit -d %s -c %d"
%(domain.getName(), cap))
+ return status
+
+
+domain = XmTestDomain()
+
+try:
+ domain.start(noConsole=True)
+except DomainError, e:
+ if verbose:
+ print "Failed to create test domain because:"
+ print e.extra
+ FAIL(str(e))
+
+# check default param values
+(status, params) = get_sched_credit_params(domain)
+if status != 0:
+ FAIL("Getting sched-credit parameters return non-zero rv (%d)", status)
+
+(weight, cap) = params
+if weight != 256:
+ FAIL("default weight is 256 (got %d)", weight)
+if cap != 0:
+ FAIL("default cap is 0 (got %d)", cap)
+
+# set new parameters
+status = set_sched_credit_weight(domain, 512)
+if status != 0:
+ FAIL("Setting sched-credit weight return non-zero rv (%d)", status)
+
+status = set_sched_credit_cap(domain, 100)
+if status != 0:
+ FAIL("Setting sched-credit cap return non-zero rv (%d)", status)
+
+# check new param values
+(status, params) = get_sched_credit_params(domain)
+if status != 0:
+ FAIL("Getting sched-credit parameters return non-zero rv (%d)", status)
+
+(weight, cap) = params
+if weight != 512:
+ FAIL("expected weight of 512 (got %d)", weight)
+if cap != 100:
+ FAIL("expected cap of 100 (got %d)", cap)
+
+# Stop the domain (nice shutdown)
+domain.stop()
diff -r fe35ddc5fd38 -r a1b83fedc4ed
tools/xm-test/tests/sched-credit/Makefile.am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/tests/sched-credit/Makefile.am Thu Jun 08 11:35:27
2006 +0100
@@ -0,0 +1,20 @@
+SUBDIRS =
+
+TESTS = 01_sched_credit_weight_cap_pos.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
|