tests: Replace $TEST_FUNCTIONS

Replace strange $TEST_FUNCTIONS variable/expansion thing with
something more like what we use in nbdkit, a simple tests/functions.sh
script that gets sourced into each test script.

Update the common submodule to get:

  commit 8137d47d0e654065391151eb275e3b64f230f6f5
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Thu Feb 13 11:13:55 2025 +0000

    mlcustomize, mltools: Replace $TEST_FUNCTIONS

    TEST_FUNCTIONS is being removed from libguestfs and guestfs-tools (it
    was removed from virt-v2v a while back).  Make the same adjustment in
    the common submodule.

(and some other commits which are not relevant to libguestfs)
This commit is contained in:
Richard W.M. Jones
2025-02-13 10:32:59 +00:00
parent 82e2dea96a
commit b5fbc7e617
114 changed files with 255 additions and 147 deletions

1
.gitignore vendored
View File

@@ -423,6 +423,7 @@ Makefile.in
/tests/disks/test-add-disks /tests/disks/test-add-disks
/tests/disks/test-qemu-drive-libvirt.xml /tests/disks/test-qemu-drive-libvirt.xml
/tests/events/test-libvirt-auth-callbacks /tests/events/test-libvirt-auth-callbacks
/tests/functions.sh
/tests/mount-local/test-parallel-mount-local /tests/mount-local/test-parallel-mount-local
/tests/mountable/test-internal-parse-mountable /tests/mountable/test-internal-parse-mountable
/tests/parallel/test-parallel /tests/parallel/test-parallel

View File

@@ -19,7 +19,10 @@
# Test that the correct 'complete' command is included in the script. # Test that the correct 'complete' command is included in the script.
# Mainly prevents symlinking errors and some omissions. # Mainly prevents symlinking errors and some omissions.
$TEST_FUNCTIONS source ../tests/functions.sh
set -e
set -x
skip_if_skipped skip_if_skipped
if [ -z "$commands" ]; then if [ -z "$commands" ]; then

2
common

Submodule common updated: 4b0f1890a4...8137d47d0e

View File

@@ -191,6 +191,8 @@ AC_CONFIG_FILES([podwrapper.pl],
[chmod +x,-w podwrapper.pl]) [chmod +x,-w podwrapper.pl])
AC_CONFIG_FILES([run], AC_CONFIG_FILES([run],
[chmod +x,-w run]) [chmod +x,-w run])
AC_CONFIG_FILES([tests/functions.sh],
[chmod +x,-w tests/functions.sh])
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
appliance/Makefile appliance/Makefile

View File

@@ -671,8 +671,8 @@ normal test.
Modify the test so it checks if the C<SLOW=1> environment variable is Modify the test so it checks if the C<SLOW=1> environment variable is
set, and if I<not> set it skips (ie. returns with exit code 77). If set, and if I<not> set it skips (ie. returns with exit code 77). If
using C<$TEST_FUNCTIONS>, you can call the function C<slow_test> for using F<tests/functions.sh>, you can call the function C<slow_test>
this. for this.
=item * =item *
@@ -706,8 +706,8 @@ normal test.
=item * =item *
Modify the test so it checks if euid == 0, and if I<not> set it skips Modify the test so it checks if euid == 0, and if I<not> set it skips
(ie. returns with exit code 77). If using C<$TEST_FUNCTIONS>, you can (ie. returns with exit code 77). If using F<tests/functions.sh>, you
call the function C<root_test> for this. can call the function C<root_test> for this.
=item * =item *

View File

@@ -18,9 +18,10 @@
# Test guestfish -a option. # Test guestfish -a option.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-a.out rm -f test-a.out

View File

@@ -18,9 +18,10 @@
# Test add-domain command. # Test add-domain command.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-add-domain-{1,2,3,4}.img rm -f test-add-domain-{1,2,3,4}.img

View File

@@ -18,10 +18,10 @@
# Test guestfish -a URI. # Test guestfish -a URI.
source ../tests/functions.sh
set -e set -e
set -x set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-add-uri.out rm -f test-add-uri.out

View File

