Pino Toscano
2014-Jan-27 16:32 UTC
[Libguestfs] [PATCH] tests/regressions: remove C part of rhbz1044014
All it did was checking for a libvirt version, which is what libvirt-is-version now does; hence remove the C part, and use guestfish, ignoring the launch failure (as the C test did). --- .gitignore | 1 - tests/regressions/Makefile.am | 21 ------------ tests/regressions/rhbz1044014.c | 69 ---------------------------------------- tests/regressions/rhbz1044014.sh | 12 ++++++- 4 files changed, 11 insertions(+), 92 deletions(-) delete mode 100644 tests/regressions/rhbz1044014.c diff --git a/.gitignore b/.gitignore index f84e2cd..74661b0 100644 --- a/.gitignore +++ b/.gitignore @@ -492,7 +492,6 @@ Makefile.in /tests/regressions/rhbz501893 /tests/regressions/rhbz790721 /tests/regressions/rhbz914931 -/tests/regressions/rhbz1044014 /tests/regressions/rhbz1044014.out /tests/regressions/rhbz1055452 /tests/rsync/rsyncd.pid diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am index d45a76c..8016e2f 100644 --- a/tests/regressions/Makefile.am +++ b/tests/regressions/Makefile.am @@ -84,10 +84,6 @@ check_PROGRAMS = \ rhbz914931 \ rhbz1055452 -if HAVE_LIBVIRT -check_PROGRAMS += rhbz1044014 -endif - rhbz501893_SOURCES = rhbz501893.c rhbz501893_CPPFLAGS = \ -I$(top_srcdir)/src -I$(top_builddir)/src @@ -118,23 +114,6 @@ rhbz914931_CFLAGS = \ rhbz914931_LDADD = \ $(top_builddir)/src/libguestfs.la -if HAVE_LIBVIRT -rhbz1044014_SOURCES = rhbz1044014.c -rhbz1044014_CPPFLAGS = \ - -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(top_srcdir)/src -I$(top_builddir)/src -rhbz1044014_CFLAGS = \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(GPROF_CFLAGS) $(GCOV_CFLAGS) \ - $(LIBVIRT_CFLAGS) -rhbz1044014_LDADD = \ - $(top_builddir)/src/libutils.la \ - $(top_builddir)/src/libguestfs.la \ - $(LIBVIRT_LIBS) \ - $(LIBXML2_LIBS) \ - $(top_builddir)/gnulib/lib/libgnu.la -endif - rhbz1055452_SOURCES = rhbz1055452.c rhbz1055452_CPPFLAGS = \ -I$(top_srcdir)/src -I$(top_builddir)/src \ diff --git a/tests/regressions/rhbz1044014.c b/tests/regressions/rhbz1044014.c deleted file mode 100644 index 18ce4a7..0000000 --- a/tests/regressions/rhbz1044014.c +++ /dev/null @@ -1,69 +0,0 @@ -/* libguestfs - * Copyright (C) 2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* Regression test for RHBZ#1044014. - * - * The only reason to write this in C is so we can easily check the - * version of libvirt >= 1.2.1. In the future when we can assume a - * newer libvirt, we can just have the main rhbz1044014.sh script set - * some environment variables and use guestfish. - */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include <libvirt/libvirt.h> - -#include "guestfs.h" -#include "guestfs-internal-frontend.h" - -int -main (int argc, char *argv[]) -{ - unsigned long ver; - guestfs_h *g; - - virInitialize (); - - /* Check that the version of libvirt we are linked against - * supports the new test-driver auth feature. - */ - virGetVersion (&ver, NULL, NULL); - if (ver < 1002001) { - fprintf (stderr, "%s: test skipped because libvirt is too old (%lu)\n", - argv[0], ver); - exit (77); - } - - g = guestfs_create (); - if (!g) - exit (EXIT_FAILURE); - - /* This will ask the user for credentials. It will also fail - * (expectedly) because the test driver does not support qemu/KVM. - */ - guestfs_launch (g); - - guestfs_close (g); - exit (EXIT_SUCCESS); -} diff --git a/tests/regressions/rhbz1044014.sh b/tests/regressions/rhbz1044014.sh index f1e458c..ce1be76 100755 --- a/tests/regressions/rhbz1044014.sh +++ b/tests/regressions/rhbz1044014.sh @@ -34,12 +34,22 @@ if [[ ! ( "$backend" =~ ^libvirt ) ]]; then exit 77 fi +if [ ! -x ../../src/libvirt-is-version ]; then + echo "$0: test skipped because libvirt-is-version is not built yet" + exit 77 +fi + +if ! ../../src/libvirt-is-version 1 2 1; then + echo "$0: test skipped because libvirt is too old (< 1.2.1)" + exit 77 +fi + # Set the backend to the test driver. export LIBGUESTFS_BACKEND="libvirt:test://$(pwd)/$srcdir/rhbz1044014.xml" rm -f rhbz1044014.out -./rhbz1044014 < $srcdir/rhbz1044014.in > rhbz1044014.out 2>&1 || { +../../fish/guestfish -- -run < $srcdir/rhbz1044014.in > rhbz1044014.out 2>&1 || { r=$? if [ $r -ne 0 ]; then cat rhbz1044014.out -- 1.8.3.1
Richard W.M. Jones
2014-Jan-27 18:22 UTC
Re: [Libguestfs] [PATCH] tests/regressions: remove C part of rhbz1044014
On Mon, Jan 27, 2014 at 05:32:30PM +0100, Pino Toscano wrote:> All it did was checking for a libvirt version, which is what > libvirt-is-version now does; hence remove the C part, and use guestfish, > ignoring the launch failure (as the C test did).Yep this looks fine, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Reasonably Related Threads
- [PATCH 2/2] lib: Add comment and regression test for case where main process has large heap.
- [PATCH] tests/regressions: Remove executable stack test.
- [PATCH] Add a regression test for RHBZ#1011907 / RHBZ#1165785
- [PATCH v5 5/7] tests/regressions: Remove executable stack test.
- [PATCH v6 11/41] utils: Rename ‘guestfs-internal-frontend.h’ to ‘utils.h’.