Add missing libxml2-tools dependency
[archive/platform/upstream/libvirt.git] / tests / read-bufsiz
1 #!/bin/sh
2 # ensure that reading a file larger than BUFSIZ works
3
4 # Copyright (C) 2008, 2010 Red Hat, Inc.
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 2 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see
18 # <http://www.gnu.org/licenses/>.
19
20 test -z "$srcdir" && srcdir=`pwd`
21 test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/..
22 test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/..
23
24 if test "$VERBOSE" = yes; then
25   set -x
26   $abs_top_builddir/tools/virsh --version
27 fi
28
29 . "$srcdir/test-lib.sh"
30
31 fail=0
32
33 # Output a valid definition, to be used as input.
34 $abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml.t || fail=1
35
36 # Change the VM name and UUID
37 sed -e "s|<name>test</name>|<name>newtest</name>|g" \
38   -e "\|<uuid>.*</uuid>|d" \
39   xml.t > xml
40
41 for i in before after; do
42   # The largest BUFSIZ I've seen is 128K.  This is slightly larger.
43   printf %132000s ' ' > sp || fail=1
44   in=in-$i
45   # Append or prepend enough spaces to push the size over the limit:
46   ( test $i = before && cat sp xml || cat xml sp ) > $in || fail=1
47
48   $abs_top_builddir/tools/virsh --connect test:///default define $in > out || fail=1
49   printf "Domain newtest defined from $in\n\n" > exp || fail=1
50   compare exp out || fail=1
51 done
52
53 (exit $fail); exit $fail