tests: run most tests via tests/Makefile.am
authorJim Meyering <meyering@redhat.com>
Tue, 6 Apr 2010 08:56:16 +0000 (10:56 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 6 Apr 2010 16:28:57 +0000 (18:28 +0200)
* Makefile.am (SUBDIRS): List tests after ".".
Move most test-related things from here to ...
* tests/Makefile.am: ... here.
* configure.ac (AC_CONFIG_FILES): Add tests/Makefile.
* tests/helin-segv: Adjust.
* tests/help-version: Likewise.
* tests/hufts: Likewise.
* tests/memcpy-abuse: Likewise.
* tests/mixed: Likewise.
* tests/null-suffix-clobber: Likewise.
* tests/stdin: Likewise.
* tests/trailing-nul: Likewise.
* tests/zdiff: Likewise.
* tests/zgrep-f: Likewise.
* tests/zgrep-signal: Likewise.
* tests/znew-k: Likewise.

15 files changed:
Makefile.am
configure.ac
tests/Makefile.am [new file with mode: 0644]
tests/helin-segv
tests/help-version
tests/hufts
tests/memcpy-abuse
tests/mixed
tests/null-suffix-clobber
tests/stdin
tests/trailing-nul
tests/zdiff
tests/zgrep-f
tests/zgrep-signal
tests/znew-k

index d331e03050c25871e5f825750e3a81488f438f53..129c45321c8ced9616598a80e9d73447699c62d6 100644 (file)
@@ -19,7 +19,7 @@
 
 ALL_RECURSIVE_TARGETS =
 
-SUBDIRS = lib doc
+SUBDIRS = lib doc . tests
 ACLOCAL_AMFLAGS = -I m4
 AM_CPPFLAGS = -I$(top_srcdir)/lib
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -33,7 +33,6 @@ man_MANS = gunzip.1 gzexe.1 gzip.1 \
 EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
   ChangeLog-2007 \
   dist-check.mk        \
-  tests/hufts-segv.gz \
   algorithm.doc amiga/match.a amiga/Makefile.gcc amiga/Makefile.sasc \
   amiga/tailor.c amiga/utime.h atari/Makefile.st crypt.h \
   gunzip.in gzexe.in gzip.doc gzip.h lzw.h msdos/match.asm msdos/tailor.c \
@@ -46,8 +45,7 @@ EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
   sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
   tailor.h vms/Makefile.mms vms/gzip.hlp vms/vms.c vms/Readme.vms \
   vms/Makefile.vms vms/Makefile.gcc vms/makegzip.com zcat.in zcmp.in zdiff.in \
-  zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in \
-  tests/init.sh
+  zegrep.in zfgrep.in zforce.in zgrep.in zless.in zmore.in znew.in
 
 bin_PROGRAMS = gzip
 bin_SCRIPTS = gunzip gzexe zcat zcmp zdiff \
@@ -105,23 +103,6 @@ check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz
        done
        @echo 'Test succeeded.'
 
-TESTS =                                                \
-  tests/helin-segv                             \
-  tests/help-version                           \
-  tests/hufts                                  \
-  tests/memcpy-abuse                           \
-  tests/mixed                                  \
-  tests/null-suffix-clobber                    \
-  tests/stdin                                  \
-  tests/trailing-nul                           \
-  tests/zdiff                                  \
-  tests/zgrep-f                                        \
-  tests/zgrep-signal                           \
-  tests/znew-k
-
-EXTRA_DIST += $(TESTS)
-EXTRA_DIST += tests/init.cfg
-
 install-exec-hook: remove-installed-links
 install-exec-hook remove-installed-links:
        @for prog_ext in $(bin_PROGRAMS) $(bin_SCRIPTS); do \
@@ -158,45 +139,3 @@ MAINTAINERCLEANFILES = gzip.doc
 
 MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
   gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew
-
-# Note that the first lines are statements.  They ensure that environment
-# variables that can perturb tests are unset or set to expected values.
-# The rest are envvar settings that propagate build-related Makefile
-# variables to test scripts.
-TESTS_ENVIRONMENT =                            \
-  tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.;        \
-  TMPDIR=$$tmp__; export TMPDIR;               \
-  exec 9>&2;                                   \
-  shell_or_perl_() {                           \
-    if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                        \
-      if $(PERL) -e 'use warnings' > /dev/null 2>&1; then              \
-       grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
-        $(PERL) -w$$T_ -I$(srcdir) -MCoreutils                         \
-             -M"CuTmpdir qw($$f)" -- "$$1";    \
-      else                                     \
-       echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
-         "so skipping this test";              \
-       (exit 77);                              \
-      fi;                                      \
-    else                                       \
-      $(SHELL) "$$1";                          \
-    fi;                                                \
-  };                                           \
-  export                                       \
-  abs_top_builddir='$(abs_top_builddir)'       \
-  abs_top_srcdir='$(abs_top_srcdir)'           \
-  abs_srcdir='$(abs_srcdir)'                   \
-  built_programs='$(PROGRAMS) $(SCRIPTS)'      \
-  srcdir='$(srcdir)'                           \
-  top_srcdir='$(top_srcdir)'                   \
-  CC='$(CC)'                                   \
-  MAKE=$(MAKE)                                 \
-  PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'     \
-  PACKAGE_VERSION=$(PACKAGE_VERSION)           \
-  PERL='$(PERL)'                               \
-  PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
-  REPLACE_GETCWD=$(REPLACE_GETCWD)             \
-  PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'"$$PATH" \
-  ; shell_or_perl_
-
-VERBOSE = yes
index 9e3d7c9df77ba340d1ebccad079d381446fbbf39..871b1caa9dbb2cc6a65784e1b661cbefd5777557 100644 (file)
@@ -195,5 +195,5 @@ AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
 AC_TYPE_OFF_T
 
-AC_CONFIG_FILES([Makefile doc/Makefile lib/Makefile])
+AC_CONFIG_FILES([Makefile doc/Makefile lib/Makefile tests/Makefile])
 AC_OUTPUT
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644 (file)
index 0000000..59ea2f2
--- /dev/null
@@ -0,0 +1,89 @@
+## Process this file with automake to create Makefile.in
+# Copyright 2010 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, see <http://www.gnu.org/licenses/>.
+
+TESTS =                                        \
+  helin-segv                           \
+  help-version                         \
+  hufts                                        \
+  memcpy-abuse                         \
+  mixed                                        \
+  null-suffix-clobber                  \
+  stdin                                        \
+  trailing-nul                         \
+  zdiff                                        \
+  zgrep-f                              \
+  zgrep-signal                         \
+  znew-k
+
+EXTRA_DIST =                           \
+  $(TESTS)                             \
+  init.cfg                             \
+  init.sh                              \
+  hufts-segv.gz
+
+built_programs = \
+  gzip         \
+  gunzip       \
+  gzexe                \
+  zcat         \
+  zcmp         \
+  zdiff                \
+  zegrep       \
+  zfgrep       \
+  zforce       \
+  zgrep                \
+  zless                \
+  zmore                \
+  znew
+
+TESTS_ENVIRONMENT =                            \
+  tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.;        \
+  TMPDIR=$$tmp__; export TMPDIR;               \
+  exec 9>&2;                                   \
+  shell_or_perl_() {                           \
+    if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                        \
+      if $(PERL) -e 'use warnings' > /dev/null 2>&1; then              \
+       grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
+        $(PERL) -w$$T_ -I$(srcdir) -MCoreutils                         \
+             -M"CuTmpdir qw($$f)" -- "$$1";    \
+      else                                     \
+       echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
+         "so skipping this test";              \
+       (exit 77);                              \
+      fi;                                      \
+    else                                       \
+      $(SHELL) "$$1";                          \
+    fi;                                                \
+  };                                           \
+  export                                       \
+  LC_ALL=C                                     \
+  abs_top_builddir='$(abs_top_builddir)'       \
+  abs_top_srcdir='$(abs_top_srcdir)'           \
+  abs_srcdir='$(abs_srcdir)'                   \
+  built_programs='$(built_programs)'           \
+  srcdir='$(srcdir)'                           \
+  top_srcdir='$(top_srcdir)'                   \
+  CC='$(CC)'                                   \
+  GZIP_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
+  MAKE=$(MAKE)                                 \
+  PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'     \
+  PACKAGE_VERSION=$(PACKAGE_VERSION)           \
+  PERL='$(PERL)'                               \
+  SHELL='$(SHELL)'                             \
+  PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'"$$PATH" \
+  ; shell_or_perl_
+
+VERBOSE = yes
index 4e448a51091c44e3ee7bbdbd9a8b72421d11fab3..fa54fa01af65ba104c60a90925730dceb4bde194 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  gzip --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 # This test case was provided by Aki Helin.
 printf '\037\235\220\0\0\0\304' > helin.gz || framework_failure
index ebdc69af32a39e73406998f27b58e9a0b6eb9440..79f4b5757837436f2757dc690fe8d578c32464f1 100755 (executable)
@@ -26,7 +26,7 @@ test "x$SHELL" = x && SHELL=/bin/sh
 export SHELL
 
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 expected_failure_status_chroot=125
 expected_failure_status_env=125
index 73e74de6f77956fc8b021229acb20944b3fd1203..5a70a2a28086a180651047487b5ff9bc26f13f41 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  zgrep --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 printf '\n...: invalid compressed data--format violated\n' > exp \
   || framework_failure
 
 fail=0
-gzip -dc "$abs_srcdir/tests/hufts-segv.gz" > out 2> err
+gzip -dc "$abs_srcdir/hufts-segv.gz" > out 2> err
 test $? = 1 || fail=1
 
 compare /dev/null out || fail=1
index 95bc8ca4b80653cfe092494433496c09018fc586..912c3bb5c5e847531217ae3ffb1ac4521ef04676 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  gzip --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 # The input must be larger than 32KiB and slightly
 # less uniform than e.g., all zeros.
index 65898a1482d65ec40ff95bab5b22c53cf20b8e9f..7595ca3826bba05d964459a811b68b62c2b31b73 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  zgrep --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 printf 'xxx\nyyy\n'      > exp2 || framework_failure
 printf 'aaa\nbbb\nccc\n' > exp3 || framework_failure
index e5b52a1a147bb11cd97a6204275555d0e3ccec5a..da4fc0f5c78bd20d00233e4a3cbdb7a643ffafa7 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  gzip --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 printf anything | gzip > F.gz || framework_failure
 echo y > yes || framework_failure
index 8dcfa681a1c6b7b9f9876bb933055f525d61ac0f..ee52a33e0a5c77d78c721b16481cb3fa9e1cbb0e 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  zgrep --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 printf a | gzip > in || framework_failure
 printf aaa > exp || framework_failure
index 8106c290a77d78b26a7936cdf0e86fa6f5fff5bd..8a5ab0744ec2d10cff9fb66f69de65847c5e376a 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  gzip --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 (echo 0 | gzip; printf '\0') > 0.gz || framework_failure
 (echo 00 | gzip; printf '\0\0') > 00.gz || framework_failure
index 151d00dcf254ead1017774f4566b3a99cf3f91db..5a8b15a987bd1c222e36fad562a493b9f51ed822 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  zdiff --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 echo a > a || framework_failure
 echo b > b || framework_failure
index f64b03ee97e537a6154d3d2466d9c26057776968..87b9577d1b18316c5b94c2dcc7ccae58a1d6cadb 100644 (file)
@@ -19,7 +19,7 @@
 # limit so don't run it by default.
 
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"; path_prepend_ .
+. "$srcdir/init.sh"; path_prepend_ ..
 
 require_POSIX_grep_
 
index 4acd7372f451c05d24dcb51e06c674b9dc3286aa..2454423b256716220413a00524f6b19c6d3e518a 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  gzip --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 echo a | gzip -c > f.gz || framework_failure
 
index d63ec26344f89503269accfb496cbbc320dd5712..d49b971b3afa5a2ca5fed85afeb3321fd4a40c28 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # limit so don't run it by default.
 
-if test "$VERBOSE" = yes; then
-  set -x
-  gzip --version
-fi
-
 : ${srcdir=.}
-. "$srcdir/tests/init.sh"; path_prepend_ "`pwd`"
+. "$srcdir/init.sh"; path_prepend_ ..
 
 cat <<'EOF' >compress || framework_failure
 #!/bin/sh