From: Jim Meyering Date: Mon, 1 Feb 2010 12:49:22 +0000 (+0100) Subject: tests: begin moving tests into their own files X-Git-Tag: v1.5~111 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=64b0a3b0606a365550add169417985a2cb4d70f0;p=debian%2Fgzip tests: begin moving tests into their own files * Makefile.am (TESTS): Add tests/stdin. (check-local): Move the stdin check to its own file: * tests/stdin: New script. --- diff --git a/Makefile.am b/Makefile.am index cea37f2..181899a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 0000000..8dcfa68 --- /dev/null +++ b/tests/stdin @@ -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 . +# 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