[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pushed some test-moving changes, too
From: |
Jim Meyering |
Subject: |
pushed some test-moving changes, too |
Date: |
Wed, 03 Feb 2010 06:38:40 +0100 |
A few tests were jumbled together under the local-check
rule in Makefile.am. I've begun to more them into individual scripts,
each in its own file in tests/
Plus, these uses of path_prepend_ were unnecessary.
>From cba5e3591649f0467f2154e9d371e358711f747d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 1 Feb 2010 13:34:46 +0100
Subject: [PATCH 1/3] tests: remove unnecessary use of "path_prepend_ ."
It is unnecessary, since Makefile.am's TESTS_ENVIRONMENT setting
already adds the top build directory, and besides, is only
marginally useful when running stand-alone, since it presumes
that the script is being run from the top build directory.
* tests/helin-segv: Remove unnecessary use of path_prepend_.
* tests/memcpy-abuse: Likewise.
* tests/trailing-nul: Likewise.
* tests/zdiff: Likewise.
* tests/zgrep-f: Likewise.
---
tests/helin-segv | 2 +-
tests/memcpy-abuse | 2 +-
tests/trailing-nul | 2 +-
tests/zdiff | 2 +-
tests/zgrep-f | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/helin-segv b/tests/helin-segv
index d6b14f6..4e448a5 100755
--- a/tests/helin-segv
+++ b/tests/helin-segv
@@ -23,7 +23,7 @@ if test "$VERBOSE" = yes; then
fi
: ${srcdir=.}
-. "$srcdir/tests/init.sh"; path_prepend_ .
+. "$srcdir/tests/init.sh"
# This test case was provided by Aki Helin.
printf '\037\235\220\0\0\0\304' > helin.gz || framework_failure
diff --git a/tests/memcpy-abuse b/tests/memcpy-abuse
index 8f2abd5..95bc8ca 100755
--- a/tests/memcpy-abuse
+++ b/tests/memcpy-abuse
@@ -24,7 +24,7 @@ if test "$VERBOSE" = yes; then
fi
: ${srcdir=.}
-. "$srcdir/tests/init.sh"; path_prepend_ .
+. "$srcdir/tests/init.sh"
# The input must be larger than 32KiB and slightly
# less uniform than e.g., all zeros.
diff --git a/tests/trailing-nul b/tests/trailing-nul
index 83805df..8106c29 100755
--- a/tests/trailing-nul
+++ b/tests/trailing-nul
@@ -24,7 +24,7 @@ if test "$VERBOSE" = yes; then
fi
: ${srcdir=.}
-. "$srcdir/tests/init.sh"; path_prepend_ .
+. "$srcdir/tests/init.sh"
(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 da753c6..151d00d 100755
--- a/tests/zdiff
+++ b/tests/zdiff
@@ -24,7 +24,7 @@ if test "$VERBOSE" = yes; then
fi
: ${srcdir=.}
-. "$srcdir/tests/init.sh"; path_prepend_ .
+. "$srcdir/tests/init.sh"
echo a > a || framework_failure
echo b > b || framework_failure
diff --git a/tests/zgrep-f b/tests/zgrep-f
index 5f4b7a0..0801e8d 100644
--- a/tests/zgrep-f
+++ b/tests/zgrep-f
@@ -24,7 +24,7 @@ if test "$VERBOSE" = yes; then
fi
: ${srcdir=.}
-. "$srcdir/tests/init.sh"; path_prepend_ .
+. "$srcdir/tests/init.sh"
echo needle > n || framework_failure
echo needle > haystack || framework_failure
--
1.7.0.rc1.167.gdb08
>From 64b0a3b0606a365550add169417985a2cb4d70f0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 1 Feb 2010 13:49:22 +0100
Subject: [PATCH 2/3] 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.
---
Makefile.am | 3 +--
tests/stdin | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 2 deletions(-)
create mode 100755 tests/stdin
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 <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
--
1.7.0.rc1.167.gdb08
>From 27a6b364d709c72a3f9d1641d68c985baa44e7b3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 1 Feb 2010 15:02:34 +0100
Subject: [PATCH 3/3] 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.
---
Makefile.am | 3 +--
tests/hufts | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
create mode 100755 tests/hufts
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 <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 '\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
--
1.7.0.rc1.167.gdb08
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- pushed some test-moving changes, too,
Jim Meyering <=