tests: begin moving tests into their own files
authorJim Meyering <meyering@redhat.com>
Mon, 1 Feb 2010 12:49:22 +0000 (13:49 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 3 Feb 2010 05:23:57 +0000 (06:23 +0100)
* Makefile.am (TESTS): Add tests/stdin.
(check-local): Move the stdin check to its own file:
* tests/stdin: New script.

Makefile.am
tests/stdin [new file with mode: 0755]

index cea37f2050bd92dde420e2c218c2c503227a8f26..181899aa6f624b44f9cd52d3337ef3c35a58d936 100644 (file)
@@ -99,13 +99,12 @@ check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz
        done
        ./gzip -dc $(srcdir)/tests/hufts-segv.gz > /dev/null 2>&1; \
          test $$? = 1
-       k=in-$$$$; printf a | ./gzip > $$k && \
-         test "`cat $$k | ./gzip -dc $$k - $$k`" = aaa && rm $$k
        @echo 'Test succeeded.'
 
 TESTS =                                                \
   tests/helin-segv                             \
   tests/memcpy-abuse                           \
+  tests/stdin                                  \
   tests/trailing-nul                           \
   tests/zdiff                                  \
   tests/zgrep-f                                        \
diff --git a/tests/stdin b/tests/stdin
new file mode 100755 (executable)
index 0000000..8dcfa68
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Ensure that gzip interprets "-" as stdin.
+
+# Copyright (C) 2009-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 of the License, 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/>.
+# limit so don't run it by default.
+
+if test "$VERBOSE" = yes; then
+  set -x
+  zgrep --version
+fi
+
+: ${srcdir=.}
+. "$srcdir/tests/init.sh"
+
+printf a | gzip > in || framework_failure
+printf aaa > exp || framework_failure
+
+fail=0
+gzip -dc in - in < in > out 2>err || fail=1
+
+compare exp out || fail=1
+compare /dev/null err || fail=1
+
+Exit $fail