# "guestfish number parsing should not use atoi, should support '0...' for octal and '0x...' for hexadecimal"
set -e
-rm -f test.out
+rm -f test.out test.err
export LANG=C
-unset LIBGUESTFS_DEBUG
-../fish/guestfish >> test.out 2>&1 <<EOF
+../fish/guestfish >> test.out 2>> test.err <<EOF
# set-memsize is just a convenient non-daemon function that
# takes a single integer argument.
set-memsize 0
-set-memsize 07777770000000000000
-set-memsize ABC
-set-memsize 09
--set-memsize 123K
-set-memsize 123L
EOF
-../fish/guestfish >> test.out 2>&1 <<EOF
-alloc test1.img 10M
-run
-part-disk /dev/sda mbr
-mkfs ext2 /dev/sda1
-mount /dev/sda1 /
-
+../fish/guestfish -N fs -m /dev/sda1 >> test.out 2>> test.err <<EOF
touch /test
# truncate-size takes an Int64 argument
# these should all provoke parse errors:
-truncate-size /test ABC
-truncate-size /test 09
--truncate-size /test 123K
-truncate-size /test 123L
EOF
-diff -u test.out rhbz557655-expected.out
-rm test.out test1.img
+# If we are running with debugging enabled (or even if not), then
+# other messages and warnings can end up in the test.err (stderr) log.
+# Thus filter out only lines we expect. 'proc 200' is the procedure
+# number of truncate_size.
+mv test.err test.err~
+grep -E 'set[-_]memsize|truncate[-_]size' test.err~ |
+ grep -Ev 'proc 200' > test.err
+rm test.err~
+
+diff -u rhbz557655-expected.stdout test.out
+diff -u rhbz557655-expected.stderr test.err
+rm test.out test.err test1.img