aboutsummaryrefslogtreecommitdiff
path: root/tests/test_scripts.sh
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2014-06-13 18:58:22 +0300
committerLasse Collin <lasse.collin@tukaani.org>2014-09-09 19:18:23 +0300
commitccc728d8290c0464c7af62790b1c5528eceaae35 (patch)
tree3b1534f13f57e21407beba0f0936b7733544ce48 /tests/test_scripts.sh
parentxzgrep: Add a test for the previous fix. (diff)
downloadxz-ccc728d8290c0464c7af62790b1c5528eceaae35.tar.xz
xzgrep: Improve the test script.
Now it should be close to the functionality of the original version by Pavel Raiskup.
Diffstat (limited to '')
-rwxr-xr-xtests/test_scripts.sh24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/test_scripts.sh b/tests/test_scripts.sh
index 7ac1fea8..48a9308a 100755
--- a/tests/test_scripts.sh
+++ b/tests/test_scripts.sh
@@ -54,19 +54,23 @@ fi
# The exit status must be 0 when a match was found at least from one file,
# and 1 when no match was found in any file.
+cp "$srcdir/files/good-1-lzma2-1.xz" xzgrep_test_1.xz
+cp "$srcdir/files/good-2-lzma2.xz" xzgrep_test_2.xz
for pattern in el Hello NOMATCH; do
for opts in "" "-l" "-h" "-H"; do
- "$XZGREP" $opts $pattern \
- "$srcdir/files/good-1-lzma2-1.xz" \
- "$srcdir/files/good-2-lzma2.xz" > /dev/null 2>&1
- status=$?
- test $status = 0 && test $pattern != NOMATCH && continue
- test $status = 1 && test $pattern = NOMATCH && continue
- echo "wrong exit status from xzgrep"
- (exit 1)
- exit 1
+ echo "=> xzgrep $opts $pattern <="
+ "$XZGREP" $opts $pattern xzgrep_test_1.xz xzgrep_test_2.xz
+ echo retval $?
done
-done
+done > xzgrep_test_output 2>&1
+
+if cmp -s "$srcdir/xzgrep_expected_output" xzgrep_test_output ; then
+ :
+else
+ echo "unexpected output from xzgrep"
+ (exit 1)
+ exit 1
+fi
(exit 0)
exit 0