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

[Xen-changelog] Added another test. Fix the existing tests to close the written config file



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID d88b33abf533637d5b832381f38469e8255d5c58
# Parent  4f7b4ca2e30c83caf40e10876db62b5b48e7dd1f
Added another test.  Fix the existing tests to close the written config file
before running the test upon it, to ensure that the file is flushed.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 4f7b4ca2e30c -r d88b33abf533 tools/python/xen/xm/tests/test_create.py
--- a/tools/python/xen/xm/tests/test_create.py  Mon Nov 21 12:00:36 2005
+++ b/tools/python/xen/xm/tests/test_create.py  Mon Nov 21 12:03:45 2005
@@ -34,31 +34,79 @@
 
     def testCommandLine(self):
         (fd, fname) = tempfile.mkstemp()
+        os.close(fd)
+        self.t('-f %s kernel=/mykernel display=fakedisplay '
+               'macaddr=ab:cd:ef:ed nics=0' % fname,
+               { 'name'      : os.path.basename(fname),
+                 'xm_file'   : fname,
+                 'defconfig' : fname,
+                 'kernel'    : '/mykernel',
+                 'display'   : 'fakedisplay',
+                 'macaddr'   : 'ab:cd:ef:ed',
+                 'memory'    : 128,
+                 'vcpus'     : 1,
+                 'boot'      : 'c',
+                 'dhcp'      : 'off',
+                 'interface' : 'eth0',
+                 'path'      : '.:/etc/xen',
+                 'builder'   : 'linux',
+                 })
+
+
+    def testConfigFile(self):
+        (fd, fname) = tempfile.mkstemp()
         try:
-            self.t('-f %s kernel=/mykernel display=fakedisplay '
-                   'macaddr=ab:cd:ef:ed nics=0' % fname,
-                   { 'name'      : os.path.basename(fname),
-                     'xm_file'   : fname,
-                     'defconfig' : fname,
-                     'kernel'    : '/mykernel',
-                     'display'   : 'fakedisplay',
-                     'macaddr'   : 'ab:cd:ef:ed',
-                     'memory'    : 128,
-                     'vcpus'     : 1,
-                     'boot'      : 'c',
-                     'dhcp'      : 'off',
-                     'interface' : 'eth0',
-                     'path'      : '.:/etc/xen',
-                     'builder'   : 'linux',
-                     })
+            os.write(fd,
+                     '''
+kernel = "/boot/vmlinuz-xenU-smp"
+memory = 768
+name = "dom1"
+vcpus = 4
+nics = 1
+disk = ['phy:/dev/virt-blkdev-backend/dom1,sda1,w',
+'phy:/dev/virt-blkdev-backend/usr,sda2,r']
+root = "/dev/sda1 ro"
+extra = " profile=1 GATEWAY=10.0.1.254 NETMASK=255.255.0.0 IPADDR=10.0.134.1 
HOSTNAME=dom1"
+on_poweroff = 'destroy'
+on_reboot   = 'destroy'
+on_crash    = 'destroy'
+                     ''')
         finally:
             os.close(fd)
+
+        self.t('-f %s display=fakedisplay' % fname,
+               { 'kernel'      : '/boot/vmlinuz-xenU-smp',
+                 'memory'      : 768,
+                 'name'        : 'dom1',
+                 'vcpus'       : 4,
+                 'nics'        : 1,
+                 'root'        : '/dev/sda1 ro',
+                 'extra'       : ' profile=1 GATEWAY=10.0.1.254 
NETMASK=255.255.0.0 IPADDR=10.0.134.1 HOSTNAME=dom1',
+                 'on_poweroff' : 'destroy',
+                 'on_reboot'   : 'destroy',
+                 'on_crash'    : 'destroy',
+                 'disk'        : [['phy:/dev/virt-blkdev-backend/dom1',
+                                   'sda1', 'w', None],
+                                  ['phy:/dev/virt-blkdev-backend/usr',
+                                   'sda2', 'r', None]],
+
+                 'xm_file'     : fname,
+                 'defconfig'   : fname,
+                 'display'     : 'fakedisplay',
+
+                 'boot'        : 'c',
+                 'dhcp'        : 'off',
+                 'interface'   : 'eth0',
+                 'path'        : '.:/etc/xen',
+                 'builder'     : 'linux',
+               })
 
 
     def testConfigFileAndCommandLine(self):
         (fd, fname) = tempfile.mkstemp()
-        os.write(fd,
-                 '''
+        try:
+            os.write(fd,
+                     '''
 name       = "testname"
 memory     = 256
 ssidref    = 1
@@ -66,30 +114,30 @@
 maxmem     = 1024
 cpu        = 2
 cpu_weight = 0.75
-                 ''')
-        try:
-            self.t('-f %s display=fakedisplay macaddr=ab:cd:ef:ed nics=0' %
-              fname,
-                   { 'name'       : 'testname',
-                     'xm_file'    : fname,
-                     'defconfig'  : fname,
-                     'kernel'     : '/mykernel',
-                     'display'    : 'fakedisplay',
-                     'macaddr'    : 'ab:cd:ef:ed',
-                     'memory'     : 256,
-                     'maxmem'     : 1024,
-                     'cpu'        : 2,
-                     'ssidref'    : 1,
-                     'cpu_weight' : 0.75,
-                     'vcpus'      : 1,
-                     'boot'       : 'c',
-                     'dhcp'       : 'off',
-                     'interface'  : 'eth0',
-                     'path'       : '.:/etc/xen',
-                     'builder'    : 'linux',
-                     })
+                     ''')
         finally:
             os.close(fd)
+
+        self.t('-f %s display=fakedisplay macaddr=ab:cd:ef:ed nics=0' %
+          fname,
+               { 'name'       : 'testname',
+                 'xm_file'    : fname,
+                 'defconfig'  : fname,
+                 'kernel'     : '/mykernel',
+                 'display'    : 'fakedisplay',
+                 'macaddr'    : 'ab:cd:ef:ed',
+                 'memory'     : 256,
+                 'maxmem'     : 1024,
+                 'cpu'        : 2,
+                 'ssidref'    : 1,
+                 'cpu_weight' : 0.75,
+                 'vcpus'      : 1,
+                 'boot'       : 'c',
+                 'dhcp'       : 'off',
+                 'interface'  : 'eth0',
+                 'path'       : '.:/etc/xen',
+                 'builder'    : 'linux',
+                 })
             
 
 def test_suite():

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


 


Rackspace

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