1
0
mirror of https://git.tukaani.org/xz.git synced 2026-10-31 03:14:56 +00:00

Tests: test_scripts.sh: Test xzdiff with one operand

The _z test is skipped if gzip isn't available.

Closes: https://github.com/tukaani-project/xz/pull/258
This commit is contained in:
Ali Ahmet Memiş 2026-10-24 21:57:35 +03:00 committed by Lasse Collin
parent 1b1a508859
commit 9e3a31f2fe
No known key found for this signature in database
GPG Key ID: 38EE757D69184620
3 changed files with 24 additions and 1 deletions

3
.gitignore vendored
View File

@ -74,6 +74,9 @@ coverage
/tests/test_memlimit /tests/test_memlimit
/tests/test_stream_flags /tests/test_stream_flags
/tests/test_vli /tests/test_vli
/tests/xzdiff_test
/tests/xzdiff_test.xz
/tests/xzdiff_test_z
/tests/xzgrep_test_1.xz /tests/xzgrep_test_1.xz
/tests/xzgrep_test_2.xz /tests/xzgrep_test_2.xz
/tests/xzgrep_test_output /tests/xzgrep_test_output

View File

@ -86,4 +86,5 @@ endif
clean-local: clean-local:
-rm -f compress_generated_* \ -rm -f compress_generated_* \
xzgrep_test_output xzgrep_test_1.xz xzgrep_test_2.xz xzgrep_test_output xzgrep_test_1.xz xzgrep_test_2.xz \
xzdiff_test xzdiff_test.xz xzdiff_test_z

View File

@ -60,6 +60,25 @@ if test "$status" != 2 ; then
exit 1 exit 1
fi fi
# With one operand, the file is compared to the same name without the suffix.
"$XZ" -dc "$preimage" > xzdiff_test
cp "$preimage" xzdiff_test.xz
"$XZDIFF" xzdiff_test.xz >/dev/null
status=$?
if test "$status" != 0 ; then
echo "xzdiff with one .xz operand exited with status $status != 0"
exit 1
fi
if gzip -c xzdiff_test > xzdiff_test_z 2>/dev/null ; then
"$XZDIFF" xzdiff_test_z >/dev/null
status=$?
if test "$status" != 0 ; then
echo "xzdiff with one _z operand exited with status $status != 0"
exit 1
fi
fi
# The exit status must be 0 when a match was found at least from one file, # 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. # 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-1-lzma2-1.xz" xzgrep_test_1.xz