3 ###############################################################################
5 # Author: Jonathan Nieder
7 # This file has been put into the public domain.
8 # You can do whatever you want with this file.
10 ###############################################################################
12 # If scripts weren't built, this test is skipped.
14 XZDIFF
=..
/src
/scripts
/xzdiff
15 XZGREP
=..
/src
/scripts
/xzgrep
17 for i
in XZ XZDIFF XZGREP
; do
18 eval test -x "\$$i" && continue
23 PATH
=`pwd`/..
/src
/xz
:$PATH
26 test -z "$srcdir" && srcdir
=.
27 preimage
=$srcdir/files
/good-1-check-crc32.xz
28 samepostimage
=$srcdir/files
/good-1-check-crc64.xz
29 otherpostimage
=$srcdir/files
/good-1-lzma2-1.xz
31 "$XZDIFF" "$preimage" "$samepostimage" >/dev
/null
33 if test "$status" != 0 ; then
34 echo "xzdiff with no changes exited with status $status != 0"
39 "$XZDIFF" "$preimage" "$otherpostimage" >/dev
/null
41 if test "$status" != 1 ; then
42 echo "xzdiff with changes exited with status $status != 1"
47 "$XZDIFF" "$preimage" "$srcdir/files/missing.xz" >/dev
/null
2>&1
49 if test "$status" != 2 ; then
50 echo "xzdiff with missing operand exited with status $status != 2"
55 # The exit status must be 0 when a match was found at least from one file,
56 # and 1 when no match was found in any file.
57 cp "$srcdir/files/good-1-lzma2-1.xz" xzgrep_test_1.xz
58 cp "$srcdir/files/good-2-lzma2.xz" xzgrep_test_2.xz
59 for pattern
in el Hello NOMATCH
; do
60 for opts
in "" "-l" "-h" "-H"; do
61 echo "=> xzgrep $opts $pattern <="
62 "$XZGREP" $opts $pattern xzgrep_test_1.xz xzgrep_test_2.xz
65 done > xzgrep_test_output
2>&1
67 if cmp -s "$srcdir/xzgrep_expected_output" xzgrep_test_output
; then
70 echo "unexpected output from xzgrep"