@@ -18,9 +18,10 @@
# Test guestfish alloc and sparse commands. # Test guestfish alloc and sparse commands.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-alloc.img rm -f test-alloc.img

View File

@@ -18,9 +18,10 @@
# Test guestfish copy-in and copy-out commands. # Test guestfish copy-in and copy-out commands.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
# This test fails on some versions of mock which lack /dev/fd # This test fails on some versions of mock which lack /dev/fd

View File

@@ -18,9 +18,10 @@
# Test guestfish -d option. # Test guestfish -d option.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-d-{1,2,3,4}.img rm -f test-d-{1,2,3,4}.img

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
$top_srcdir/podcheck.pl "$srcdir/guestfish.pod" guestfish \ $top_srcdir/podcheck.pl "$srcdir/guestfish.pod" guestfish \

View File

@@ -18,9 +18,10 @@
# Test guestfish edit command. # Test guestfish edit command.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
# This test fails on some versions of mock which lack /dev/fd # This test fails on some versions of mock which lack /dev/fd

View File

@@ -18,9 +18,10 @@
# Test guestfish string escapes. # Test guestfish string escapes.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test.output test.error test.error.old rm -f test.output test.error test.error.old

View File

@@ -18,9 +18,10 @@
# Test guestfish events. # Test guestfish events.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-events.out rm -f test-events.out

View File

@@ -18,9 +18,10 @@
# Test guestfish file attributes commands (chmod, copy-attributes, etc). # Test guestfish file attributes commands (chmod, copy-attributes, etc).
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-file-attrs.out rm -f test-file-attrs.out

View File

@@ -18,9 +18,10 @@
# Test find0 call. # Test find0 call.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_test_iso skip_unless_test_iso

View File

@@ -18,9 +18,10 @@
# Test guestfish glob command. # Test guestfish glob command.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-glob.img test-glob.out rm -f test-glob.img test-glob.out

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -19,9 +19,10 @@
# Test passing invalid parameters for memory size, smp, etc when setting up # Test passing invalid parameters for memory size, smp, etc when setting up
# the appliance. # the appliance.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
# Memory size # Memory size

View File

@@ -18,7 +18,10 @@
# Test guestfish mount-local / mount-local-run commands. # Test guestfish mount-local / mount-local-run commands.
$TEST_FUNCTIONS source ../tests/functions.sh
set -e
set -x
skip_if_skipped skip_if_skipped
skip_unless_fuse skip_unless_fuse

View File

@@ -18,9 +18,10 @@
# Test read_file call. # Test read_file call.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_test_iso skip_unless_test_iso

View File

@@ -18,9 +18,10 @@
# Test remote events in guestfish. # Test remote events in guestfish.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
eval "$(guestfish --listen)" eval "$(guestfish --listen)"

View File

@@ -18,9 +18,10 @@
# Test remote control of guestfish. # Test remote control of guestfish.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-remote.img rm -f test-remote.img

View File

@@ -19,9 +19,10 @@
# Test reopening the handle in the same process. This used to fail # Test reopening the handle in the same process. This used to fail
# but was corrected in 03e1f74ee08dc71bc09cc7655bf4732685f80b43. # but was corrected in 03e1f74ee08dc71bc09cc7655bf4732685f80b43.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-reopen.img rm -f test-reopen.img

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -18,9 +18,10 @@
# Test remote control of guestfish. # Test remote control of guestfish.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-stringlist.img rm -f test-stringlist.img

View File

@@ -21,9 +21,10 @@
# RHBZ#511372 guestfish doesn't understand '~' in filenames # RHBZ#511372 guestfish doesn't understand '~' in filenames
# and multiple other fixes to tilde handling. # and multiple other fixes to tilde handling.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
# Set XDG_CACHE_HOME correctly, unless set already. See: # Set XDG_CACHE_HOME correctly, unless set already. See:

View File

@@ -20,9 +20,10 @@
# target to a directory instead of the full filename, then previously # target to a directory instead of the full filename, then previously
# libguestfs would hang. It should return an error instead. # libguestfs would hang. It should return an error instead.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_test_iso skip_unless_test_iso

View File

