diff options
author | Jim Meyering <jim@meyering.net> | 2007-08-14 10:17:52 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-08-14 10:39:05 +0200 |
commit | e769e6e632469fc66ea5397431cad25134766264 (patch) | |
tree | d17f31dc321891bc03022edde549d420c24fa47a | |
parent | 1490f2dbf33ca75f060890013fb0d8caf28225aa (diff) | |
download | coreutils-e769e6e632469fc66ea5397431cad25134766264.tar.xz |
Add tests for the just-fixed "od -j N FILE" bug.
* tests/misc/od: New file, test for the above.
* tests/misc/Makefile.am (TESTS): Add od.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | tests/misc/Makefile.am | 1 | ||||
-rwxr-xr-x | tests/misc/od | 60 |
3 files changed, 64 insertions, 0 deletions
@@ -7,6 +7,9 @@ iteration would use unadjusted input stream pointer, thus ignoring the desired "skip". Report and patch by Paul GHALEB. + * tests/misc/od: New file, test for the above. + * tests/misc/Makefile.am (TESTS): Add od. + 2007-08-10 Paul Eggert <eggert@cs.ucla.edu> Accommodate more xstrtol changes. diff --git a/tests/misc/Makefile.am b/tests/misc/Makefile.am index 8cf03f2a4..7206b3926 100644 --- a/tests/misc/Makefile.am +++ b/tests/misc/Makefile.am @@ -42,6 +42,7 @@ TESTS_ENVIRONMENT = \ # will execute the test script rather than the standard utility. TESTS = \ + od \ xstrtol \ arch \ pr \ diff --git a/tests/misc/od b/tests/misc/od new file mode 100755 index 000000000..aba847458 --- /dev/null +++ b/tests/misc/od @@ -0,0 +1,60 @@ +#!/bin/sh +# -*- perl -*- +# Exercise od + +# Copyright (C) 2006, 2007 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +: ${PERL=perl} +: ${srcdir=.} + +PROG=`echo $0|sed 's,.*/,,'`; export PROG + +$PERL -e 1 > /dev/null 2>&1 || { + echo 1>&2 "$0: configure didn't find a usable version of Perl," \ + "so can't run this test" + exit 77 +} + +exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF +require 5.003; +use strict; + +(my $program_name = $0) =~ s|.*/||; + +# Turn off localisation of executable's ouput. +@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; + +my @Tests = + ( + # Skip the exact length of the input file. + # Before coreutils-6.10, this would ignore the "-j 1". + ['j-bug1', '-c -j 1 -An', {IN=>{g=>'a'}}, {OUT=>''}], + ['j-bug2', '-c -j 2 -An', {IN=>{g=>'a'}}, {IN=>{h=>'b'}}, {OUT=>''}], + # Skip the sum of the lengths of the first three inputs. + ['j-bug3', '-c -j 3 -An', {IN=>{g=>'a'}}, {IN=>{h=>'b'}}, + {IN=>{i=>'c'}}, {OUT=>''}], + # Skip the sum of the lengths of the first three inputs, printing the 4th. + ['j-bug4', '-c -j 3 -An', {IN=>{g=>'a'}}, {IN=>{h=>'b'}}, + {IN=>{i=>'c'}}, {IN=>{j=>'d'}}, {OUT=>" d\n"}], + ); + +my $save_temps = $ENV{DEBUG}; +my $verbose = $ENV{VERBOSE}; + +my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n"; +my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); +exit $fail; +EOF |