]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
.
authorJim Meyering <jim@meyering.net>
Tue, 21 Jan 1997 04:21:48 +0000 (04:21 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 21 Jan 1997 04:21:48 +0000 (04:21 +0000)
tests/date/Makefile.am [new file with mode: 0644]
tests/date/Makefile.in [new file with mode: 0644]
tests/date/Test.pm [new file with mode: 0644]
tests/date/date-tests [new file with mode: 0755]

diff --git a/tests/date/Makefile.am b/tests/date/Makefile.am
new file mode 100644 (file)
index 0000000..21f1c0f
--- /dev/null
@@ -0,0 +1,41 @@
+## Process this file with automake to produce Makefile.in.
+
+##test-files-begin
+x = date
+explicit =
+maint_gen =
+##test-files-end
+
+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
+
+$x-tests: @MAINT@mk-script Test.pm
+       ./mk-script ../../src/$x > $@.n
+       mv $@.n $@
+       chmod 755 $@
+
+SUFFIXES = .pl
+
+.pl:
+       rm -f $@ $@.tmp
+       $(editpl) $< > $@.tmp
+       chmod +x-w $@.tmp
+       mv $@.tmp $@
+
+MAINTAINERCLEANFILES = $x-tests $(maint_gen)
+CLEANFILES = $(run_gen)
+
+@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
diff --git a/tests/date/Makefile.in b/tests/date/Makefile.in
new file mode 100644 (file)
index 0000000..ced74eb
--- /dev/null
@@ -0,0 +1,200 @@
+# Makefile.in generated automatically by automake 1.1l from Makefile.am
+
+# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+
+SHELL = /bin/sh
+
+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 = ../..
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+YACC = @YACC@
+RANLIB = @RANLIB@
+GENCAT = @GENCAT@
+GMSGFMT = @GMSGFMT@
+CC = @CC@
+
+x = date
+explicit =
+maint_gen =
+
+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
+
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \
+       $(TEXINFOS) $(MANS) $(EXTRA_DIST)
+
+TAR = tar
+default: all
+
+.SUFFIXES:
+.SUFFIXES: .pl
+$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL) 
+       cd $(top_srcdir) && automake --gnu tests/date/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+       cd $(top_builddir) \
+         && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = tests/date
+distdir: $(DISTFILES)
+       @for file in $(DISTFILES); do \
+         d=$(srcdir); \
+         test -f $(distdir)/$$file \
+         || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+         || cp -p $$d/$$file $(distdir)/$$file; \
+       done
+check-TESTS: $(TESTS)
+       @failed=0; all=0; \
+       srcdir=$(srcdir); export srcdir; \
+       for tst in $(TESTS); do \
+         all=`expr $$all + 1`; \
+         if test -f $$tst; then dir=.; \
+         else dir="$(srcdir)"; fi; \
+         if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
+           echo "PASS: $$tst"; \
+         else \
+           failed=`expr $$failed + 1`; \
+           echo "FAIL: $$tst"; \
+         fi; \
+       done; \
+       if test "$$failed" -eq 0; then \
+         echo "========================"; \
+         echo "All $$all tests passed"; \
+         echo "========================"; \
+       else \
+         echo "$$failed of $$all tests failed"; \
+       fi
+info:
+dvi:
+check: all
+       $(MAKE) check-TESTS
+installcheck:
+install-exec: 
+       $(NORMAL_INSTALL)
+
+install-data: 
+       $(NORMAL_INSTALL)
+
+install: install-exec install-data all
+       @:
+
+uninstall: 
+
+all: $(SCRIPTS) Makefile
+
+install-strip:
+       $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
+installdirs:
+
+
+mostlyclean-generic:
+       test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+       test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       rm -f Makefile $(DISTCLEANFILES)
+       rm -f config.cache config.log stamp-h
+       test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+       test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean:  mostlyclean-generic
+
+clean:  clean-generic mostlyclean
+
+distclean:  distclean-generic clean
+       rm -f config.status
+
+maintainer-clean:  maintainer-clean-generic distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+
+.PHONY: default tags distdir check-TESTS info dvi installcheck \
+install-exec install-data install uninstall all installdirs \
+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/date/Test.pm b/tests/date/Test.pm
new file mode 100644 (file)
index 0000000..43dfdfe
--- /dev/null
@@ -0,0 +1,46 @@
+# -*-perl-*-
+package Test;
+require 5.002;
+use strict;
+
+$Test::env{1} = {
+  LANG => 'C',
+  TZ => 'UTC',
+};
+
+sub test_vector
+{
+
+  my $d1 = '1997-01-19 08:17:48 +0';
+  my @tvec =
+    (
+     # test-name options input expected-output expected-return-code
+     #
+     ['1', "-d '$d1' +'%% %a %A %b %B'", {}, '% Sun Sunday Jan January', 0],
+     ['2', "-d '$d1' +'%c'", {}, 'Sun Jan 19 08:17:48 1997', 0],
+     ['3', "-d '$d1' +'%d_%D_%e_%h_%H'", {}, '19_01/19/97_19_Jan_08', 0],
+     ['4', "-d '$d1' +'%I_%j_%k_%l_%m'", {}, '08_019_ 8_ 8_01', 0],
+     ['5', "-d '$d1' +'%M_%n_%p_%r'", {}, "17_\n_AM_08:17:48 AM", 0],
+     ['6', "-d '$d1' +'%s_%S_%t_%T'", {}, "853661868_48_\t_08:17:48", 0],
+     ['7', "-d '$d1' +'%U_%V_%w_%W'", {}, '03_03_0_02', 0],
+     ['8', "-d '$d1' +'%x_%X_%y_%Y'", {}, '01/19/97_08:17:48_97_1997', 0],
+     ['9', "-d '$d1' +'%z_%Z'", {}, '+0000_GMT', 0],
+     );
+
+  # For each test...
+  # Export LANG=C so that the locale-dependent strings match.
+  # Export TZ=GMT so that zone-dependent strings match.
+  my @tv;
+  my $t;
+  foreach $t (@tvec)
+    {
+      my ($test_name, $flags, $in, $exp, $ret) = @$t;
+      $Test::env{$test_name} = 'LANG=C TZ=UTC';
+      # Append a newline to end of each expected string.
+      push (@tv, [$test_name, $flags, $in, "$exp\n", $ret]);
+    }
+
+  return @tv;
+}
+
+1;
diff --git a/tests/date/date-tests b/tests/date/date-tests
new file mode 100755 (executable)
index 0000000..0d0f853
--- /dev/null
@@ -0,0 +1,171 @@
+#! /bin/sh
+# This script was generated automatically by build-script.
+case $# in
+  0) xx='../../src/date';;
+  *) xx="$1";;
+esac
+test "$VERBOSE" && echo=echo || echo=:
+$echo testing program: $xx
+errors=0
+test "$srcdir" || srcdir=.
+test "$VERBOSE" && $xx --version 2> /dev/null
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%% %a %A %b %B'  > t1.out 2> t1.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 1 failed: ../../src/date 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
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%c'  > t2.out 2> t2.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 2 failed: ../../src/date 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
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%d_%D_%e_%h_%H'  > t3.out 2> t3.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 3 failed: ../../src/date 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
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%I_%j_%k_%l_%m'  > t4.out 2> t4.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 4 failed: ../../src/date 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
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%M_%n_%p_%r'  > t5.out 2> t5.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 5 failed: ../../src/date 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
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%s_%S_%t_%T'  > t6.out 2> t6.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 6 failed: ../../src/date 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
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%U_%V_%w_%W'  > t7.out 2> t7.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 7 failed: ../../src/date 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
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%x_%X_%y_%Y'  > t8.out 2> t8.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 8 failed: ../../src/date return code $code differs from expected value 0 1>&2
+  errors=`expr $errors + 1`
+else
+  cmp t8.out $srcdir/t8.exp
+  case $? in
+    0) if test "$VERBOSE" ; then $echo passed 8; fi ;; # equal files
+    1) $echo Test 8 failed: files t8.out and $srcdir/t8.exp differ 1>&2;
+       errors=`expr $errors + 1` ;;
+    2) $echo Test 8 may have failed. 1>&2;
+       $echo The command "cmp t8.out $srcdir/t8.exp" failed. 1>&2 ;
+       errors=`expr $errors + 1` ;;
+  esac
+fi
+test -s t8.err || rm -f t8.err
+LANG=C TZ=UTC $xx -d '1997-01-19 08:17:48 +0' +'%z_%Z'  > t9.out 2> t9.err
+code=$?
+if test $code != 0 ; then
+  $echo Test 9 failed: ../../src/date return code $code differs from expected value 0 1>&2
+  errors=`expr $errors + 1`
+else
+  cmp t9.out $srcdir/t9.exp
+  case $? in
+    0) if test "$VERBOSE" ; then $echo passed 9; fi ;; # equal files
+    1) $echo Test 9 failed: files t9.out and $srcdir/t9.exp differ 1>&2;
+       errors=`expr $errors + 1` ;;
+    2) $echo Test 9 may have failed. 1>&2;
+       $echo The command "cmp t9.out $srcdir/t9.exp" failed. 1>&2 ;
+       errors=`expr $errors + 1` ;;
+  esac
+fi
+test -s t9.err || rm -f t9.err
+if test $errors = 0 ; then
+  $echo Passed all 9 tests. 1>&2
+else
+  $echo Failed $errors tests. 1>&2
+fi
+test $errors = 0 || errors=1
+exit $errors