chiark / gitweb /
Support feeble FreeBSD versions of dd and truncate in tests
[vbig.git] / t-args
1 #! /bin/sh
2 #
3 # This file is part of vbig.
4 # Copyright (C) 2014 Richard Kettlewell
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 3 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 <http://www.gnu.org/licenses/>.
18 #
19 set -e
20 rm -f testoutput testexpect
21
22 case $(uname -s) in
23 *BSD )
24   ERANGE="Result too large"
25   ;;
26 * )
27   ERANGE="Numerical result out of range"
28   ;;
29 esac
30
31 echo "ERROR: invalid size: ${ERANGE}" > testexpect
32 if ./vbig testfile 9223372036854775808 2>testoutput; then
33   echo >&2 ERROR: unexpectedly succeeded
34   exit 1
35 fi
36 diff -u testexpect testoutput
37
38 echo 'ERROR: invalid size' > testexpect
39 if ./vbig testfile 9007199254740992K 2>testoutput; then
40   echo >&2 ERROR: unexpectedly succeeded
41   exit 1
42 fi
43 diff -u testexpect testoutput
44
45 if ./vbig testfile 8796093022208G 2>testoutput; then
46   echo >&2 ERROR: unexpectedly succeeded
47   exit 1
48 fi
49 diff -u testexpect testoutput
50
51 echo 'ERROR: invalid scale' > testexpect
52 if ./vbig testfile 1T 2>testoutput; then
53   echo >&2 ERROR: unexpectedly succeeded
54   exit 1
55 fi
56 diff -u testexpect testoutput
57
58 if ./vbig testfile 1KK 2>testoutput; then
59   echo >&2 ERROR: unexpectedly succeeded
60   exit 1
61 fi
62 diff -u testexpect testoutput
63
64
65 rm -f testoutput testexpect