summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am32
-rw-r--r--tests/Makefile.in441
-rwxr-xr-xtests/shar-158
-rw-r--r--tests/shar-1.ok124
-rwxr-xr-xtests/shar-245
-rwxr-xr-xtests/shar-348
-rw-r--r--tests/testdata9
-rwxr-xr-xtests/uude-139
-rwxr-xr-xtests/uutest-127
9 files changed, 823 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..b2a5143
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,32 @@
+## Makefile for the checks subdirectory of the GNU Shar utilities.
+##
+## Copyright (C) 1995, 1996, 2005, 2006, 2007 Free Software Foundation, Inc.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3, or (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
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+## Process this file with automake to produce Makefile.in.
+
+TESTS = uutest-1 uude-1 shar-1 shar-2 shar-3
+TESTS_ENVIRONMENT = \
+ top_srcdir=$(top_srcdir) \
+ PATH=`cd ../src && pwd`:"$$PATH" \
+ PACKAGE_STRING='$(PACKAGE_STRING)' top_builddir=$(top_builddir)
+
+EXTRA_DIST = $(TESTS) testdata shar-1.ok
+
+clean : local-clean
+
+local-clean :
+ rm -rf shar-1-* shar-1.in shar-2*.* $${TMPDIR=/tmp}/shar-3*.d
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..b4772f8
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,441 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 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.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
+ $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
+ $(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
+ $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \
+ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
+ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \
+ $(top_srcdir)/m4/sharutils.m4 $(top_srcdir)/m4/signed.m4 \
+ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
+ $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
+ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
+ $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrtoimax.m4 \
+ $(top_srcdir)/version.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADD_SCRIPT = @ADD_SCRIPT@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPRESS = @COMPRESS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIFF = @DIFF@
+DIRENT_HEADER = @DIRENT_HEADER@
+DIST_ALPHA = @DIST_ALPHA@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GENCAT = @GENCAT@
+GLIBC2 = @GLIBC2@
+GLIBC21 = @GLIBC21@
+GMSGFMT = @GMSGFMT@
+GREP = @GREP@
+HAVE_ASPRINTF = @HAVE_ASPRINTF@
+HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@
+HAVE_SNPRINTF = @HAVE_SNPRINTF@
+HAVE_WPRINTF = @HAVE_WPRINTF@
+INSTALL = @INSTALL@
+INSTALL_COMPRESS_LINK = @INSTALL_COMPRESS_LINK@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLBISON = @INTLBISON@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAILER = @MAILER@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SH = @SH@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TAR = @TAR@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+TESTS = uutest-1 uude-1 shar-1 shar-2 shar-3
+TESTS_ENVIRONMENT = \
+ top_srcdir=$(top_srcdir) \
+ PATH=`cd ../src && pwd`:"$$PATH" \
+ PACKAGE_STRING='$(PACKAGE_STRING)' top_builddir=$(top_builddir)
+
+EXTRA_DIST = $(TESTS) testdata shar-1.ok
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnits tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ 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 \
+ *$$ws$$tst$$ws*) \
+ 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 \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ 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="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ distclean distclean-generic distdir dvi dvi-am html html-am \
+ info info-am install install-am install-data install-data-am \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+ uninstall-am
+
+
+clean : local-clean
+
+local-clean :
+ rm -rf shar-1-* shar-1.in shar-2*.* $${TMPDIR=/tmp}/shar-3*.d
+# 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/shar-1 b/tests/shar-1
new file mode 100755
index 0000000..6f48879
--- /dev/null
+++ b/tests/shar-1
@@ -0,0 +1,58 @@
+#! /bin/sh
+
+current_dir=`pwd`
+
+tmpfile=shar-1-$$
+inf=shar-1.in
+sharf=${tmpfile}.shar
+outf=${tmpfile}.outf
+
+# Test whether -f/--basename option removes all references to the old
+# file name.
+
+trap "rm -fr shar-1.in ${tmpfile}.*" 1 2 3 15
+
+echo "This is a test" > ${inf}
+chmod 0644 ${inf} 2> /dev/null >&2
+SHAR=../src/shar
+
+${SHAR} -f $current_dir/${inf} > ${sharf} 2> /dev/null || exit 1
+
+sed -e "s/__PACKAGE_STRING__/${PACKAGE_STRING}/" \
+ $top_srcdir/tests/shar-1.ok > ${tmpfile}.sample
+
+# Remove variations based on PID and the current date
+#
+sed -e 's/^# Made on.*/# Made on .../' \
+ -e 's/^# Source directory was.*/# Source directory was .../' \
+ -e 's/=_sh[0-9][0-9]*/=_sh<PID>/' \
+ -e 's/(set .. .. .. .. .. .. ../(set <date>/' \
+${sharf} > ${outf} 2> /dev/null
+
+: ${DIFF=diff}
+${DIFF} -c ${tmpfile}.sample ${outf} || exit 1
+
+# test basic functioning of unshar
+#
+: ${UNSHAR=../src/unshar}
+mv -f ${inf} ${outf}
+
+res=`${UNSHAR} ${sharf} 2>&1` || {
+ echo "${res}" >&2
+ exit 1
+}
+
+${DIFF} ${inf} ${outf} || exit 1
+
+rm -f shar-1.in ${tmpfile}.*
+exit 0
+
+## Local Variables:
+## mode: shell-script
+## tab-width: 8
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+## end of shar-1
diff --git a/tests/shar-1.ok b/tests/shar-1.ok
new file mode 100644
index 0000000..1ef6510
--- /dev/null
+++ b/tests/shar-1.ok
@@ -0,0 +1,124 @@
+#!/bin/sh
+# This is a shell archive (produced by GNU __PACKAGE_STRING__).
+# To extract the files from this archive, save it to some FILE, remove
+# everything before the `#!/bin/sh' line above, then type `sh FILE'.
+#
+lock_dir=_sh<PID>
+# Made on ...
+# Source directory was ...
+#
+# Existing files will *not* be overwritten, unless `-c' is specified.
+#
+# This shar contains:
+# length mode name
+# ------ ---------- ------------------------------------------
+# 15 -rw-r--r-- shar-1.in
+#
+MD5SUM=${MD5SUM-md5sum}
+f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'`
+test -n "${f}" && md5check=true || md5check=false
+${md5check} || \
+ echo 'Note: not verifying md5sums. Consider installing GNU coreutils.'
+save_IFS="${IFS}"
+IFS="${IFS}:"
+gettext_dir=FAILED
+locale_dir=FAILED
+first_param="$1"
+for dir in $PATH
+do
+ if test "$gettext_dir" = FAILED && test -f $dir/gettext \
+ && ($dir/gettext --version >/dev/null 2>&1)
+ then
+ case `$dir/gettext --version 2>&1 | sed 1q` in
+ *GNU*) gettext_dir=$dir ;;
+ esac
+ fi
+ if test "$locale_dir" = FAILED && test -f $dir/shar \
+ && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
+ then
+ locale_dir=`$dir/shar --print-text-domain-dir`
+ fi
+done
+IFS="$save_IFS"
+if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
+then
+ echo=echo
+else
+ TEXTDOMAINDIR=$locale_dir
+ export TEXTDOMAINDIR
+ TEXTDOMAIN=sharutils
+ export TEXTDOMAIN
+ echo="$gettext_dir/gettext -s"
+fi
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null
+then if (echo -n test; echo 1,2,3) | grep n >/dev/null
+ then shar_n= shar_c='
+'
+ else shar_n=-n shar_c= ; fi
+else shar_n= shar_c='\c' ; fi
+f=shar-touch.$$
+st1=200112312359.59
+st2=123123592001.59
+st2tr=123123592001.5 # old SysV 14-char limit
+st3=1231235901
+
+if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \
+ test ! -f ${st1} && test -f ${f}; then
+ shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
+
+elif touch -am ${st2} ${f} >/dev/null 2>&1 && \
+ test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then
+ shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
+
+elif touch -am ${st3} ${f} >/dev/null 2>&1 && \
+ test ! -f ${st3} && test -f ${f}; then
+ shar_touch='touch -am $3$4$5$6$2 "$8"'
+
+else
+ shar_touch=:
+ echo
+ ${echo} 'WARNING: not restoring timestamps. Consider getting and'
+ ${echo} 'installing GNU `touch'\'', distributed in GNU coreutils...'
+ echo
+fi
+rm -f ${st1} ${st2} ${st2tr} ${st3} ${f}
+#
+if test ! -d ${lock_dir}
+then : ; else ${echo} 'lock directory '${lock_dir}' exists'
+ exit 1
+fi
+if mkdir ${lock_dir}
+then ${echo} 'x - created lock directory `'${lock_dir}\''.'
+else ${echo} 'x - failed to create lock directory `'${lock_dir}\''.'
+ exit 1
+fi
+# ============= shar-1.in ==============
+if test -f 'shar-1.in' && test "$first_param" != -c; then
+ ${echo} 'x -SKIPPING shar-1.in (file already exists)'
+else
+${echo} 'x - extracting shar-1.in (text)'
+ sed 's/^X//' << 'SHAR_EOF' > 'shar-1.in' &&
+This is a test
+SHAR_EOF
+ (set <date> 'shar-1.in'; eval "$shar_touch") &&
+ chmod 0644 'shar-1.in'
+if test $? -ne 0
+then ${echo} 'restore of shar-1.in failed'
+fi
+ if ${md5check}
+ then (
+ ${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'shar-1.in: MD5 check failed'
+ ) << \SHAR_EOF
+ff22941336956098ae9a564289d1bf1b shar-1.in
+SHAR_EOF
+ else
+test `LC_ALL=C wc -c < 'shar-1.in'` -ne 15 && \
+ ${echo} 'restoration warning: size of shar-1.in is not 15'
+ fi
+fi
+if rm -fr ${lock_dir}
+then ${echo} 'x - removed lock directory `'${lock_dir}\''.'
+else ${echo} 'x - failed to remove lock directory `'${lock_dir}\''.'
+ exit 1
+fi
+exit 0
diff --git a/tests/shar-2 b/tests/shar-2
new file mode 100755
index 0000000..526add1
--- /dev/null
+++ b/tests/shar-2
@@ -0,0 +1,45 @@
+#! /bin/sh
+
+tmppfx=shar-2-$$
+
+mkdir ${tmppfx}.dir ${tmppfx}.d ${tmppfx}.d/one ${tmppfx}.d/two
+for d in "" /one /two
+do
+ dir=${tmppfx}.d${d}
+ echo This file is shar-2${d}/first > ${dir}/first
+ exec 3> ${dir}/second
+ echo This file is shar-2${d}/second >&3
+ f=0
+ while test $f -lt 32
+ do g=\\`printf %0d $f`
+ printf "$g"
+ f=`expr $f + 1`
+ done >&3
+ echo >&3
+ echo This file is shar-2${d}/second >&3
+ exec 3>&-
+done
+
+: ${SHAR=`cd ../src ; pwd`/shar}
+: ${UNSHAR=`cd ../src ; pwd`/unshar}
+(cd ${tmppfx}.d ; ${SHAR} -m . 2>/dev/null) > ${tmppfx}.shar
+
+: ${DIFF=diff}
+
+( cd ${tmppfx}.dir
+ ${UNSHAR} ../${tmppfx}.shar )
+
+${DIFF} -r ${tmppfx}.d ${tmppfx}.dir || exit 1
+
+rm -rf ${tmppfx}.*
+exit 0
+
+## Local Variables:
+## mode: shell-script
+## tab-width: 8
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+## end of shar-2
diff --git a/tests/shar-3 b/tests/shar-3
new file mode 100755
index 0000000..1f0a159
--- /dev/null
+++ b/tests/shar-3
@@ -0,0 +1,48 @@
+#! /bin/sh
+
+current_dir=`pwd`
+TMPDIR=${TMPDIR=/tmp}
+export TMPDIR
+testname=shar-3
+testdir=${TMPDIR}/${testname}-$$.d
+rm -rf ${testdir}
+(umask 077 ; mkdir ${testdir}) || exit 1
+opts="-S -o ${testdir}/${testname}-%04d.shar"
+opts="${opts} -L32 -n ${testname}-test -s ${testname} -z"
+
+shar=`cd ../src ; pwd`/shar
+unshar=`cd ../src ; pwd`/unshar
+top_builddir=`cd ${top_builddir} ; pwd`
+
+cd ${top_builddir}
+find . -type f | \
+ sed 's,^./,,' | \
+ ${shar} -q ${opts}
+
+cd ${testdir}
+mkdir ${testname}.d
+opts=-d${testname}.d
+
+for f in ${testname}-*.shar
+do
+ ${unshar} ${opts} ${f}
+done >/dev/null
+
+if diff -r ${top_builddir} ${testname}.d
+then :
+else echo ${top_builddir} and ${testname}.d differ ; exit 1
+fi
+
+cd ${current_dir}
+rm -rf ${testdir}
+exit 0
+
+## Local Variables:
+## mode: shell-script
+## tab-width: 8
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+## end of shar-3
diff --git a/tests/testdata b/tests/testdata
new file mode 100644
index 0000000..2db6ca7
--- /dev/null
+++ b/tests/testdata
@@ -0,0 +1,9 @@
+begin 664 test.bin
+M``$"`P0%!@<("0H+#`T.#Q`1$A,4%187&!D:&QP='A\@(2(C)"4F)R@I*BLL
+M+2XO,#$R,S0U-C<X.3H[/#T^/T!!0D-$149'2$E*2TQ-3D]045)35%565UA9
+M6EM<75Y?8&%B8V1E9F=H:6IK;&UN;W!Q<G-T=79W>'EZ>WQ]?G^`@8*#A(6&
+MAXB)BHN,C8Z/D)&2DY25EI>8F9J;G)V>GZ"AHJ.DI::GJ*FJJZRMKJ^PL;*S
+MM+6VM[BYNKN\O;Z_P,'"P\3%QL?(R<K+S,W.S]#1TM/4U=;7V-G:V]S=WM_@
+?X>+CY.7FY^CIZNOL[>[O\/'R\_3U]O?X^?K[_/W^_P``
+`
+end
diff --git a/tests/uude-1 b/tests/uude-1
new file mode 100755
index 0000000..2aa5f32
--- /dev/null
+++ b/tests/uude-1
@@ -0,0 +1,39 @@
+#! /bin/sh
+# uudecode output file handling; cf. ../src/ChangeLog 2002-07-06
+
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tno=1
+
+tmpfiles="test.bin uudata${tno} uude-test${tno}.err"
+rm -fr $tmpfiles
+
+echo "Was schlimm ist" > uudata${tno}
+: ${LN=ln}
+${LN} -sf uudata${tno} test.bin
+
+: ${UUDECODE=uudecode}
+# : ${top_srcdir=..}
+LC_MESSAGES=C LC_ALL= \
+${UUDECODE} ${top_srcdir}/tests/testdata 2>&1 \
+ | sed 's/.*\(not following symlink (test.bin)\).*/\1/' > uude-test${tno}.err
+
+rm -f test.bin
+mkfifo test.bin
+LC_MESSAGES=C LC_ALL= \
+${UUDECODE} ${top_srcdir}/tests/testdata 2>&1 \
+ | sed 's/.*\(denied writing FIFO (test.bin)\).*/\1/' >>uude-test${tno}.err
+
+tmpfiles="$tmpfiles uude-test${tno}.ok"
+cat << EOF > uude-test${tno}.ok
+not following symlink (test.bin)
+denied writing FIFO (test.bin)
+EOF
+
+: ${DIFF=diff}
+${DIFF} uude-test${tno}.ok uude-test${tno}.err
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
diff --git a/tests/uutest-1 b/tests/uutest-1
new file mode 100755
index 0000000..59cc216
--- /dev/null
+++ b/tests/uutest-1
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="test.bin test.out"
+# Make sure no files are left over.
+rm -fr $tmpfiles
+
+: ${UUDECODE=uudecode}
+${UUDECODE} $top_srcdir/tests/testdata
+result=$?
+
+if test $result -eq 0; then
+ : ${UUENCODE=uuencode}
+ ${UUENCODE} test.bin test.bin > test.out
+ result=$?
+
+ if test $result -eq 0; then
+ : ${DIFF=diff}
+ ${DIFF} $top_srcdir/tests/testdata test.out > /dev/null
+ result=$?
+ fi
+fi
+
+rm -fr $tmpfiles
+
+exit $result