From: Jim Meyering Date: Mon, 1 Feb 2010 14:02:34 +0000 (+0100) Subject: tests: move the hufts-segv test to its own file X-Git-Tag: v1.5~110 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=27a6b364d709c72a3f9d1641d68c985baa44e7b3;p=debian%2Fgzip tests: move the hufts-segv test to its own file * tests/hufts: New test. * Makefile.am (TESTS): Add tests/ (check-local): Remove the hufts-segv test from this rule. --- diff --git a/Makefile.am b/Makefile.am index 181899a..b4e75fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -97,12 +97,11 @@ check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz for file in $(FILES_TO_CHECK); do \ ./gzip -cv -- "$$file" | ./gzip -d | cmp - "$$file" || exit 1; \ done - ./gzip -dc $(srcdir)/tests/hufts-segv.gz > /dev/null 2>&1; \ - test $$? = 1 @echo 'Test succeeded.' TESTS = \ tests/helin-segv \ + tests/hufts \ tests/memcpy-abuse \ tests/stdin \ tests/trailing-nul \ diff --git a/tests/hufts b/tests/hufts new file mode 100755 index 0000000..73e74de --- /dev/null +++ b/tests/hufts @@ -0,0 +1,40 @@ +#!/bin/sh +# Exercise a bug whereby an invalid input could make gzip -d misbehave. + +# 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 '\n...: invalid compressed data--format violated\n' > exp \ + || framework_failure + +fail=0 +gzip -dc "$abs_srcdir/tests/hufts-segv.gz" > out 2> err +test $? = 1 || fail=1 + +compare /dev/null out || fail=1 + +sed 's/.*hufts-segv.gz: /...: /' err > k; mv k err || fail=1 +compare exp err || fail=1 + +Exit $fail