2 # ensure that reading a file larger than BUFSIZ works
4 # Copyright (C) 2008, 2010 Red Hat, Inc.
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.
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.
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/>.
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`/..
24 if test "$VERBOSE" = yes; then
26 $abs_top_builddir/tools/virsh --version
29 . "$srcdir/test-lib.sh"
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
36 # Change the VM name and UUID
37 sed -e "s|<name>test</name>|<name>newtest</name>|g" \
38 -e "\|<uuid>.*</uuid>|d" \
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
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
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
53 (exit $fail); exit $fail