tests: Remove dependency on Sys::Virt.

This was only used for a single rule (check-valgrind-local-guests)
which ran "make check-valgrind" on local guests.  This was never
really used by me and was fairly inadvisable anyway, so we can easily
remove it and thus remove the dependency on perl Sys::Virt.
This commit is contained in:
Richard W.M. Jones
2021-03-18 12:15:01 +00:00
parent 5d686b92a6
commit 061be6bb84
6 changed files with 1 additions and 82 deletions

1
.gitignore vendored
View File

@@ -365,7 +365,6 @@ Makefile.in
/php/extension/tests/guestfs_*.sh
/php/extension/tests/guestfs_090_bindtests.phpt
/php/extension/tmp-php.ini
/pick-guests.pl
/po-docs/*/*.1
/po-docs/*/*.3
/po-docs/*/*.5

View File

@@ -368,7 +368,6 @@ check-all:
$(MAKE) -j1 \
check \
check-valgrind \
check-valgrind-local-guests \
check-direct \
check-valgrind-direct \
check-uml \
@@ -394,15 +393,6 @@ check-valgrind: build-test-guests
done; \
exit $$(( $$errors ? 1 : 0 ))
check-valgrind-local-guests:
@GUESTS=`$(top_builddir)/run ./pick-guests.pl 5`; \
errors=0; \
for f in `grep -l '^$@:' $(SUBDIRS:%=%/Makefile.am)`; do \
echo $(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@; \
$(MAKE) GUESTS="$$GUESTS" -C `dirname $$f` $@ || (( errors++ )); \
done; \
exit $$(( $$errors ? 1 : 0 ))
check-direct:
@backend=`$(top_builddir)/run ./fish/guestfish get-backend`; \
if [ "$$backend" != "direct" ]; then \
@@ -576,7 +566,6 @@ help:
@echo "make -k check ... and display all errors at once."
@echo
@echo "make check-valgrind Run a subset of the tests under valgrind."
@echo "make check-valgrind-local-guests Test under valgrind using local guests."
@echo "make check-direct Test using direct backend."
@echo "make check-valgrind-direct Test valgrind + direct backend."
@echo "make check-uml Test using User-Mode Linux."

View File

@@ -205,8 +205,6 @@ AC_CONFIG_FILES([ocaml-link.sh],
[chmod +x,-w ocaml-link.sh])
AC_CONFIG_FILES([php/extension/php-for-tests.sh],
[chmod +x,-w php/extension/php-for-tests.sh])
AC_CONFIG_FILES([pick-guests.pl],
[chmod +x,-w pick-guests.pl])
AC_CONFIG_FILES([podwrapper.pl],
[chmod +x,-w podwrapper.pl])
AC_CONFIG_FILES([run],

View File

@@ -372,10 +372,6 @@ Optional. Used to build the Go bindings.
Optional. For testing memory problems.
=item Perl C<Sys::Virt>
Optional.
=item libvirt-python
Optional. For testing Python libvirt/libguestfs interactions.

View File

@@ -66,7 +66,7 @@ AM_CONDITIONAL([HAVE_PERL],
dnl Check for Perl modules needed by Perl virt tools (virt-df, etc.)
AS_IF([test "x$PERL" != "xno"],[
missing_perl_modules=no
for pm in Pod::Usage Getopt::Long Sys::Virt Locale::TextDomain Win::Hivex Win::Hivex::Regedit ; do
for pm in Pod::Usage Getopt::Long Locale::TextDomain Win::Hivex Win::Hivex::Regedit ; do
AC_MSG_CHECKING([for $pm])
if ! $PERL -M$pm -e1 >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([no])

View File

@@ -1,63 +0,0 @@
#!/usr/bin/env perl
# @configure_input@
# Copyright (C) 2009-2020 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.
# Pick guests at random on the local machine which are accessible.
# This is used by 'make check-valgrind-local-guests'.
use strict;
use warnings;
use Sys::Guestfs;
use Sys::Virt;
use List::Util qw(shuffle);
die "$0 nr-guests\n" unless @ARGV == 1;
my $n = $ARGV[0];
my $vmm = Sys::Virt->new (uri => '@libvirt_ro_uri@');
my @domains = ($vmm->list_domains, $vmm->list_defined_domains);
# Only guests which are accessible by the current (non-root) user. On
# the machine where I run these tests, I have added my user account to
# the 'disk' group, so that most guests are accessible. However
# because libvirt changes the permissions on guest disks, a guest
# which has been run on the machine becomes inaccessible, hence the
# need for this code - RWMJ.
my @accessible;
foreach my $dom (@domains) {
my $name = $dom->get_name;
my $g = Sys::Guestfs->new;
eval {
$g->add_domain ($name, readonly => 1,
libvirturi => '@libvirt_ro_uri@');
# $g->launch (); - don't actually need to do this
};
push @accessible, $name unless $@;
}
# Randomize the list of guests.
@accessible = shuffle (@accessible);
$n = @accessible if @accessible < $n;
# Return the first n guests from the list.
for (my $i = 0; $i < $n; ++$i) {
print " " if $i > 0;
print $accessible[$i];
}
print "\n";