[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/3] tools/xm-test: add cpus parm test in create bucket



This patch adds a test in the create bucket to exercise the parsing of
the cpus parameter.  This patch utilizes the new form of getVcpuInfo
from [PATCH 1/3].

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 b/tools/xm-test/tests/create/17_create_cpusparm_pos.py |   57 +++++++++++++++++
 tools/xm-test/tests/create/Makefile.am                 |    3 
 2 files changed, 59 insertions(+), 1 deletion(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 0296a77536dd tools/xm-test/tests/create/Makefile.am
--- a/tools/xm-test/tests/create/Makefile.am    Wed Aug 09 11:00:00 2006 -0500
+++ b/tools/xm-test/tests/create/Makefile.am    Wed Aug 09 11:07:06 2006 -0500
@@ -14,7 +14,8 @@ TESTS = 01_create_basic_pos.test \
        13_create_multinic_pos.test \
        14_create_blockroot_pos.test \
        15_create_smallmem_pos.test \
-       16_create_smallmem_neg.test
+       16_create_smallmem_neg.test \
+       17_create_cpusparm_pos.py
 
 EXTRA_DIST = $(TESTS)
 
diff -r 0296a77536dd tools/xm-test/tests/create/17_create_cpusparm_pos.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/tests/create/17_create_cpusparm_pos.py      Wed Aug 09 
11:08:59 2006 -0500
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Authors: Dan Smith <danms@xxxxxxxxxx>
+#        : Ryan Harper <ryanh@xxxxxxxxxx>
+#
+# This test will examine Xend's cpu/cpus parameter parsing ability.  The cpus
+# parameter controls which physical cpus the domain's vcpus run upon.  We can
+# set a single cpumask for all vcpus, or we can build up lists of cpumasks 
+# to be applied individually.  The test covers the following cases:
+#
+# single vcpu tests
+# multi-vcpu tests using same values
+# multi-vcpu tests using differing values per-vcpu
+# multi-vcpu tests as above, mix-notation (using [ ] and ' ' interspersed)
+#
+# format: (#vcpus, cpus= value, list of resulting affinity values)
+cpu_strings=[ (1, '0',      ["0"]),
+              (1, '0-3',    ["0-3"]),
+              (1, '1,3,5',  ["1,3,5"]),
+              (1, '0-3,^2', ["0-1,3"]),
+              (2, '0',      ["0", "0"]),
+              (2, '0-3',    ["0-3", "0-3"]),
+              (2, '1,3,5',  ["1,3,5", "1,3,5"]),
+              (2, '0-3,^2', ["0-1,3", "0-1,3"]),
+              (2, '0, 1',           ["0", "1"]),
+              (2, '0-3, 4-7',       ["0-3", "4-7"]),
+              (2, '1,3,5, 0,2,4',   ["1,3,5", "0,2,4"]),
+              (2, '0-3,^2, 4-7,^6', ["0-1,3", "4-5,7"]),
+              (2, "[0, '1']",           ["0", "1"]),
+              (2, "['0-3', 4-7]",       ["0-3", "4-7"]),
+              (2, "['1,3,5', 0,2,4]",   ["1,3,5", "0,2,4"]),
+              (2, "['0-3,^2', 4-7,^6]", ["0-1,3", "4-5,7"]) ]
+              
+from XmTestLib import *
+
+# for each test string, start up the domain and then examine vcpuinfo to
+# determine whether the affinity value for a particular vcpu was correct.
+for (x,y,z) in cpu_strings:
+    domain = XmTestDomain(extraConfig={"vcpus": x, "cpus": y})
+
+    # kick off domain
+    try:
+        console = domain.start()
+    except DomainError, e:
+        FAIL("Unable to start a domain with vcpus=%s cpus=%s"%(x, y))
+
+    # get vcpuinfo on the domain's vcpus.
+    vcpuinfo = getVcpuInfo(domain.getName())
+
+    # for each vcpu, check the affinity value
+    for a in range(0,x):
+        if vcpuinfo[a]['affinity'] != z[a]:
+            FAIL("Failed to set VCPU affinity for cpus=%s ([%s] != [%s])"%(
+                 y, vcpuinfo[a]['affinity'], z[a]))
+
+    domain.destroy()

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.