diff options
author | Jim Meyering <jim@meyering.net> | 2000-10-22 11:56:18 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-10-22 11:56:18 +0000 |
commit | 82495b5d26e2a6f380688acec0f5487d1f5442ad (patch) | |
tree | 97f65a48a66dce17aa8642cb52df6694f001d90e | |
parent | cf806f5d2daf229f790d40c264ffb736914b0ef7 (diff) | |
download | coreutils-82495b5d26e2a6f380688acec0f5487d1f5442ad.tar.xz |
.
-rw-r--r-- | tests/sha1sum/.cvsignore | 1 | ||||
-rw-r--r-- | tests/sha1sum/Makefile.am | 12 | ||||
-rw-r--r-- | tests/sha1sum/Makefile.in | 286 | ||||
-rwxr-xr-x | tests/sha1sum/basic-1 | 58 |
4 files changed, 357 insertions, 0 deletions
diff --git a/tests/sha1sum/.cvsignore b/tests/sha1sum/.cvsignore new file mode 100644 index 000000000..f3c7a7c5d --- /dev/null +++ b/tests/sha1sum/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/tests/sha1sum/Makefile.am b/tests/sha1sum/Makefile.am new file mode 100644 index 000000000..f097c3d52 --- /dev/null +++ b/tests/sha1sum/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in -*-Makefile-*-. + +EXTRA_DIST = $(TESTS) + +TESTS_ENVIRONMENT = \ + top_srcdir=$(top_srcdir) \ + srcdir=$(srcdir) \ + PERL="@PERL@" \ + PATH=`pwd`/../../src:$$PATH \ + PROG=shasum + +TESTS = basic-1 diff --git a/tests/sha1sum/Makefile.in b/tests/sha1sum/Makefile.in new file mode 100644 index 000000000..47bed26a6 --- /dev/null +++ b/tests/sha1sum/Makefile.in @@ -0,0 +1,286 @@ +# Makefile.in generated automatically by automake 1.4a from Makefile.am + +# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +@SET_MAKE@ +host_alias = @host_alias@ +host_triplet = @host@ +AMDEP = @AMDEP@ +AMTAR = @AMTAR@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DATADIRNAME = @DATADIRNAME@ +DEPDIR = @DEPDIR@ +DF_PROG = @DF_PROG@ +FESETROUND_LIBM = @FESETROUND_LIBM@ +GENCAT = @GENCAT@ +GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNU_PACKAGE = @GNU_PACKAGE@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +KMEM_GROUP = @KMEM_GROUP@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_CRYPT = @LIB_CRYPT@ +LIB_NANOSLEEP = @LIB_NANOSLEEP@ +MAKEINFO = @MAKEINFO@ +MAN = @MAN@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +NEED_SETGID = @NEED_SETGID@ +OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@ +OPTIONAL_BIN_ZCRIPTS = @OPTIONAL_BIN_ZCRIPTS@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POW_LIBM = @POW_LIBM@ +RANLIB = @RANLIB@ +SEQ_LIBM = @SEQ_LIBM@ +SQRT_LIBM = @SQRT_LIBM@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +YACC = @YACC@ +install_sh = @install_sh@ +l = @l@ + + +EXTRA_DIST = $(TESTS) + +TESTS_ENVIRONMENT = \ + top_srcdir=$(top_srcdir) \ + srcdir=$(srcdir) \ + PERL="@PERL@" \ + PATH=`pwd`/../../src:$$PATH \ + PROG=shasum + + +TESTS = basic-1 +subdir = tests/shasum +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/shasum/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + -rm -f Makefile.in +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags check-TESTS distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all install-strip installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/sha1sum/basic-1 b/tests/sha1sum/basic-1 new file mode 100755 index 000000000..8e148267a --- /dev/null +++ b/tests/sha1sum/basic-1 @@ -0,0 +1,58 @@ +#!/bin/sh + +: ${PERL=perl} +: ${srcdir=.} + +case "$PERL" in + *'missing perl') + echo 1>&2 "$0: configure didn't find a usable version of Perl, so can't run this test" + exit 77 + ;; +esac + +exec $PERL -w -I$srcdir/.. -MFetish -- - <<\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 = "da39a3ee5e6b4b0d3255bfef95601890afd80709"; + +my @Tests = + ( + ['s1', {IN=> {f=> ''}}, + {OUT=>"$sha_degenerate f\n"}], + ['s2', {IN=> {f=> 'a'}}, + {OUT=>"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 f\n"}], + ['s3', {IN=> {f=> 'abc'}}, + {OUT=>"a9993e364706816aba3e25717850c26c9cd0d89d f\n"}], + ['s4', + {IN=> {f=> 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'}}, + {OUT=>"84983e441c3bd26ebaae4aa1f95129e5e54670f1 f\n"}], + ['s5', {IN=> {f=> 'abcdefghijklmnopqrstuvwxyz'}}, + {OUT=>"32d10c7b8cf96570ca04ce37f2a19d84240d3a89 f\n"}], + ['s6', {IN=> {f=> join ('', 'A'..'Z', 'a'..'z', '0'..'9')}}, + {OUT=>"761c457bf73b14d27e9e9265c46f4b4dda11f940 f\n"}], + ['s7', {IN=> {f=> '1234567890' x 8}}, + {OUT=>"50abf5706a150990a08b2c5ea40fa0e585554732 f\n"}], + ['bs-sha', {IN=> {".\\foo"=> ''}}, + {OUT=>"\\$sha_degenerate .\\\\foo\n"}], + ); + +# Insert the `--text' argument for each test. +my $t; +foreach $t (@Tests) + { + splice @$t, 1, 0, '--text'; + } + +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 |