3 # Test dd's skip and seek options.
5 # Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation,
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 $PERL -e 1 > /dev/null 2>&1 || {
27 echo 1>&2 "$0: configure didn't find a usable version of Perl," \
28 "so can't run this test"
35 exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
39 (my $program_name = $0) =~ s|.*/||;
41 # Turn off localisation of executable's ouput.
42 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
44 my $script_name = $ENV{SCRIPT_NAME};
50 qw (bs=1 skip=1 seek=2 conv=notrunc count=3 status=noxfer of=@AUX@ < ),
51 {IN=> '0123456789abcdef'},
52 {AUX=> 'zyxwvutsrqponmlkji'},
54 {ERR=> "3+0 records in\n3+0 records out\n"},
55 {CMP=> ['zy123utsrqponmlkji', {'@AUX@'=> undef}]},
59 qw (bs=5 skip=1 seek=1 conv=notrunc count=1 status=noxfer of=@AUX@ < ),
60 {IN=> '0123456789abcdef'},
61 {AUX=> 'zyxwvutsrqponmlkji'},
63 {ERR=> "1+0 records in\n1+0 records out\n"},
64 {CMP=> ['zyxwv56789ponmlkji', {'@AUX@'=> undef}]},
68 qw (bs=5 skip=1 seek=1 count=1 status=noxfer of=@AUX@ < ),
69 {IN=> '0123456789abcdef'},
70 {AUX=> 'zyxwvutsrqponmlkji'},
72 {ERR=> "1+0 records in\n1+0 records out\n"},
73 {CMP=> ['zyxwv56789', {'@AUX@'=> undef}]},
76 # Before fileutils-4.0.45, the last 10 bytes of output
77 # were these "\0\0\0\0\0\0\0\0 ".
78 'block-sync-1', qw(ibs=10 cbs=10 status=noxfer), 'conv=block,sync', '<',
79 {IN=> "01234567\nabcdefghijkl\n"},
80 {OUT=> "01234567 abcdefghij "},
81 {ERR=> "2+1 records in\n0+1 records out\n1 truncated record\n"},
84 # Before coreutils-5.93, this would output just "c\n".
85 'sk-seek4', qw(bs=1 skip=1 status=noxfer),
88 {ERR=> "3+0 records in\n3+0 records out\n"},
92 my $save_temps = $ENV{DEBUG};
93 my $verbose = $ENV{VERBOSE};
95 my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
96 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);