From 79ca3c66fb28886ecaaf38220023d02efdddf66f Mon Sep 17 00:00:00 2001 Message-Id: <79ca3c66fb28886ecaaf38220023d02efdddf66f.1375465853.git.jdenemar@redhat.com> From: "Daniel P. Berrange" Date: Tue, 30 Jul 2013 11:24:22 +0100 Subject: [PATCH] Delete obsolete / unused python test files https://bugzilla.redhat.com/show_bug.cgi?id=884103 The python/tests directory contains a number of so called "tests" for the python API. These are all hardcoded to look for Xen and cannot be run in any automated fashion, and no one is ever manually running them. Given that they don't meaningully contribute to the test coverage, delete them. For some reason these tests were also copied into the filesystem as part of 'make install'. The change to the RPM in commit 3347a4203278ec93d7b0ceb88b5ed10e4f14765c caused a build failure, since it removed the code which deleted these installed tests. Signed-off-by: Daniel P. Berrange (cherry picked from commit 5bb2a245abbde4c0a407f631660e2f2c81bc4c02) --- configure.ac | 2 +- python/Makefile.am | 2 - python/tests/Makefile.am | 52 ----------------- python/tests/basic.py | 31 ---------- python/tests/create.py | 146 ----------------------------------------------- python/tests/error.py | 42 -------------- python/tests/node.py | 34 ----------- python/tests/uuid.py | 41 ------------- 8 files changed, 1 insertion(+), 349 deletions(-) delete mode 100644 python/tests/Makefile.am delete mode 100755 python/tests/basic.py delete mode 100755 python/tests/create.py delete mode 100755 python/tests/error.py delete mode 100755 python/tests/node.py delete mode 100755 python/tests/uuid.py diff --git a/configure.ac b/configure.ac index 35a5d76..084d864 100644 --- a/configure.ac +++ b/configure.ac @@ -2447,7 +2447,7 @@ AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \ libvirt.pc libvirt.spec mingw-libvirt.spec \ po/Makefile.in \ include/libvirt/Makefile include/libvirt/libvirt.h \ - python/Makefile python/tests/Makefile \ + python/Makefile \ daemon/Makefile \ tools/Makefile \ tests/Makefile \ diff --git a/python/Makefile.am b/python/Makefile.am index 7eb42c6..925e1f4 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -16,8 +16,6 @@ ## License along with this library. If not, see ## . -SUBDIRS= . tests - INCLUDES = \ $(PYTHON_INCLUDES) \ -I$(top_builddir)/gnulib/lib \ diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am deleted file mode 100644 index 0fd3c78..0000000 --- a/python/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 -## . - -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/python/tests/basic.py b/python/tests/basic.py deleted file mode 100755 index c6dec81..0000000 --- a/python/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/python/tests/create.py b/python/tests/create.py deleted file mode 100755 index 815ccc4..0000000 --- a/python/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 = "" + kernelU + "" - -if not os.access(initrdU, os.R_OK): - print "Did not find the guest initrd %s" % (initrdU) - initrdU = "" -else: - initrdU = "" + initrdU + "" - - -conn = libvirt.open(None) -if conn == None: - print 'Failed to open connection to the hypervisor' - sys.exit(1) - -xmldesc=""" - test - - linux -""" + kernelU + initrdU + """ - root=/dev/sda1 ro selinux=0 3 - - 131072 - 1 - - - - - - - - -