2005-10-23 15:46:39 +00:00
|
|
|
#!/bin/sh
|
2006-08-17 19:58:17 +00:00
|
|
|
# Test "sha384sum".
|
|
|
|
|
|
2007-08-14 10:21:48 +02:00
|
|
|
# Copyright (C) 2005, 2007 Free Software Foundation, Inc.
|
2006-08-17 19:58:17 +00:00
|
|
|
|
2007-07-23 14:35:58 +02:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2006-08-17 19:58:17 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-23 14:35:58 +02:00
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
2006-08-17 19:58:17 +00:00
|
|
|
# (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
|
2007-07-23 14:35:58 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-10-23 15:46:39 +00:00
|
|
|
|
|
|
|
|
: ${PERL=perl}
|
|
|
|
|
: ${srcdir=.}
|
|
|
|
|
|
2007-08-14 10:21:48 +02:00
|
|
|
PROG=`echo $0|sed 's,.*/,,'`; export PROG
|
|
|
|
|
|
2007-11-16 09:35:54 +01:00
|
|
|
$PERL -e 'use warnings;' > /dev/null 2>&1 || {
|
2005-10-23 15:46:39 +00:00
|
|
|
echo 1>&2 "$0: configure didn't find a usable version of Perl," \
|
|
|
|
|
"so can't run this test"
|
|
|
|
|
exit 77
|
|
|
|
|
}
|
|
|
|
|
|
Run each Coreutils.pm-based test in its own subdirectory.
* tests/CuTmpdir.pm: New file.
* tests/Makefile.am (EXTRA_DIST): Add CuTmpdir.pm.
* tests/misc/od, tests/misc/base64, tests/misc/basename:
* tests/misc/cut, tests/misc/date, tests/misc/dirname:
* tests/misc/expand, tests/misc/fold, tests/misc/head-elide-tail:
* tests/misc/paste-no-nl, tests/misc/pr, tests/misc/sha224sum:
* tests/misc/sha256sum, tests/misc/sha384sum, tests/misc/sha512sum:
* tests/misc/sort-merge, tests/misc/stat-printf, tests/misc/test-diag:
* tests/misc/wc-files0-from, tests/misc/xstrtol:
* tests/dd/skip-seek, tests/dircolors/simple, tests/du/files0-from:
* tests/expr/basic, tests/factor/basic, tests/fmt/basic:
* tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
* tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
* tests/sum/basic-1, tests/tsort/basic-1, tests/unexpand/basic-1:
* tests/mv/i-1, tests/rm/empty-name, tests/rm/unreadable: Use it.
* tests/misc/test-diag: Use "$ENV{abs_top_builddir}/src/test",
not "../../src/test", so it works when run from a subdirectory.
* tests/ls-2/tests: Create temp files and dirs from within the perl
script, so that they're removed, when run from a subdirectory.
2007-08-18 08:50:00 +02:00
|
|
|
me=`echo $0|sed 's,.*/,,'`
|
|
|
|
|
exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - <<\EOF
|
2005-10-23 15:46:39 +00:00
|
|
|
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 $sha_degenerate = "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b";
|
|
|
|
|
|
|
|
|
|
my @Tests =
|
|
|
|
|
(
|
|
|
|
|
['s1', {IN=> {f=> ''}},
|
|
|
|
|
{OUT=>"$sha_degenerate f\n"}],
|
|
|
|
|
['s2', {IN=> {f=> 'a'}},
|
|
|
|
|
{OUT=>"54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 f\n"}],
|
|
|
|
|
['s3', {IN=> {f=> 'abc'}},
|
|
|
|
|
{OUT=>"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 f\n"}],
|
|
|
|
|
['s4',
|
|
|
|
|
{IN=> {f=> 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu'}},
|
|
|
|
|
{OUT=>"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 f\n"}],
|
|
|
|
|
['s8', {IN=> {f=> 'a' x 1000000}},
|
|
|
|
|
{OUT=>"9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985 f\n"}],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
# Insert the `--text' argument for each test.
|
|
|
|
|
my $t;
|
|
|
|
|
foreach $t (@Tests)
|
|
|
|
|
{
|
|
|
|
|
splice @$t, 1, 0, '--text' unless @$t[1] =~ /--check/;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|