summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-10-23 15:46:39 +0000
committerJim Meyering <jim@meyering.net>2005-10-23 15:46:39 +0000
commitc5795228dd5ab748d9935cff8feaba9ac856f87b (patch)
tree2e20963bcb5cde796887b4377f7bda4e6638be1c /tests
parent1ad9207ebb9851575748b3e64a7a14d0892943c2 (diff)
downloadcoreutils-c5795228dd5ab748d9935cff8feaba9ac856f87b.tar.xz
test scripts from David Madore
Diffstat (limited to 'tests')
-rw-r--r--tests/misc/Makefile.in7
-rwxr-xr-xtests/misc/sha224sum45
-rwxr-xr-xtests/misc/sha256sum51
-rwxr-xr-xtests/misc/sha384sum51
-rwxr-xr-xtests/misc/sha512sum51
5 files changed, 204 insertions, 1 deletions
diff --git a/tests/misc/Makefile.in b/tests/misc/Makefile.in
index d124f61aa..758d0e1fc 100644
--- a/tests/misc/Makefile.in
+++ b/tests/misc/Makefile.in
@@ -118,7 +118,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \
$(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \
$(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \
$(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/settime.m4 \
- $(top_srcdir)/m4/sha1.m4 $(top_srcdir)/m4/sig2str.m4 \
+ $(top_srcdir)/m4/sha1.m4 $(top_srcdir)/m4/sha256.m4 \
+ $(top_srcdir)/m4/sha512.m4 $(top_srcdir)/m4/sig2str.m4 \
$(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/socklen.m4 \
$(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \
$(top_srcdir)/m4/st_dm_mode.m4 $(top_srcdir)/m4/stat-macros.m4 \
@@ -305,6 +306,10 @@ TESTS_ENVIRONMENT = \
PROG=$$tst
TESTS = \
+ sha224sum \
+ sha256sum \
+ sha384sum \
+ sha512sum \
date \
tac-continue \
close-stdout \
diff --git a/tests/misc/sha224sum b/tests/misc/sha224sum
new file mode 100755
index 000000000..edbe05858
--- /dev/null
+++ b/tests/misc/sha224sum
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+: ${PERL=perl}
+: ${srcdir=.}
+
+$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 =
+ (
+ ['s3', {IN=> {f=> 'abc'}},
+ {OUT=>"23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 f\n"}],
+ ['s4',
+ {IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}},
+ {OUT=>"75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 f\n"}],
+ ['s8', {IN=> {f=> 'a' x 1000000}},
+ {OUT=>"20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67 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
diff --git a/tests/misc/sha256sum b/tests/misc/sha256sum
new file mode 100755
index 000000000..2b65372b2
--- /dev/null
+++ b/tests/misc/sha256sum
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+: ${PERL=perl}
+: ${srcdir=.}
+
+$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 $sha_degenerate = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
+
+my @Tests =
+ (
+ ['s1', {IN=> {f=> ''}},
+ {OUT=>"$sha_degenerate f\n"}],
+ ['s2', {IN=> {f=> 'a'}},
+ {OUT=>"ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb f\n"}],
+ ['s3', {IN=> {f=> 'abc'}},
+ {OUT=>"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad f\n"}],
+ ['s4',
+ {IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}},
+ {OUT=>"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 f\n"}],
+ ['s8', {IN=> {f=> 'a' x 1000000}},
+ {OUT=>"cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0 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
diff --git a/tests/misc/sha384sum b/tests/misc/sha384sum
new file mode 100755
index 000000000..507fb6737
--- /dev/null
+++ b/tests/misc/sha384sum
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+: ${PERL=perl}
+: ${srcdir=.}
+
+$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 $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
diff --git a/tests/misc/sha512sum b/tests/misc/sha512sum
new file mode 100755
index 000000000..f61c7149e
--- /dev/null
+++ b/tests/misc/sha512sum
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+: ${PERL=perl}
+: ${srcdir=.}
+
+$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 $sha_degenerate = "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e";
+
+my @Tests =
+ (
+ ['s1', {IN=> {f=> ''}},
+ {OUT=>"$sha_degenerate f\n"}],
+ ['s2', {IN=> {f=> 'a'}},
+ {OUT=>"1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75 f\n"}],
+ ['s3', {IN=> {f=> 'abc'}},
+ {OUT=>"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f f\n"}],
+ ['s4',
+ {IN=> {f=> 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu'}},
+ {OUT=>"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 f\n"}],
+ ['s8', {IN=> {f=> 'a' x 1000000}},
+ {OUT=>"e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b 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