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

[Xen-devel] [PATCH 5 of 5] Add testcase for vcpu-pin all


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Ryan Harper <ryanh@xxxxxxxxxx>
  • Date: Wed, 16 Aug 2006 15:49:39 -0500
  • Delivery-date: Wed, 16 Aug 2006 13:54:00 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

2 files changed, 56 insertions(+), 1 deletion(-)
tools/xm-test/tests/vcpu-pin/02_vcpu-pin_all_pos.py |   54 +++++++++++++++++++
tools/xm-test/tests/vcpu-pin/Makefile.am            |    3 -


# HG changeset patch
# User Ryan Harper <ryanh@xxxxxxxxxx>
# Date 1155579519 18000
# Node ID 27fdbe03de014cf640190081d2a61da246dac7a1
# Parent  556a93b6cca9b99b2ad0a2d6dcc24dc1a3a581ad
Add testcase for vcpu-pin all

diff -r 556a93b6cca9 -r 27fdbe03de01 tools/xm-test/tests/vcpu-pin/Makefile.am
--- a/tools/xm-test/tests/vcpu-pin/Makefile.am  Mon Aug 14 13:18:03 2006 -0500
+++ b/tools/xm-test/tests/vcpu-pin/Makefile.am  Mon Aug 14 13:18:39 2006 -0500
@@ -1,7 +1,8 @@
 
 SUBDIRS =
 
-TESTS = 01_vcpu-pin_basic_pos.test
+TESTS = 01_vcpu-pin_basic_pos.test \
+       02_vcpu-pin_all_pos.py
 
 XFAIL_TESTS = 
 
diff -r 556a93b6cca9 -r 27fdbe03de01 
tools/xm-test/tests/vcpu-pin/02_vcpu-pin_all_pos.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xm-test/tests/vcpu-pin/02_vcpu-pin_all_pos.py       Mon Aug 14 
13:18:39 2006 -0500
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author(s): Dan Smith <danms@xxxxxxxxxx>
+#          : Ryan Harper <ryanh@xxxxxxxxxx
+
+# 1) Make sure we have a multi cpu system
+# 2) Create a multi vcpu domain all on CPU1 
+#    and pin all vcpus to CPU0
+
+import sys;
+
+from XmTestLib import *
+
+# Verify that we can run this test on this host
+if smpConcurrencyLevel() <= 1:
+    print "*** NOTE: This machine does not have more than one physical"
+    print "          or logical cpu.  The vcpu-pin test cannot be run!"
+    SKIP("Host not capable of running test")
+
+vcpus = 2
+domain = XmTestDomain(extraConfig={"cpus": "1", "vcpus": vcpus})
+
+try:
+    domain.start(noConsole=True)
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+# wait for both vcpus to come up
+vcpus_up = 0
+start = int(time.time())
+print "waiting for all VCPUS to come up"
+while vcpus_up != vcpus:
+    vcpus_up = len(filter(lambda x: x is not None, 
+             vcpu_to_cpu(domain.getName())))
+    # 20 second timeout
+    if int(time.time()) >= start+20:
+        FAIL("Failed to bring all VCPUS online for test")
+        time.sleep(1)
+
+status, output = traceCommand("xm vcpu-pin %s all 0" % domain.getName())
+
+if status != 0:
+    FAIL("xm vcpu-pin returned invalid %i != 0" % status)
+
+v2c = vcpu_to_cpu(domain.getName())
+for vcpu in range(0,vcpus):
+    if int(v2c[vcpu]) != 0:
+        FAIL("failed to switch VCPU %s to CPU 0"%(vcpu))
+
+domain.stop()

_______________________________________________
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®.