|
|
b181ac |
commit 1e60f2c0a0ee6c18b02943ce56214799a70aac26 (HEAD, origin/master, origin/HEAD, master)
|
|
|
b181ac |
Author: Lasse Collin <lasse.collin@tukaani.org>
|
|
|
b181ac |
AuthorDate: Wed Jun 11 21:03:25 2014 +0300
|
|
|
b181ac |
Commit: Lasse Collin <lasse.collin@tukaani.org>
|
|
|
b181ac |
CommitDate: Wed Jun 11 21:03:25 2014 +0300
|
|
|
b181ac |
|
|
|
b181ac |
xzgrep: Add a test for the previous fix.
|
|
|
b181ac |
|
|
|
b181ac |
This is a simplified version of Pavel Raiskup's
|
|
|
b181ac |
original patch.
|
|
|
b181ac |
|
|
|
b181ac |
diff --git a/tests/test_scripts.sh b/tests/test_scripts.sh
|
|
|
b181ac |
index 293929e..7ac1fea 100755
|
|
|
b181ac |
--- a/tests/test_scripts.sh
|
|
|
b181ac |
+++ b/tests/test_scripts.sh
|
|
|
b181ac |
@@ -12,16 +12,18 @@
|
|
|
b181ac |
# If scripts weren't built, this test is skipped.
|
|
|
b181ac |
XZ=../src/xz/xz
|
|
|
b181ac |
XZDIFF=../src/scripts/xzdiff
|
|
|
b181ac |
-test -x "$XZ" || XZ=
|
|
|
b181ac |
-test -x "$XZDIFF" || XZDIFF=
|
|
|
b181ac |
-if test -z "$XZ" || test -z "$XZDIFF"; then
|
|
|
b181ac |
+XZGREP=../src/scripts/xzgrep
|
|
|
b181ac |
+
|
|
|
b181ac |
+for i in XZ XZDIFF XZGREP; do
|
|
|
b181ac |
+ eval test -x "\$$i" && continue
|
|
|
b181ac |
(exit 77)
|
|
|
b181ac |
exit 77
|
|
|
b181ac |
-fi
|
|
|
b181ac |
+done
|
|
|
b181ac |
|
|
|
b181ac |
PATH=`pwd`/../src/xz:$PATH
|
|
|
b181ac |
export PATH
|
|
|
b181ac |
|
|
|
b181ac |
+test -z "$srcdir" && srcdir=.
|
|
|
b181ac |
preimage=$srcdir/files/good-1-check-crc32.xz
|
|
|
b181ac |
samepostimage=$srcdir/files/good-1-check-crc64.xz
|
|
|
b181ac |
otherpostimage=$srcdir/files/good-1-lzma2-1.xz
|
|
|
b181ac |
@@ -50,5 +52,21 @@ if test "$status" != 2 ; then
|
|
|
b181ac |
exit 1
|
|
|
b181ac |
fi
|
|
|
b181ac |
|
|
|
b181ac |
+# The exit status must be 0 when a match was found at least from one file,
|
|
|
b181ac |
+# and 1 when no match was found in any file.
|
|
|
b181ac |
+for pattern in el Hello NOMATCH; do
|
|
|
b181ac |
+ for opts in "" "-l" "-h" "-H"; do
|
|
|
b181ac |
+ "$XZGREP" $opts $pattern \
|
|
|
b181ac |
+ "$srcdir/files/good-1-lzma2-1.xz" \
|
|
|
b181ac |
+ "$srcdir/files/good-2-lzma2.xz" > /dev/null 2>&1
|
|
|
b181ac |
+ status=$?
|
|
|
b181ac |
+ test $status = 0 && test $pattern != NOMATCH && continue
|
|
|
b181ac |
+ test $status = 1 && test $pattern = NOMATCH && continue
|
|
|
b181ac |
+ echo "wrong exit status from xzgrep"
|
|
|
b181ac |
+ (exit 1)
|
|
|
b181ac |
+ exit 1
|
|
|
b181ac |
+ done
|
|
|
b181ac |
+done
|
|
|
b181ac |
+
|
|
|
b181ac |
(exit 0)
|
|
|
b181ac |
exit 0
|