summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--tests/Makefile.am52
-rwxr-xr-xtests/basic.py31
-rwxr-xr-xtests/create.py146
-rwxr-xr-xtests/error.py42
-rwxr-xr-xtests/node.py34
-rwxr-xr-xtests/uuid.py41
7 files changed, 0 insertions, 348 deletions
diff --git a/Makefile.am b/Makefile.am
index 7eb42c6..925e1f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,8 +16,6 @@
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
-SUBDIRS= . tests
-
INCLUDES = \
$(PYTHON_INCLUDES) \
-I$(top_builddir)/gnulib/lib \
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index 0fd3c78..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-## Copyright (C) 2005-2011, 2013 Red Hat, Inc.
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library. If not, see
-## <http://www.gnu.org/licenses/>.
-
-EXAMPLE_DIR = $(datadir)/doc/libvirt-python-$(VERSION)/examples
-
-PYTESTS= \
- basic.py \
- create.py \
- uuid.py \
- error.py \
- node.py
-
-EXTRA_DIST = $(PYTESTS)
-
-if WITH_PYTHON
-tests: $(PYTESTS)
- @echo "## running Python regression tests"
- -@(PYTHONPATH="..:../.libs:../src/.libs:$(srcdir)/../src:$$PYTHONPATH";\
- export PYTHONPATH; \
- LD_LIBRARY_PATH="$(top_builddir)/src/.libs:$$LD_LIBRARY_PATH" ; \
- export LD_LIBRARY_PATH; \
- for test in $(PYTESTS) ; \
- do log=`$(PYTHON) $(srcdir)/$$test` ; \
- if [ "`echo $$log | grep OK`" = "" ] ; then \
- echo "-- $$test" ; echo "$$log" ; fi ; done)
-else
-tests:
-endif
-
-clean:
- rm -f *.pyc core
-
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
- -(for test in $(PYTESTS); \
- do $(INSTALL) -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
-
-uninstall-local:
- for test in $(PYTESTS); do rm -f $(DESTDIR)$(EXAMPLE_DIR)/$$test; done
diff --git a/tests/basic.py b/tests/basic.py
deleted file mode 100755
index c6dec81..0000000
--- a/tests/basic.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/python -u
-import libvirt
-import sys
-import os
-
-if not os.access("/proc/xen", os.R_OK):
- print 'System is not running a Xen kernel'
- sys.exit(1)
-
-conn = libvirt.openReadOnly(None)
-if conn == None:
- print 'Failed to open connection to the hypervisor'
- sys.exit(1)
-
-# print conn
-
-try:
- dom0 = conn.lookupByName("Domain-0")
-except:
- print 'Failed to find the main domain'
- sys.exit(1)
-
-# print dom0
-
-print "Domain 0: id %d running %s" % (dom0.ID(), dom0.OSType())
-print dom0.info()
-del dom0
-del conn
-print "OK"
-
-sys.exit(0)
diff --git a/tests/create.py b/tests/create.py
deleted file mode 100755
index 815ccc4..0000000
--- a/tests/create.py
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/usr/bin/python -u
-import libvirt
-import sys
-import os
-import time
-
-if not os.access("/proc/xen", os.R_OK):
- print 'System is not running a Xen kernel'
- sys.exit(1)
-
-#
-# Try to provide default OS images paths here, of course non standard
-#
-osroots = [
- "/u/fc4-2.img",
- "/u/fc4.img",
- "/xen/fc4.img",
-]
-
-okay = 1
-
-osroot = None
-for root in osroots:
- if os.access(root, os.R_OK):
- osroot = root
- break
-
-if osroot == None:
- print "Could not find a guest OS root, edit to add the path in osroots"
- sys.exit(1)
-
-kernel=open("/proc/version").read().split()
-kernelOv = kernel[2]
-
-if kernelOv.find('hypervisor'):
- kernelU = "/boot/vmlinuz-" + kernelOv.replace('hypervisor', 'guest')
- initrdU = "/boot/initrd-" + kernelOv.replace('hypervisor', 'guest') + ".img"
-elif kernelOv.find('xen0'):
- kernelU = "/boot/vmlinuz-" + kernelOv.replace('xen0', 'xenU')
- initrdU = "/boot/initrd-" + kernelOv.replace('xen0', 'xenU') + ".img"
-
-if not os.access(kernelU, os.R_OK):
- print "Did not find the guest kernel %s" % (kernelU)
- sys.exit(1)
-
-kernelU = "<kernel>" + kernelU + "</kernel>"
-
-if not os.access(initrdU, os.R_OK):
- print "Did not find the guest initrd %s" % (initrdU)
- initrdU = ""
-else:
- initrdU = "<initrd>" + initrdU + "</initrd>"
-
-
-conn = libvirt.open(None)
-if conn == None:
- print 'Failed to open connection to the hypervisor'
- sys.exit(1)
-
-xmldesc="""<domain type='xen'>
- <name>test</name>
- <os>
- <type>linux</type>
-""" + kernelU + initrdU + """
- <cmdline> root=/dev/sda1 ro selinux=0 3</cmdline>
- </os>
- <memory>131072</memory>
- <vcpu>1</vcpu>
- <devices>
- <disk type='file'>
- <source file='%s'/>
- <target dev='sda1'/>
- </disk>
- <interface type='bridge'>
- <source bridge='xenbr0'/>
- <mac address='aa:00:00:00:00:12'/>
- <script path='/etc/xen/scripts/vif-bridge'/>
- </interface>
- </devices>
-</domain>
-""" % (osroot)
-
-dom = conn.createLinux(xmldesc, 0)
-if dom == None:
- print 'Failed to create a test domain'
- sys.exit(1)
-
-# print dom
-
-print "Domain: id %d running %s" % (dom.ID(), dom.OSType())
-
-print "Suspending test domain for 5 seconds"
-if dom.suspend() != 0:
- print 'Failed to suspend domain test'
- dom.destroy()
- del dom
- del conn
- sys.exit(1)
-
-infos = dom.info()
-time.sleep(5)
-infos2 = dom.info()
-if infos[4] != infos2[4]:
- print 'Suspended domain test got CPU cycles'
- okay = 0
-
-print "resuming test domain for 10 seconds"
-if dom.resume() != 0:
- print 'Failed to resume domain test'
- dom.destroy()
- del dom
- del conn
- sys.exit(1)
-
-time.sleep(10)
-print "shutdown of test domain"
-
-if dom.shutdown() != 0:
- okay = 0
- print 'Failed to shutdown domain test'
-
-i = 0
-while i < 30:
- time.sleep(1)
- i = i + 1
- try:
- t = dom.info()[4]
- except:
- okay = 0
- t = -1
- break
-
- if t == 0:
- break
-
-if t != 0:
- print 'Shutdown failed destroying domain test'
- okay = 0
- dom.destroy()
-
-del dom
-del conn
-if okay == 1:
- print "OK"
-
-sys.exit(0)
diff --git a/tests/error.py b/tests/error.py
deleted file mode 100755
index 295f9a7..0000000
--- a/tests/error.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/python -u
-#
-# Tests global error handlers at the python level.
-#
-import libvirt
-import sys
-import os
-
-errno = None
-
-def handler(ctxt, err):
- global errno
-
- #print "handler(%s, %s)" % (ctxt, err)
- errno = err
-
-libvirt.registerErrorHandler(handler, 'context')
-
-conn = libvirt.openReadOnly(None)
-if conn == None:
- print 'Failed to open connection to the hypervisor'
- sys.exit(1)
-
-try:
- dom0 = conn.lookupByName("Does_not_exist")
- print 'strange found a Does_not_exist domain'
- sys.exit(1)
-except:
- pass
-
-del conn
-
-if errno == None:
- print 'failed to get an error'
-elif errno[0] == libvirt.VIR_ERR_NO_CONNECT or \
- errno[0] == libvirt.VIR_ERR_INVALID_DOMAIN or \
- errno[0] == libvirt.VIR_ERR_GET_FAILED:
- print "OK"
-else:
- print 'got unexpected error:', errno
-
-sys.exit(0)
diff --git a/tests/node.py b/tests/node.py
deleted file mode 100755
index f199fc3..0000000
--- a/tests/node.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/python -u
-import libvirt
-import sys
-import os
-
-if not os.access("/proc/xen", os.R_OK):
- print 'System is not running a Xen kernel'
- sys.exit(1)
-
-conn = libvirt.openReadOnly(None)
-if conn == None:
- print 'Failed to open connection to the hypervisor'
- sys.exit(1)
-
-try:
- (model, memory, cpus, mhz, nodes, socket, cores, threads) = conn.getInfo()
-except:
- print 'Failed to extract the current node information'
- sys.exit(1)
-
-print "Xen running on %d %s processors at %d MHz, %d MBytes of memory" % (
- cpus, model, mhz, memory)
-
-if cpus > nodes * socket * cores * threads:
- print "Erroneous CPU information"
- sys.exit(1)
-
-if cpus < nodes * socket * cores * threads:
- print "Strange, running in degrated mode, some CPU are not available"
-
-del conn
-print "OK"
-
-sys.exit(0)
diff --git a/tests/uuid.py b/tests/uuid.py
deleted file mode 100755
index db48e80..0000000
--- a/tests/uuid.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python -u
-import libvirt
-import sys
-import os
-
-if not os.access("/proc/xen", os.R_OK):
- print 'System is not running a Xen kernel'
- sys.exit(1)
-
-conn = libvirt.openReadOnly(None)
-if conn == None:
- print 'Failed to open connection to the hypervisor'
- sys.exit(1)
-
-ids = conn.listDomainsID()
-if ids == None or len(ids) == 0:
- print 'Failed to list running domains'
- sys.exit(1)
-
-id = ids[-1]
-
-try:
- dom = conn.lookupByID(id)
-except:
- print 'Failed to find the domain %d'
- sys.exit(1)
-
-name0 = dom.name()
-uuid = dom.UUID()
-print "Using domain %s" % (name0)
-try:
- dom2 = conn.lookupByUUID(uuid)
-except:
- print 'Failed to lookup domain %d based on its UUID'
- sys.exit(1)
-if dom2.name() != name0:
- print 'lookup of %s based on UUID brings a different domain %s' % (
- name0, dom2.name())
-
-print "OK"
-sys.exit(0)