summaryrefslogtreecommitdiff
path: root/tests/md5sum
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-12-22 14:15:37 +0000
committerJim Meyering <jim@meyering.net>1996-12-22 14:15:37 +0000
commit103713c42b152ba1bf5fb6aa45cb2c549872d783 (patch)
tree74d2b1f8e8192f1d9af8375e5b4847dc7614506d /tests/md5sum
parentc84fb64144c967ba2f32db83029f423fd7d10fad (diff)
downloadcoreutils-103713c42b152ba1bf5fb6aa45cb2c549872d783.tar.xz
.
Diffstat (limited to 'tests/md5sum')
-rw-r--r--tests/md5sum/.cvsignore1
-rw-r--r--tests/md5sum/Makefile.in48
-rwxr-xr-xtests/md5sum/md5sum-tests137
3 files changed, 182 insertions, 4 deletions
diff --git a/tests/md5sum/.cvsignore b/tests/md5sum/.cvsignore
index f3c7a7c5d..807bf855a 100644
--- a/tests/md5sum/.cvsignore
+++ b/tests/md5sum/.cvsignore
@@ -1 +1,2 @@
Makefile
+mk-script
diff --git a/tests/md5sum/Makefile.in b/tests/md5sum/Makefile.in
index bb32ce4f3..0d371b575 100644
--- a/tests/md5sum/Makefile.in
+++ b/tests/md5sum/Makefile.in
@@ -39,15 +39,33 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
RANLIB = @RANLIB@
GENCAT = @GENCAT@
-PERL = @PERL@
GMSGFMT = @GMSGFMT@
CC = @CC@
-TESTS = md5-rfc
-EXTRA_DIST = $(TESTS)
+x = md5sum
+explicit =
+maint_gen = t1.in t1.exp t2.in t2.exp t3.in t3.exp t4.in t4.exp t5.in t5.exp \
+t6.in t6.exp t7.in t7.exp
+run_gen = t1.out t1.err t2.out t2.err t3.out t3.err t4.out t4.err t5.out \
+t5.err t6.out t6.err t7.out t7.err
+
+EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen)
+noinst_SCRIPTS = $x-tests
+
+PERL = @PERL@
+editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g'
+
+TESTS = $x-tests
+
+SUFFIXES = .pl
+
+MAINTAINERCLEANFILES = $x-tests $(maint_gen)
+CLEANFILES = $(run_gen)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
+SCRIPTS = $(noinst_SCRIPTS)
+
DIST_COMMON = Makefile.am Makefile.in
@@ -61,6 +79,7 @@ TAR = tar
default: all
.SUFFIXES:
+.SUFFIXES: .pl
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL)
cd $(top_srcdir) && automake --gnu tests/md5sum-test/Makefile
@@ -119,7 +138,7 @@ install: install-exec install-data all
uninstall:
-all: Makefile
+all: $(SCRIPTS) Makefile
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
@@ -157,6 +176,27 @@ mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+$x-tests: @MAINT@mk-script Test.pm
+ ./mk-script ../../src/$x > $@.n
+ mv $@.n $@
+ chmod 755 $@
+
+.pl:
+ rm -f $@ $@.tmp
+ $(editpl) $< > $@.tmp
+ chmod +x-w $@.tmp
+ mv $@.tmp $@
+
+@MAINT@rebuild-check: Test.pm mk-script
+@MAINT@ rb=rb-check; rm -f $rb; \
+@MAINT@ m_template=../Makefile.am.in; \
+@MAINT@ sed -n '1,/^##test-files-begin/p' $$m_template > $$rb; \
+@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \
+@MAINT@ echo "x = $$tool" >> $$rb; \
+@MAINT@ ./mk-script --list >> $$rb; \
+@MAINT@ sed -n '/^##test-files-end/,$$p' $$m_template >> $$rb; \
+@MAINT@ diff -u Makefile.am $$rb && echo ok || echo no
+
# 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/md5sum/md5sum-tests b/tests/md5sum/md5sum-tests
new file mode 100755
index 000000000..840ec3f84
--- /dev/null
+++ b/tests/md5sum/md5sum-tests
@@ -0,0 +1,137 @@
+#! /bin/sh
+# This script was generated automatically by build-script.
+case $# in
+ 0) xx='../../src/md5sum';;
+ *) xx="$1";;
+esac
+test "$VERBOSE" && echo=echo || echo=:
+$echo testing program: $xx
+errors=0
+test "$srcdir" || srcdir=.
+test "$VERBOSE" && $xx --version 2> /dev/null
+$xx < $srcdir/t1.in > t1.out 2> t1.err
+code=$?
+if test $code != 0 ; then
+ $echo Test 1 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp t1.out $srcdir/t1.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed 1; fi ;; # equal files
+ 1) $echo Test 1 failed: files t1.out and $srcdir/t1.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test 1 may have failed. 1>&2;
+ $echo The command "cmp t1.out $srcdir/t1.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s t1.err || rm -f t1.err
+$xx < $srcdir/t2.in > t2.out 2> t2.err
+code=$?
+if test $code != 0 ; then
+ $echo Test 2 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp t2.out $srcdir/t2.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed 2; fi ;; # equal files
+ 1) $echo Test 2 failed: files t2.out and $srcdir/t2.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test 2 may have failed. 1>&2;
+ $echo The command "cmp t2.out $srcdir/t2.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s t2.err || rm -f t2.err
+$xx < $srcdir/t3.in > t3.out 2> t3.err
+code=$?
+if test $code != 0 ; then
+ $echo Test 3 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp t3.out $srcdir/t3.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed 3; fi ;; # equal files
+ 1) $echo Test 3 failed: files t3.out and $srcdir/t3.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test 3 may have failed. 1>&2;
+ $echo The command "cmp t3.out $srcdir/t3.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s t3.err || rm -f t3.err
+$xx < $srcdir/t4.in > t4.out 2> t4.err
+code=$?
+if test $code != 0 ; then
+ $echo Test 4 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp t4.out $srcdir/t4.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed 4; fi ;; # equal files
+ 1) $echo Test 4 failed: files t4.out and $srcdir/t4.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test 4 may have failed. 1>&2;
+ $echo The command "cmp t4.out $srcdir/t4.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s t4.err || rm -f t4.err
+$xx < $srcdir/t5.in > t5.out 2> t5.err
+code=$?
+if test $code != 0 ; then
+ $echo Test 5 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp t5.out $srcdir/t5.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed 5; fi ;; # equal files
+ 1) $echo Test 5 failed: files t5.out and $srcdir/t5.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test 5 may have failed. 1>&2;
+ $echo The command "cmp t5.out $srcdir/t5.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s t5.err || rm -f t5.err
+$xx < $srcdir/t6.in > t6.out 2> t6.err
+code=$?
+if test $code != 0 ; then
+ $echo Test 6 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp t6.out $srcdir/t6.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed 6; fi ;; # equal files
+ 1) $echo Test 6 failed: files t6.out and $srcdir/t6.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test 6 may have failed. 1>&2;
+ $echo The command "cmp t6.out $srcdir/t6.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s t6.err || rm -f t6.err
+$xx < $srcdir/t7.in > t7.out 2> t7.err
+code=$?
+if test $code != 0 ; then
+ $echo Test 7 failed: ../../src/md5sum return code $code differs from expected value 0 1>&2
+ errors=`expr $errors + 1`
+else
+ cmp t7.out $srcdir/t7.exp
+ case $? in
+ 0) if test "$VERBOSE" ; then $echo passed 7; fi ;; # equal files
+ 1) $echo Test 7 failed: files t7.out and $srcdir/t7.exp differ 1>&2;
+ errors=`expr $errors + 1` ;;
+ 2) $echo Test 7 may have failed. 1>&2;
+ $echo The command "cmp t7.out $srcdir/t7.exp" failed. 1>&2 ;
+ errors=`expr $errors + 1` ;;
+ esac
+fi
+test -s t7.err || rm -f t7.err
+if test $errors = 0 ; then
+ $echo Passed all tests. 1>&2
+else
+ $echo Failed $errors tests. 1>&2
+fi
+test $errors = 0 || errors=1
+exit $errors