.
[coreutils.git] / tests / od / od-N
blobb82d2c12b0f8206c84b4d91a76e3ce61685e9db8
1 #!/bin/sh
2 # Verify that `od -N N' reads no more than N bytes of input.
4 if test "$VERBOSE" = yes; then
5 set -x
6 od --version
7 fi
9 # FIXME: . $srcdir/../envvar-check
10 # FIXME: . $srcdir/../lang-default
11 # FIXME: PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
12 # FIXME: PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
14 pwd=`pwd`
15 tmp=od-N.$$
16 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
17 trap '(exit $?); exit' 1 2 13 15
19 framework_failure=0
20 mkdir $tmp || framework_failure=1
21 cd $tmp || framework_failure=1
22 echo abcdefg > in || framework_failure=1
24 if test $framework_failure = 1; then
25 echo 'failure in testing framework' 1>&2
26 (exit 1); exit
29 fail=0
31 (od -An -N3 -c; od -An -N3 -c) < in > out
32 cat <<EOF > exp || fail=1
33 a b c
34 d e f
35 EOF
36 cmp out exp || {
37 fail=1
38 diff out exp 2> /dev/null
41 (exit $fail); exit