Index: xen/tools/xm-test/tests/new/07_new_autostop_w_xend_stop_pos.py =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ xen/tools/xm-test/tests/new/07_new_autostop_w_xend_stop_pos.py 2006-07-14 14:37:43.000000000 +0100 @@ -0,0 +1,72 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Dan Smith + +import sys +import re +import time + +from XmTestLib import * + +# +# Force cleanup functions +# + +def cleanupDomain(domain): + try: + domain.closeConsole() + except: + pass + + try: + domain.stop() + except: + pass + + # Attempt delete for 10 times, pausing 2 seconds between each invoke + for i in range(10): + ret = domain.delete() + if ret == 0: + break + time.sleep(2) + +# Create a domain (default XmTestDomain, with our ramdisk) +dom = XmTestDomain(name = "07_new_autostop", extraConfig = {'autostop':1}) + +# Make it +try: + dom.new() +except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra + FAIL(str(e)) + +# Start it +try: + dom.restart() +except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra + FAIL(str(e)) + + +if verbose: + print "Waiting for domain to start up" + time.sleep(10) + +# Stop and start Xend +if verbose: + print "Stopping Xend and starting Xend" + +stopXend() +time.sleep(5) +startXend() + +# Check if domain is running +if "07_new_autostop" in getRunningDomains(): + FAIL("Domain did not auto stop") + +cleanupDomain(dom) Index: xen/tools/xm-test/tests/new/05_delete_nonexistent_neg.py =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ xen/tools/xm-test/tests/new/05_delete_nonexistent_neg.py 2006-07-14 14:37:43.000000000 +0100 @@ -0,0 +1,15 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Dan Smith + +import sys +import re +import time + +from XmTestLib import * + +# Create a domain (default XmTestDomain, with our ramdisk) +ret, output = traceCommand("xm delete 05_non_existent") +if ret == 0: + FAIL("Succeeded deleting non-existent domain") Index: xen/tools/xm-test/tests/new/03_new_start_stress_pos.py =================================================================== --- xen.orig/tools/xm-test/tests/new/03_new_start_stress_pos.py 2006-07-14 14:33:53.000000000 +0100 +++ xen/tools/xm-test/tests/new/03_new_start_stress_pos.py 2006-07-14 14:37:43.000000000 +0100 @@ -9,16 +9,47 @@ from XmTestLib import * -DOMS = 10 -MEM = 32 +DOMS = 40 +MEM = 16 DUR = 60 - +SEED = int(time.time()) # Create a domain (default XmTestDomain, with our ramdisk) domains = [] consoles = [] +# +# Force cleanup functions +# + +def cleanupDomain(domain): + try: + domain.closeConsole() + except: + pass + + try: + domain.stop() + except: + pass + + # Attempt delete for 10 times, pausing 2 seconds between each invoke + for i in range(10): + ret = domain.delete() + if ret == 0: + break + time.sleep(2) + +def cleanupDomains(domains): + for domain in domains: + cleanupDomain(domain) + + +# +# Test +# + for i in range(DOMS): - domain = XmTestDomain(name = '03_stress_%d' % i, + domain = XmTestDomain(name = '03_stress_%d_%d' % (SEED, i), extraConfig={"memory":MEM}) # Start it try: @@ -31,13 +62,16 @@ domains.append(domain) -for domain in domains: +for i in range(DOMS): try: - console = domain.restart() + console = domains[i].restart() except DomainError, e: if verbose: print "Failed to create test domain because:" print e.extra + + # cleanup + cleanupDomains(domains) FAIL(str(e)) consoles.append(console) @@ -49,6 +83,7 @@ run = console.runCmd("ls") except ConsoleError, e: saveLog(console.getHistory()) + cleanupDomains(domains) FAIL(str(e)) # Save a transcript for human review Index: xen/tools/xm-test/lib/XmTestLib/Xm.py =================================================================== --- xen.orig/tools/xm-test/lib/XmTestLib/Xm.py 2005-11-29 00:59:57.000000000 +0000 +++ xen/tools/xm-test/lib/XmTestLib/Xm.py 2006-07-14 14:37:43.000000000 +0100 @@ -74,8 +74,12 @@ lines = output.splitlines(); domains = []; for l in lines[1:]: - elms = l.split(" ", 1); - domains.append(elms[0]); + elms = l.split(None,3); + try: + if int(elms[1]) != -1: + domains.append(elms[0]); + except ValueError: + pass return domains; def destroyDomU(name): @@ -215,6 +219,25 @@ return status +def stopXend(): + if verbose: + print "*** Stopping xend ..." + + status, output = traceCommand("xend stop") + time.sleep(1) + + return status + +def startXend(): + if verbose: + print "*** Starting xend ..." + + status, output = traceCommand("xend start") + time.sleep(1) + + return status + + def smpConcurrencyLevel(): cores = int(getInfo("cores_per_socket")) threads = int(getInfo("threads_per_core")) Index: xen/tools/xm-test/tests/new/06_new_autostart_w_xend_start_pos.py =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ xen/tools/xm-test/tests/new/06_new_autostart_w_xend_start_pos.py 2006-07-14 14:37:43.000000000 +0100 @@ -0,0 +1,56 @@ +#!/usr/bin/python + +# Copyright (C) International Business Machines Corp., 2005 +# Author: Dan Smith + +import sys +import re +import time + +from XmTestLib import * + +# +# Force cleanup functions +# + +def cleanupDomain(domain): + try: + domain.closeConsole() + except: + pass + + try: + domain.stop() + except: + pass + + # Attempt delete for 10 times, pausing 2 seconds between each invoke + for i in range(10): + ret = domain.delete() + if ret == 0: + break + time.sleep(2) + +# Create a domain (default XmTestDomain, with our ramdisk) +dom = XmTestDomain(name = "06_new_autostart", extraConfig = {'autostart':1}) +# Start it +try: + dom.new() +except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra + FAIL(str(e)) + +# Restart Xend + +restartXend() + +# Check if domain is running + +time.sleep(3) + +if "06_new_autostart" not in getRunningDomains(): + FAIL("Domain did not auto start") +else: + cleanupDomain(dom) Index: xen/tools/xm-test/tests/new/Makefile.am =================================================================== --- xen.orig/tools/xm-test/tests/new/Makefile.am 2006-07-14 14:33:53.000000000 +0100 +++ xen/tools/xm-test/tests/new/Makefile.am 2006-07-14 14:37:43.000000000 +0100 @@ -3,7 +3,10 @@ TESTS = 01_new_basic_pos.test \ 02_new_start_pos.test \ 03_new_start_stress_pos.test \ - 04_new_same_name_neg.test + 04_new_same_name_neg.test \ + 05_delete_nonexistent_neg.test \ + 06_new_autostart_w_xend_start_pos.test \ + 07_new_autostop_w_xend_stop_pos.test EXTRA_DIST = $(TESTS)