From: Jim Meyering Date: Tue, 6 Apr 2010 08:56:16 +0000 (+0200) Subject: tests: run most tests via tests/Makefile.am X-Git-Tag: v1.5~85 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=6f8485944fd83d4211fad3417151c956661ec410;p=debian%2Fgzip tests: run most tests via tests/Makefile.am * 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. --- diff --git a/Makefile.am b/Makefile.am index d331e03..129c453 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index 9e3d7c9..871b1ca 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000..59ea2f2 --- /dev/null +++ b/tests/Makefile.am @@ -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 . + +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 diff --git a/tests/helin-segv b/tests/helin-segv index 4e448a5..fa54fa0 100755 --- a/tests/helin-segv +++ b/tests/helin-segv @@ -17,13 +17,8 @@ # along with this program. If not, see . # 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 diff --git a/tests/help-version b/tests/help-version index ebdc69a..79f4b57 100755 --- a/tests/help-version +++ b/tests/help-version @@ -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 diff --git a/tests/hufts b/tests/hufts index 73e74de..5a70a2a 100755 --- a/tests/hufts +++ b/tests/hufts @@ -17,19 +17,14 @@ # along with this program. If not, see . # 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 diff --git a/tests/memcpy-abuse b/tests/memcpy-abuse index 95bc8ca..912c3bb 100755 --- a/tests/memcpy-abuse +++ b/tests/memcpy-abuse @@ -18,13 +18,8 @@ # along with this program. If not, see . # 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. diff --git a/tests/mixed b/tests/mixed index 65898a1..7595ca3 100644 --- a/tests/mixed +++ b/tests/mixed @@ -18,13 +18,8 @@ # along with this program. If not, see . # 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 diff --git a/tests/null-suffix-clobber b/tests/null-suffix-clobber index e5b52a1..da4fc0f 100755 --- a/tests/null-suffix-clobber +++ b/tests/null-suffix-clobber @@ -17,13 +17,8 @@ # along with this program. If not, see . # 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 diff --git a/tests/stdin b/tests/stdin index 8dcfa68..ee52a33 100755 --- a/tests/stdin +++ b/tests/stdin @@ -17,13 +17,8 @@ # along with this program. If not, see . # 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 diff --git a/tests/trailing-nul b/tests/trailing-nul index 8106c29..8a5ab07 100755 --- a/tests/trailing-nul +++ b/tests/trailing-nul @@ -18,13 +18,8 @@ # along with this program. If not, see . # 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 diff --git a/tests/zdiff b/tests/zdiff index 151d00d..5a8b15a 100755 --- a/tests/zdiff +++ b/tests/zdiff @@ -18,13 +18,8 @@ # along with this program. If not, see . # 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 diff --git a/tests/zgrep-f b/tests/zgrep-f index f64b03e..87b9577 100644 --- a/tests/zgrep-f +++ b/tests/zgrep-f @@ -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_ diff --git a/tests/zgrep-signal b/tests/zgrep-signal index 4acd737..2454423 100644 --- a/tests/zgrep-signal +++ b/tests/zgrep-signal @@ -18,13 +18,8 @@ # along with this program. If not, see . # 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 diff --git a/tests/znew-k b/tests/znew-k index d63ec26..d49b971 100644 --- a/tests/znew-k +++ b/tests/znew-k @@ -17,13 +17,8 @@ # along with this program. If not, see . # 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