1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
  
     | 
    
      #!/bin/bash
# @configure_input@
#
# (C) Copyright 2015 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., 675 Mass Ave, Cambridge, MA 02139, USA.
# Run 'make check' on installed packages.
#
# The version of installed libguestfs being tested, and the version of
# the libguestfs source tree must be the same.
unset CDPATH
export LANG=C
set -e
set -x
# Grrrrrrr autoconf.
prefix=@prefix@
exec_prefix=@exec_prefix@
# Remove all libtool crappage.
find -name 'lt-*' | grep '/.libs/lt-' | xargs -r rm
# Copy the installed library into libtool directory.
rm -f lib/.libs/libguestfs.so*
cp @libdir@/libguestfs.so lib/.libs/
cp @libdir@/libguestfs.so.0 lib/.libs/
cp @libdir@/libguestfs.so.0.* lib/.libs/
# Copy installed binaries into the right places.
cp @bindir@/libguestfs-test-tool  test-tool/
cp @bindir@/guestfish             fish/
cp @bindir@/guestmount            fuse/
cp @bindir@/virt-alignment-scan   align/
cp @bindir@/virt-builder          builder/
cp @bindir@/virt-builder-repository builder/
cp @bindir@/virt-cat              cat/
cp @bindir@/virt-copy-in          fish/
cp @bindir@/virt-copy-out         fish/
cp @bindir@/virt-customize        customize/
cp @bindir@/virt-dib              dib/
cp @bindir@/virt-diff             diff/
cp @bindir@/virt-df               df/
cp @bindir@/virt-edit             edit/
cp @bindir@/virt-filesystems      cat/
cp @bindir@/virt-format           format/
cp @bindir@/virt-get-kernel       get-kernel/
cp @bindir@/virt-inspector        inspector/
cp @bindir@/virt-ls               cat/
cp @bindir@/virt-make-fs          make-fs/
cp @bindir@/virt-rescue           rescue/
cp @bindir@/virt-resize           resize/
cp @bindir@/virt-sparsify         sparsify/
cp @bindir@/virt-sysprep          sysprep/
cp @bindir@/virt-tar-in           fish/
cp @bindir@/virt-tar-out          fish/
cp @bindir@/virt-win-reg          tools/
# virt-list-filesystems, virt-list-partitions and virt-tar are not
# tested, because they are not routinely installed by Linux distros
# (being legacy programs).
# XXX No language bindings are copied at the moment.
# Copy the installed appliance.
rm -rf appliance/supermin.d
cp -r @libdir@/guestfs/supermin.d appliance/
# Try to force the appliance not to get rebuilt:
touch appliance/stamp-supermin
rm -rf "tmp/.guestfs-$(id -u)"
# Run the tests.
make check -k
# Check the library and some critical binaries didn't get rebuilt
# during the 'make check', which would invalidate the results of
# the test.
compare () {
    sum1=`md5sum $1 | @AWK@ '{print $1}'`
    sum2=`md5sum $2 | @AWK@ '{print $1}'`
    if [ "$sum1" != "$sum2" ]; then
        echo "$2 was overwritten during the test.  Test results are invalid."
        exit 1
    fi
}
compare @libdir@/libguestfs.so lib/.libs/libguestfs.so
compare @bindir@/guestfish  fish/guestfish
compare @bindir@/guestmount fuse/guestmount
compare @bindir@/virt-df    df/virt-df
compare @libdir@/guestfs/supermin.d/daemon.tar.gz \
                            appliance/supermin.d/daemon.tar.gz
# Now do a make clean to remove all the above.
make clean >/dev/null 2>&1 ||:
 
     |