@@ -18,7 +18,10 @@
set -e set -e
$TEST_FUNCTIONS source ../tests/functions.sh
set -e
set -x
skip_if_skipped skip_if_skipped
$top_srcdir/podcheck.pl "$srcdir/guestmount.pod" guestmount \ $top_srcdir/podcheck.pl "$srcdir/guestmount.pod" guestmount \

View File

@@ -19,9 +19,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=838592 # https://bugzilla.redhat.com/show_bug.cgi?id=838592
# This tests that the --pid-file option can be used to fix the race. # This tests that the --pid-file option can be used to fix the race.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped "test-fuse.sh" skip_if_skipped "test-fuse.sh"
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -20,7 +20,10 @@
# Test that guestunmount returns the correct error code if # Test that guestunmount returns the correct error code if
# there is no mounted FUSE filesystem. # there is no mounted FUSE filesystem.
$TEST_FUNCTIONS source ../tests/functions.sh
#set -e # command below deliberately fails
set -x
skip_if_skipped "test-fuse.sh" skip_if_skipped "test-fuse.sh"
skip_if_skipped skip_if_skipped
skip_unless_fuse skip_unless_fuse

View File

@@ -1154,9 +1154,11 @@ and generate_fish_test_prep_sh () =
let all_disks = sprintf "prep{1..%d}.img" (List.length prepopts) in let all_disks = sprintf "prep{1..%d}.img" (List.length prepopts) in
pr "\ pr "\
set -e
$TEST_FUNCTIONS source ../tests/functions.sh
set -e
set -x
skip_if_skipped skip_if_skipped
rm -f %s rm -f %s

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_environment_variable_set GJS skip_unless_environment_variable_set GJS
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_environment_variable_set GJS skip_unless_environment_variable_set GJS

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_environment_variable_set GJS skip_unless_environment_variable_set GJS

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
# Gather the list of Python sources. # Gather the list of Python sources.

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
$top_srcdir/podcheck.pl "$srcdir/virt-rescue.pod" virt-rescue \ $top_srcdir/podcheck.pl "$srcdir/virt-rescue.pod" virt-rescue \

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -90,24 +90,3 @@ if HAVE_OCAMLOPT
%.cmx: %.ml %.cmx: %.ml
$(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ $(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
endif endif
# Test shell scripts should use '$TEST_FUNCTIONS' to get a predefined
# set of helper functions for running tests (see
# tests/test-functions.sh).
#
# Notes:
#
# (1) This is in fact a single command all on one line. The variables
# are evaluated in test-functions.sh.
#
# (2) We use absolute paths here and in test-functions.sh so that the
# test can change directory freely. But we also include the
# non-absolute values so they can be used by the test script itself.
export TEST_FUNCTIONS := \
source $(abs_top_srcdir)/tests/test-functions.sh \
abs_srcdir="$(abs_srcdir)" \
abs_builddir="$(abs_builddir)" \
top_srcdir="$(top_srcdir)" \
top_builddir="$(top_builddir)" \
abs_top_srcdir="$(abs_top_srcdir)" \
abs_top_builddir="$(abs_top_builddir)"

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ../tests/functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
$top_srcdir/podcheck.pl "$srcdir/libguestfs-test-tool.pod" libguestfs-test-tool \ $top_srcdir/podcheck.pl "$srcdir/libguestfs-test-tool.pod" libguestfs-test-tool \

View File

@@ -22,9 +22,10 @@
# to the disk, then instructing btrfs to move the data between # to the disk, then instructing btrfs to move the data between
# devices. # devices.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available btrfs skip_unless_feature_available btrfs

View File

@@ -18,9 +18,10 @@
# Test btrfs replace devices. # Test btrfs replace devices.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available btrfs skip_unless_feature_available btrfs

View File

@@ -17,9 +17,10 @@
# Test the disk-create API. # Test the disk-create API.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f disk*.img file:*.img rm -f disk*.img file:*.img

View File

@@ -15,9 +15,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_backend libvirt skip_unless_backend libvirt

View File

@@ -18,9 +18,10 @@
# The significance of 27 is that it's the minimum number of disks # The significance of 27 is that it's the minimum number of disks
# supported by every known backend in every supported configuration. # supported by every known backend in every supported configuration.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
disks/test-add-disks -n 27 disks/test-add-disks -n 27

View File

@@ -18,9 +18,10 @@
# Test blocksize parameter of add-drive command # Test blocksize parameter of add-drive command
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
# Test valid values # Test valid values

View File

@@ -15,11 +15,12 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ./functions.sh
set -e set -e
set -x
skip_if_skipped
N=255 N=255
$TEST_FUNCTIONS
skip_if_skipped
disks/test-add-disks --just-add -n $N disks/test-add-disks --just-add -n $N

View File

@@ -15,9 +15,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
slow_test slow_test

View File

@@ -17,10 +17,10 @@
# Test that disks map to the correct qemu -drive parameter. # Test that disks map to the correct qemu -drive parameter.
source ./functions.sh
set -e set -e
set -x set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_libvirt_minimum_version 1 1 3 skip_unless_libvirt_minimum_version 1 1 3

View File

@@ -18,9 +18,10 @@
# Test that disks with <blockio .../> tag map to the correct qemu -device # Test that disks with <blockio .../> tag map to the correct qemu -device
# parameters and respect to logical_block_size value. # parameters and respect to logical_block_size value.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_libvirt_minimum_version 1 1 3 skip_unless_libvirt_minimum_version 1 1 3

View File

@@ -17,9 +17,10 @@
# Test that disks map to the correct qemu -drive parameter. # Test that disks map to the correct qemu -drive parameter.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
export LIBGUESTFS_BACKEND=direct export LIBGUESTFS_BACKEND=direct

View File

@@ -1,6 +1,6 @@
#!/bin/bash - #!/bin/bash -
# libguestfs # libguestfs
# Copyright (C) 2014-2023 Red Hat Inc. # Copyright (C) 2014-2025 Red Hat Inc.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -19,19 +19,24 @@
# Most of the tests written in shell script source this file for # Most of the tests written in shell script source this file for
# useful functions. # useful functions.
# #
# To include this file, the test must do: # To include this file, the test should do:
# #
# $TEST_FUNCTIONS # source ./functions.sh
# # set -e
# (this macro is defined in subdir-rules.mk). # set -x
# Clean up the environment in every test script. # Clean up the environment in every test script.
unset CDPATH unset CDPATH
export LANG=C export LANG=C
# When test-functions.sh is invoked, a list of variables is passed as # Various variables defined by autoconf that test scripts might want
# parameters, so we eval those to define the variables. # to use.
while [ $# -ge 1 ]; do eval "$1"; shift; done top_srcdir="@top_srcdir@"
top_builddir="@top_builddir@"
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
abs_builddir="$PWD"
abs_srcdir="$(cd "@srcdir@" && pwd)"
# Configure check results. # Configure check results.
source $abs_top_builddir/config.sh source $abs_top_builddir/config.sh

View File

@@ -19,9 +19,10 @@
# Test the --key option. It is handled by common code so we only need # Test the --key option. It is handled by common code so we only need
# to test one tool (guestfish). # to test one tool (guestfish).
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available luks skip_unless_feature_available luks
skip_unless_phony_guest fedora-luks-on-lvm.img skip_unless_phony_guest fedora-luks-on-lvm.img

View File

@@ -19,9 +19,10 @@
# Test the --key option. It is handled by common code so we only need # Test the --key option. It is handled by common code so we only need
# to test one tool (guestfish). # to test one tool (guestfish).
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available luks skip_unless_feature_available luks
skip_unless_phony_guest fedora-lvm-on-luks.img skip_unless_phony_guest fedora-lvm-on-luks.img

View File

@@ -19,9 +19,10 @@
# Test the --key option. It is handled by common code so we only need # Test the --key option. It is handled by common code so we only need
# to test one tool (guestfish). # to test one tool (guestfish).
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available luks skip_unless_feature_available luks

View File

@@ -18,9 +18,10 @@
# Test LUKS devices appear in the output of list-dm-devices. # Test LUKS devices appear in the output of list-dm-devices.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available luks skip_unless_feature_available luks

View File

@@ -18,9 +18,10 @@
# Test LUKS device creation, opening, key slots. # Test LUKS device creation, opening, key slots.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available luks skip_unless_feature_available luks

View File

@@ -18,9 +18,10 @@
# Test LVM device filtering. # Test LVM device filtering.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test-lvm-filtering-1.img test-lvm-filtering-2.img rm -f test-lvm-filtering-1.img test-lvm-filtering-2.img

View File

@@ -18,9 +18,10 @@
# Test the handling of MD devices specified in /etc/fstab # Test the handling of MD devices specified in /etc/fstab
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora-md1.img skip_unless_phony_guest fedora-md1.img
skip_unless_phony_guest fedora-md2.img skip_unless_phony_guest fedora-md2.img

View File

@@ -19,11 +19,12 @@
# Test various aspects of core inspection of /etc/fstab. # Test various aspects of core inspection of /etc/fstab.
# This also tests: https://bugzilla.redhat.com/668574 # This also tests: https://bugzilla.redhat.com/668574
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_because "device name hints are broken" ;# XXX Fix before 1.38
skip_if_skipped skip_if_skipped
skip_because "device name hints are broken" ;# XXX Fix before 1.38
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img
canonical="sed -r s,/dev/[abce-ln-z]+d,/dev/sd,g" canonical="sed -r s,/dev/[abce-ln-z]+d,/dev/sd,g"

View File

@@ -18,9 +18,10 @@
# Test guestfish list-mddevices command # Test guestfish list-mddevices command
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f list-fs.output rm -f list-fs.output

View File

@@ -18,9 +18,10 @@
# Test guestfish list-md-devices command # Test guestfish list-md-devices command
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
output=$( output=$(

View File

@@ -18,9 +18,10 @@
# Test guestfish finds logical volume (LV) created on md device # Test guestfish finds logical volume (LV) created on md device
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
disk1=lvm-on-md-devices-1.img disk1=lvm-on-md-devices-1.img
@@ -77,4 +78,4 @@ if [ "$output" != "$expected" ]; then
fi fi
# cleanup() is called implicitly which cleans up everything # cleanup() is called implicitly which cleans up everything
exit 0 exit 0

View File

@@ -25,9 +25,10 @@
# is inaccessible so it is easy observable that md device is missing (raid1 in # is inaccessible so it is easy observable that md device is missing (raid1 in
# this case will be operable but in degraded state). # this case will be operable but in degraded state).
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
disk1=md-and-lvm-devices-1.img disk1=md-and-lvm-devices-1.img

View File

@@ -18,9 +18,10 @@
# Test guestfish md-create and md-detail commands. # Test guestfish md-create and md-detail commands.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f mdadm-{1,2,3,4}.img rm -f mdadm-{1,2,3,4}.img

View File

@@ -20,9 +20,10 @@
# md device and does't take into account md device itself (similar to as # md device and does't take into account md device itself (similar to as
# physical devices are skipped if they are partitioned) # physical devices are skipped if they are partitioned)
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
disk1=list-filesystems2-1.img disk1=list-filesystems2-1.img

View File

@@ -16,9 +16,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available btrfs skip_unless_feature_available btrfs

View File

@@ -20,9 +20,10 @@
# especially testing that the network in fact works. For now just # especially testing that the network in fact works. For now just
# test that the network device can be added. # test that the network device can be added.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
guestfish --network -a /dev/null run guestfish --network -a /dev/null run

View File

@@ -18,9 +18,10 @@
# Test the ntfscat-i command. # Test the ntfscat-i command.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available ntfs3g skip_unless_feature_available ntfs3g
skip_unless_phony_guest windows.img skip_unless_phony_guest windows.img

View File

@@ -18,9 +18,10 @@
# Test the ntfsclone-in/-out commands. # Test the ntfsclone-in/-out commands.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_feature_available ntfs3g skip_unless_feature_available ntfs3g
skip_unless_phony_guest windows.img skip_unless_phony_guest windows.img

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=576879#c5 # https://bugzilla.redhat.com/show_bug.cgi?id=576879#c5
# where both ends send cancel messages simultaneously. # where both ends send cancel messages simultaneously.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
guestfish <<EOF guestfish <<EOF

View File

@@ -24,9 +24,10 @@
# may or may not send all of its data because the error condition is # may or may not send all of its data because the error condition is
# detected. # detected.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
tmpfile=`mktemp` tmpfile=`mktemp`

View File

@@ -20,9 +20,10 @@
# #
# This is pretty easy - we just upload a too-large source file. # This is pretty easy - we just upload a too-large source file.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
guestfish \ guestfish \

View File

@@ -18,9 +18,10 @@
# Test if we can handle qemu death from the kill-subprocess command. # Test if we can handle qemu death from the kill-subprocess command.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_backend direct skip_unless_backend direct

View File

@@ -18,9 +18,10 @@
# Test if we can handle qemu death in the middle of a command. # Test if we can handle qemu death in the middle of a command.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_backend direct skip_unless_backend direct

View File

@@ -18,9 +18,10 @@
# Test if we can handle qemu death synchronously. # Test if we can handle qemu death synchronously.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_backend direct skip_unless_backend direct

View File

@@ -18,7 +18,10 @@
# Check force_tcg really forces TCG mode. # Check force_tcg really forces TCG mode.
$TEST_FUNCTIONS source ./functions.sh
set -e
set -x
skip_if_skipped skip_if_skipped
set -e set -e

View File

@@ -20,9 +20,10 @@
# Note this is the first boot test that we run, so it's looking for # Note this is the first boot test that we run, so it's looking for
# all sorts of qemu/kernel/supermin problems. # all sorts of qemu/kernel/supermin problems.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f liveness1.img rm -f liveness1.img

View File

@@ -20,9 +20,10 @@
# underlying disk image. If this test were to fail, you could expect # underlying disk image. If this test were to fail, you could expect
# libguestfs to cause massive disk corruption on live guests. # libguestfs to cause massive disk corruption on live guests.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
f=isolation-add-drive-opts-readonly.img f=isolation-add-drive-opts-readonly.img

View File

@@ -20,9 +20,10 @@
# underlying disk image. If this test were to fail, you could expect # underlying disk image. If this test were to fail, you could expect
# libguestfs to cause massive disk corruption on live guests. # libguestfs to cause massive disk corruption on live guests.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
f=isolation-add-drive-ro.img f=isolation-add-drive-ro.img

View File

@@ -20,9 +20,10 @@
# underlying disk image. If this test were to fail, you could expect # underlying disk image. If this test were to fail, you could expect
# libguestfs to cause massive disk corruption on live guests. # libguestfs to cause massive disk corruption on live guests.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
f=isolation-qcow2.img f=isolation-qcow2.img

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=1001875 # https://bugzilla.redhat.com/show_bug.cgi?id=1001875
# tar-out excludes option. # tar-out excludes option.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f rhbz1001875.img rhbz1001875-[123].tar rm -f rhbz1001875.img rhbz1001875-[123].tar

View File

@@ -22,9 +22,10 @@
# i.e., mount-loop option, which means correct startup sequence and creation # i.e., mount-loop option, which means correct startup sequence and creation
# of base devices (like /dev/loop-control for loopback setup) # of base devices (like /dev/loop-control for loopback setup)
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f rhbz1011907-1165785-loop.img rhbz1011907-1165785.img rm -f rhbz1011907-1165785-loop.img rhbz1011907-1165785.img

View File

@@ -19,9 +19,10 @@
# Regression test for: # Regression test for:
# https://bugzilla.redhat.com/show_bug.cgi?id=1044014 # https://bugzilla.redhat.com/show_bug.cgi?id=1044014
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_backend libvirt skip_unless_backend libvirt
skip_unless_libvirt_minimum_version 1 2 1 skip_unless_libvirt_minimum_version 1 2 1

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=1054761 # https://bugzilla.redhat.com/show_bug.cgi?id=1054761
# Handle broken/missing PVs gracefully. # Handle broken/missing PVs gracefully.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f rhbz1054761-[ab].img rm -f rhbz1054761-[ab].img

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=1091803 # https://bugzilla.redhat.com/show_bug.cgi?id=1091803
# tar-in API didn't cancel the receive correctly along all error paths. # tar-in API didn't cancel the receive correctly along all error paths.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
guestfish <<EOF guestfish <<EOF

View File

@@ -21,9 +21,10 @@
# check that list-alike APIs accept only relative paths and reject # check that list-alike APIs accept only relative paths and reject
# absolute ones # absolute ones
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=1175196 # https://bugzilla.redhat.com/show_bug.cgi?id=1175196
# Parse 'LIBGUESTFS_TRACE=0' in the environment. # Parse 'LIBGUESTFS_TRACE=0' in the environment.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
output="$(guestfish <<EOF output="$(guestfish <<EOF

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=1477623 # https://bugzilla.redhat.com/show_bug.cgi?id=1477623
# Check that the 'file' API doesn't break on some chardevs. # Check that the 'file' API doesn't break on some chardevs.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -22,9 +22,10 @@
# Actually a bug/change in LVM, previously we failed to create an LV # Actually a bug/change in LVM, previously we failed to create an LV
# if the underlying disk contained a filesystem signature. # if the underlying disk contained a filesystem signature.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img

View File

@@ -24,9 +24,10 @@
# (In some cases useful info about processes that use # (In some cases useful info about processes that use
# the device is found by lsof(8) or fuser(1)) # the device is found by lsof(8) or fuser(1))
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
guestfish -N rhbz503169c13.img=fs -m /dev/sda1 <<EOF guestfish -N rhbz503169c13.img=fs -m /dev/sda1 <<EOF

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=557655 # https://bugzilla.redhat.com/show_bug.cgi?id=557655
# "guestfish number parsing should not use atoi, should support '0...' for octal and '0x...' for hexadecimal" # "guestfish number parsing should not use atoi, should support '0...' for octal and '0x...' for hexadecimal"
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f rhbz557655.out rhbz557655.err rm -f rhbz557655.out rhbz557655.err

View File

@@ -19,9 +19,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=563450 # https://bugzilla.redhat.com/show_bug.cgi?id=563450
# Test the order of added images # Test the order of added images
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_phony_guest fedora.img skip_unless_phony_guest fedora.img
skip_unless_phony_guest debian.img skip_unless_phony_guest debian.img

View File

@@ -19,9 +19,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=563450 # https://bugzilla.redhat.com/show_bug.cgi?id=563450
# Test only CD-ROM disk images can be added # Test only CD-ROM disk images can be added
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
skip_unless_test_iso skip_unless_test_iso

View File

@@ -20,9 +20,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=576879#c0 # https://bugzilla.redhat.com/show_bug.cgi?id=576879#c0
# upload loses synchronization if the disk is not mounted # upload loses synchronization if the disk is not mounted
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
guestfish <<EOF guestfish <<EOF

View File

@@ -21,9 +21,10 @@
# prefix '-' in sub-command isn't handled by guestfish in remote control mode # prefix '-' in sub-command isn't handled by guestfish in remote control mode
# Reported by Qixiang Wan. # Reported by Qixiang Wan.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
# Start remote guestfish. # Start remote guestfish.

View File

@@ -20,9 +20,10 @@
# available space. # available space.
# https://bugzilla.redhat.com/show_bug.cgi?id=580246 # https://bugzilla.redhat.com/show_bug.cgi?id=580246
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f rhbz580246.img rhbz580246.tar rm -f rhbz580246.img rhbz580246.tar

View File

@@ -19,9 +19,10 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=602997 # https://bugzilla.redhat.com/show_bug.cgi?id=602997
# Fix part-get-bootable to work with missing/unordered partitions. # Fix part-get-bootable to work with missing/unordered partitions.
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
output=rhbz602997.output output=rhbz602997.output

View File

@@ -23,9 +23,10 @@
# The 'iface' parameter is now ignored: # The 'iface' parameter is now ignored:
# https://bugzilla.redhat.com/show_bug.cgi?id=1844341 # https://bugzilla.redhat.com/show_bug.cgi?id=1844341
source ./functions.sh
set -e set -e
set -x
$TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f rhbz690819.img rm -f rhbz690819.img

Some files were not shown because too many files have changed in this diff Show More