sort: add a test case for the sort -u bug
[coreutils/ericb.git] / tests / dd / skip-seek
blob2ce02de01c5a7d3885cc3b6741937d74539cf718
1 #!/usr/bin/perl
2 # Test dd's skip and seek options.
4 # Copyright (C) 2000-2010 Free Software Foundation, Inc.
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.
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.
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/>.
19 use strict;
21 (my $program_name = $0) =~ s|.*/||;
23 # Turn off localization of executable's output.
24 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
25 my $out = 'out';
27 my @Tests =
30 'sk-seek1',
31 qw (bs=1 skip=1 seek=2 conv=notrunc count=3 status=noxfer of=@AUX@ < ),
32 {IN=> '0123456789abcdef'},
33 {AUX=> 'zyxwvutsrqponmlkji'},
34 {OUT=> ''},
35 {ERR=> "3+0 records in\n3+0 records out\n"},
36 {CMP=> ['zy123utsrqponmlkji', {'@AUX@'=> undef}]},
39 'sk-seek2',
40 qw (bs=5 skip=1 seek=1 conv=notrunc count=1 status=noxfer of=@AUX@ < ),
41 {IN=> '0123456789abcdef'},
42 {AUX=> 'zyxwvutsrqponmlkji'},
43 {OUT=> ''},
44 {ERR=> "1+0 records in\n1+0 records out\n"},
45 {CMP=> ['zyxwv56789ponmlkji', {'@AUX@'=> undef}]},
48 'sk-seek3',
49 qw (bs=5 skip=1 seek=1 count=1 status=noxfer of=@AUX@ < ),
50 {IN=> '0123456789abcdef'},
51 {AUX=> 'zyxwvutsrqponmlkji'},
52 {OUT=> ''},
53 {ERR=> "1+0 records in\n1+0 records out\n"},
54 {CMP=> ['zyxwv56789', {'@AUX@'=> undef}]},
57 # Before fileutils-4.0.45, the last 10 bytes of output
58 # were these "\0\0\0\0\0\0\0\0 ".
59 'block-sync-1', qw(ibs=10 cbs=10 status=noxfer), 'conv=block,sync', '<',
60 {IN=> "01234567\nabcdefghijkl\n"},
61 {OUT=> "01234567 abcdefghij "},
62 {ERR=> "2+1 records in\n0+1 records out\n1 truncated record\n"},
65 # Before coreutils-5.93, this would output just "c\n".
66 'sk-seek4', qw(bs=1 skip=1 status=noxfer),
67 {IN_PIPE=> "abc\n"},
68 {OUT=> "bc\n"},
69 {ERR=> "3+0 records in\n3+0 records out\n"},
73 my $save_temps = $ENV{DEBUG};
74 my $verbose = $ENV{VERBOSE};
76 my $prog = 'dd';
77 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
78 exit $fail;