Lifecycle Patches 3/7
RFC 1/1 Lifecycle Patches 3/7
Xend lifecycle changes -- tests for the basic functionality.
configure.ac | 1 lib/XmTestLib/XenDomain.py | 39 +++++++++++++++++ tests/Makefile.am | 3 - tests/new/01_new_basic_pos.py | 31 +++++++++++++ tests/new/02_new_start_pos.py | 68 ++++++++++++++++++++++++++++++ tests/new/03_new_start_stress_pos.py | 79 +++++++++++++++++++++++++++++++++++ tests/new/04_new_same_name_neg.py | 39 +++++++++++++++++ tests/new/Makefile.am | 22 +++++++++ 8 files changed, 281 insertions(+), 1 deletion(-)
tools/xm-test/lib/XmTestLib/XenDomain.py +39 -0
@@ -232,6 +232,45 @@ elif not self.console and noConsole == False: return self.getConsole() + def new(self): + ret, output = traceCommand("xm new %s" % self.config) + if ret != 0: + raise DomainError("Failed to create domain", + extra=output, + errorcode=ret) + + def restart(self, noConsole = False): + """ actually this is .start(), but that name is taken """ + + ret, output = traceCommand("xm start %s" % self.config.getOpt("name")) + + if ret != 0: + raise DomainError("Failed to create domain", + extra=output, + errorcode=ret) + + # HVM domains require waiting for boot + if self.getDomainType() == "HVM": + waitForBoot() + + # Go through device list and run console cmds + for dev in self.devices.keys(): + self.devices[dev].execAddCmds() + + if self.console and noConsole == True: + self.closeConsole() + + elif self.console and noConsole == False: + return self.console + + elif not self.console and noConsole == False: + return self.getConsole() + + + def delete(self): + ret, output = traceCommand("xm delete %s" % self.config.getOpt("name")) + return ret + def stop(self): prog = "xm" cmd = " shutdown "
tools/xm-test/tests/new/02_new_start_pos.py new file +68 -0
68 lines not on this page · raw message
tools/xm-test/tests/new/01_new_basic_pos.py new file +31 -0
@@ -0,0 +1,31 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Dan Smith <[email protected]> + +import sys +import re +import time + +from XmTestLib import * + +# Create a domain (default XmTestDomain, with our ramdisk) +domain = XmTestDomain() + +if int(getInfo("free_memory")) < domain.config.getOpt("memory"): + SKIP("This test needs %i MB of free memory (%i MB avail)" % + (domain.config.getOpt("memory"), int(getInfo("free_memory")))) + +# Start it +try: + domain.new() +except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra + FAIL(str(e)) + +ret = domain.delete() +if ret != 0: + print "Failed to remove test domain: %d" % ret + FAIL("Unable to remove test domain")
tools/xm-test/tests/Makefile.am +2 -1
@@ -27,7 +27,8 @@ vcpu-pin \ vtpm \ enforce_dom0_cpus \ - save restore migrate + save restore migrate \ + new EXTRA_DIST = $(SUBDIRS) Makefile.am.template
tools/xm-test/tests/new/03_new_start_stress_pos.py new file +79 -0
79 lines not on this page · raw message
tools/xm-test/tests/new/04_new_same_name_neg.py new file +39 -0
@@ -0,0 +1,39 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Dan Smith <[email protected]> + +import sys +import re +import time + +from XmTestLib import * + +# Create a domain (default XmTestDomain, with our ramdisk) +first_domain = XmTestDomain(name = "04_name_same_name") + +# Start it +try: + first_domain.new() +except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra + FAIL(str(e)) + +try: + second_domain = XmTestDomain(name = "04_name_same_name") + second_domain.new() +except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra +else: + FAIL("Succeeded to create two domains of the same name") + + +try: + ret = first_domain.delete() + ret = second_domain.delete() +except: + pass
tools/xm-test/tests/new/Makefile.am new file +22 -0
@@ -0,0 +1,22 @@ +SUBDIRS = + +TESTS = 01_new_basic_pos.test \ + 02_new_start_pos.test \ + 03_new_start_stress_pos.test \ + 04_new_same_name_neg.test + +EXTRA_DIST = $(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 *~ +
tools/xm-test/configure.ac +1 -0
@@ -135,6 +135,7 @@ tests/vcpu-disable/Makefile tests/vtpm/Makefile tests/enforce_dom0_cpus/Makefile + tests/new/Makefile lib/XmTestReport/xmtest.py lib/XmTestLib/config.py ])
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel