mirror of
https://github.com/PCSX2/xz.git
synced 2026-02-05 11:51:17 +01:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
495aaf3a5b | ||
|
|
ac6c8921d1 | ||
|
|
d1b0276aaf | ||
|
|
cac72956b1 | ||
|
|
2cdf0875de | ||
|
|
0168b6c8fb | ||
|
|
13337714e8 | ||
|
|
ccc728d829 | ||
|
|
948f5865fe | ||
|
|
64228d0d5c | ||
|
|
98d3368ef4 | ||
|
|
ba3b5dd082 | ||
|
|
3d4575f236 | ||
|
|
b9f0584e3e | ||
|
|
cc41bcaf77 | ||
|
|
e34025d666 | ||
|
|
0b6168974f | ||
|
|
41e436076c | ||
|
|
c33efefd4e | ||
|
|
e560c82f1f | ||
|
|
05192b32e5 | ||
|
|
0f35eafe51 | ||
|
|
fc9eaf81d7 | ||
|
|
090c69dda5 | ||
|
|
1f35331332 | ||
|
|
1415f1d946 | ||
|
|
41913949b9 | ||
|
|
3dffda33f4 |
31
INSTALL
31
INSTALL
@@ -26,6 +26,8 @@ XZ Utils Installation
|
||||
4.2. "No POSIX conforming shell (sh) was found."
|
||||
4.3. configure works but build fails at crc32_x86.S
|
||||
4.4. Lots of warnings about symbol visibility
|
||||
4.5. "make check" fails
|
||||
4.6. liblzma.so (or similar) not found when running xz
|
||||
|
||||
|
||||
0. Preface
|
||||
@@ -251,6 +253,12 @@ XZ Utils Installation
|
||||
Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
|
||||
and their symlinks.
|
||||
|
||||
--disable-doc
|
||||
Don't install the documentation files to $docdir
|
||||
(often /usr/doc/xz or /usr/local/doc/xz). Man pages
|
||||
will still be installed. The $docdir can be changed
|
||||
with --docdir=DIR.
|
||||
|
||||
--disable-assembler
|
||||
liblzma includes some assembler optimizations. Currently
|
||||
there is only assembler code for CRC32 and CRC64 for
|
||||
@@ -463,3 +471,26 @@ XZ Utils Installation
|
||||
resulting binaries, but fewer warnings looks nicer and may allow
|
||||
using --enable-werror.
|
||||
|
||||
|
||||
4.5. "make check" fails
|
||||
|
||||
A likely reason is that libtool links the test programs against
|
||||
an installed version of liblzma instead of the version that was
|
||||
just built. This is obviously a bug which seems to happen on
|
||||
some platforms. A workaround is to uninstall the old liblzma
|
||||
versions first.
|
||||
|
||||
If the problem isn't the one described above, then it's likely
|
||||
a bug in XZ Utils or in the compiler. See the platform-specific
|
||||
notes in this file for possible known problems. Please report
|
||||
a bug if you cannot solve the problem. See README for contact
|
||||
information.
|
||||
|
||||
|
||||
4.6. liblzma.so (or similar) not found when running xz
|
||||
|
||||
If you installed the package with "make install" and get an error
|
||||
about liblzma.so (or a similarly named file) being missing, try
|
||||
running "ldconfig" to update the run-time linker cache (if your
|
||||
operating system has such a command).
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ endif
|
||||
|
||||
SUBDIRS += src po tests
|
||||
|
||||
if COND_DOC
|
||||
dist_doc_DATA = \
|
||||
AUTHORS \
|
||||
COPYING \
|
||||
@@ -42,6 +43,7 @@ examplesolddir = $(docdir)/examples_old
|
||||
dist_examplesold_DATA = \
|
||||
doc/examples_old/xz_pipe_comp.c \
|
||||
doc/examples_old/xz_pipe_decomp.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
extra \
|
||||
|
||||
18
NEWS
18
NEWS
@@ -2,6 +2,24 @@
|
||||
XZ Utils Release Notes
|
||||
======================
|
||||
|
||||
5.0.7 (2014-09-20)
|
||||
|
||||
* Fix regressions introduced in 5.0.6:
|
||||
|
||||
- Fix building with non-GNU make.
|
||||
|
||||
- Fix invalid Libs.private value in liblzma.pc which broke
|
||||
static linking against liblzma if the linker flags were
|
||||
taken from pkg-config.
|
||||
|
||||
|
||||
5.0.6 (2014-09-14)
|
||||
|
||||
* xzgrep now exits with status 0 if at least one file matched.
|
||||
|
||||
* A few minor portability and build system fixes
|
||||
|
||||
|
||||
5.0.5 (2013-06-30)
|
||||
|
||||
* lzmadec and liblzma's lzma_alone_decoder(): Support decompressing
|
||||
|
||||
1
THANKS
1
THANKS
@@ -20,6 +20,7 @@ has been important. :-) In alphabetical order:
|
||||
- Daniel Mealha Cabrita
|
||||
- Milo Casagrande
|
||||
- Marek Černocký
|
||||
- Tomer Chachamu
|
||||
- Chris Donawa
|
||||
- Andrew Dudman
|
||||
- Markus Duft
|
||||
|
||||
4
TODO
4
TODO
@@ -12,10 +12,6 @@ Known bugs
|
||||
it would be possible by switching from BT2/BT3/BT4 match finder to
|
||||
HC3/HC4.
|
||||
|
||||
The code to detect number of CPU cores doesn't count hyperthreading
|
||||
as multiple cores. In context of xz, it probably should.
|
||||
Hyperthreading is good at least with p7zip.
|
||||
|
||||
XZ Utils compress some files significantly worse than LZMA Utils.
|
||||
This is due to faster compression presets used by XZ Utils, and
|
||||
can often be worked around by using "xz --extreme". With some files
|
||||
|
||||
11
configure.ac
11
configure.ac
@@ -260,7 +260,7 @@ else
|
||||
done
|
||||
AC_MSG_RESULT([$enable_checks])
|
||||
fi
|
||||
if test "x$enable_checks_crc32" = xno ; then
|
||||
if test "x$enable_check_crc32" = xno ; then
|
||||
AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
|
||||
fi
|
||||
|
||||
@@ -402,6 +402,12 @@ AC_ARG_ENABLE([scripts], [AC_HELP_STRING([--disable-scripts],
|
||||
[], [enable_scripts=yes])
|
||||
AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
|
||||
|
||||
AC_ARG_ENABLE([doc], [AC_HELP_STRING([--disable-doc],
|
||||
[do not install documentation files to docdir
|
||||
(man pages will still be installed)])],
|
||||
[], [enable_doc=yes])
|
||||
AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Checks for programs.
|
||||
@@ -416,8 +422,6 @@ fi
|
||||
echo
|
||||
echo "Initializing Automake:"
|
||||
|
||||
# Automake 1.10 should still be enough but you need to omit serial-tests.
|
||||
dnl AM_INIT_AUTOMAKE([1.10 foreign tar-v7 filename-length-max=99])
|
||||
AM_INIT_AUTOMAKE([1.12 foreign tar-v7 filename-length-max=99 serial-tests])
|
||||
AC_PROG_LN_S
|
||||
|
||||
@@ -627,7 +631,6 @@ AC_CONFIG_FILES([
|
||||
po/Makefile.in
|
||||
lib/Makefile
|
||||
src/Makefile
|
||||
src/liblzma/liblzma.pc
|
||||
src/liblzma/Makefile
|
||||
src/liblzma/api/Makefile
|
||||
src/xz/Makefile
|
||||
|
||||
@@ -13,14 +13,26 @@ mkdir -p Resources
|
||||
# Abort immediately if something goes wrong.
|
||||
set -e
|
||||
|
||||
GCC="gcc-4.2"
|
||||
SDK="/Developer/SDKs/MacOSX10.5.sdk"
|
||||
MDT="10.5"
|
||||
GTT=i686-apple-darwin9
|
||||
|
||||
ARCHES1="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
|
||||
ARCHES2="-arch ppc -arch i386"
|
||||
PKGFORMAT="10.5" # xar
|
||||
|
||||
# avoid "unknown required load command: 0x80000022" from linking on Snow Leopard
|
||||
uname -r | grep ^1 >/dev/null && LDFLAGS="$LDFLAGS -Wl,-no_compact_linkedit"
|
||||
|
||||
# Clean up if it was already configured.
|
||||
[ -f Makefile ] && make distclean
|
||||
|
||||
# Build the regular fat program
|
||||
|
||||
CC="gcc-4.0" \
|
||||
CFLAGS="-O2 -g -arch ppc -arch ppc64 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
|
||||
../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec i686-apple-darwin8
|
||||
CC="$GCC" \
|
||||
CFLAGS="-O2 -g $ARCHES1 -isysroot $SDK -mmacosx-version-min=$MDT" \
|
||||
../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec $GTT
|
||||
|
||||
make
|
||||
|
||||
@@ -32,9 +44,9 @@ make distclean
|
||||
|
||||
# Build the size-optimized program
|
||||
|
||||
CC="gcc-4.0" \
|
||||
CFLAGS="-Os -g -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
|
||||
../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads i686-apple-darwin8
|
||||
CC="$GCC" \
|
||||
CFLAGS="-Os -g $ARCHES2 -isysroot $SDK -mmacosx-version-min=$MDT" \
|
||||
../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads $GTT
|
||||
|
||||
make -C src/liblzma
|
||||
make -C src/xzdec
|
||||
@@ -44,6 +56,19 @@ cp -a ../extra Root/usr/local/share/doc/xz
|
||||
|
||||
make distclean
|
||||
|
||||
# Move development files to different package
|
||||
|
||||
test -d liblzma && rm -r liblzma
|
||||
mkdir -p liblzma/usr/local
|
||||
|
||||
mv Root/usr/local/include liblzma/usr/local
|
||||
mv Root/usr/local/lib liblzma/usr/local
|
||||
|
||||
mkdir -p Root/usr/local/lib
|
||||
cp -p liblzma/usr/local/lib/liblzma.5.dylib Root/usr/local/lib
|
||||
mkdir -p liblzma/usr/local/share/doc/xz
|
||||
mv Root/usr/local/share/doc/xz/examples* liblzma/usr/local/share/doc/xz
|
||||
|
||||
# Strip debugging symbols and make relocatable
|
||||
|
||||
for bin in xz lzmainfo xzdec lzmadec; do
|
||||
@@ -56,19 +81,12 @@ for lib in liblzma.5.dylib; do
|
||||
install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
|
||||
done
|
||||
|
||||
strip -S Root/usr/local/lib/liblzma.a
|
||||
rm -f Root/usr/local/lib/liblzma.la
|
||||
|
||||
# Include pkg-config while making relocatable
|
||||
|
||||
sed -e 's|prefix=/usr/local|prefix=${pcfiledir}/../..|' < Root/usr/local/lib/pkgconfig/liblzma.pc > Root/liblzma.pc
|
||||
mv Root/liblzma.pc Root/usr/local/lib/pkgconfig/liblzma.pc
|
||||
|
||||
# Create tarball, but without the HFS+ attrib
|
||||
|
||||
rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
|
||||
|
||||
( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
|
||||
( cd liblzma; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../liblzma.tbz ./usr/local )
|
||||
|
||||
# Include documentation files for package
|
||||
|
||||
@@ -80,12 +98,15 @@ cp -p ../COPYING Resources/License.txt
|
||||
ID="org.tukaani.xz"
|
||||
VERSION=`cd ..; sh build-aux/version.sh`
|
||||
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
|
||||
$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g 10.4 --verbose
|
||||
$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g $PKGFORMAT --verbose
|
||||
$PACKAGEMAKER -r liblzma -w -k -i $ID.liblzma -n $VERSION -o liblzma.pkg -g $PKGFORMAT --verbose
|
||||
|
||||
# Put the package in a disk image
|
||||
|
||||
if [ "$PKGFORMAT" != "10.5" ]; then
|
||||
hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
|
||||
hdiutil internet-enable -yes -quiet XZ.dmg
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Build completed successfully."
|
||||
|
||||
@@ -24,7 +24,7 @@ liblzma_la_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/liblzma/simple \
|
||||
-I$(top_srcdir)/src/common \
|
||||
-DTUKLIB_SYMBOL_PREFIX=lzma_
|
||||
liblzma_la_LDFLAGS = -no-undefined -version-info 5:5:0
|
||||
liblzma_la_LDFLAGS = -no-undefined -version-info 5:7:0
|
||||
|
||||
include $(srcdir)/common/Makefile.inc
|
||||
include $(srcdir)/check/Makefile.inc
|
||||
@@ -88,3 +88,23 @@ endif
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = liblzma.pc
|
||||
EXTRA_DIST += liblzma.pc.in
|
||||
|
||||
pc_verbose = $(pc_verbose_@AM_V@)
|
||||
pc_verbose_ = $(pc_verbose_@AM_DEFAULT_V@)
|
||||
pc_verbose_0 = @echo " PC " $@;
|
||||
|
||||
liblzma.pc: $(srcdir)/liblzma.pc.in
|
||||
$(AM_V_at)rm -f $@
|
||||
$(pc_verbose)sed \
|
||||
-e 's,@prefix[@],$(prefix),g' \
|
||||
-e 's,@exec_prefix[@],$(exec_prefix),g' \
|
||||
-e 's,@libdir[@],$(libdir),g' \
|
||||
-e 's,@includedir[@],$(includedir),g' \
|
||||
-e 's,@PACKAGE_URL[@],$(PACKAGE_URL),g' \
|
||||
-e 's,@PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
|
||||
-e 's,@PTHREAD_CFLAGS[@],$(PTHREAD_CFLAGS),g' \
|
||||
-e 's,@PTHREAD_LIBS[@],$(PTHREAD_LIBS),g' \
|
||||
< $(srcdir)/liblzma.pc.in > $@ || { rm -f $@; exit 1; }
|
||||
|
||||
clean-local:
|
||||
rm -f liblzma.pc
|
||||
|
||||
@@ -318,6 +318,9 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode(
|
||||
* The size of the Block Header must have already been decoded with
|
||||
* lzma_block_header_size_decode() macro and stored to block->header_size.
|
||||
*
|
||||
* The integrity check type from Stream Header must have been stored
|
||||
* to block->check.
|
||||
*
|
||||
* block->filters must have been allocated, but they don't need to be
|
||||
* initialized (possible existing filter options are not freed).
|
||||
*
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
#define LZMA_VERSION_MAJOR 5
|
||||
#define LZMA_VERSION_MINOR 0
|
||||
#define LZMA_VERSION_PATCH 5
|
||||
#define LZMA_VERSION_PATCH 7
|
||||
#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
|
||||
|
||||
#ifndef LZMA_VERSION_COMMIT
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "crc_macros.h"
|
||||
|
||||
|
||||
// If you make any changes, do some bench marking! Seemingly unrelated
|
||||
// If you make any changes, do some benchmarking! Seemingly unrelated
|
||||
// changes can very easily ruin the performance (and very probably is
|
||||
// very compiler dependent).
|
||||
extern LZMA_API(uint32_t)
|
||||
|
||||
@@ -80,7 +80,7 @@ static const uint32_t SHA256_K[64] = {
|
||||
|
||||
|
||||
static void
|
||||
transform(uint32_t state[static 8], const uint32_t data[static 16])
|
||||
transform(uint32_t state[8], const uint32_t data[16])
|
||||
{
|
||||
uint32_t W[16];
|
||||
uint32_t T[8];
|
||||
|
||||
@@ -30,14 +30,16 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
|
||||
options->lp = LZMA_LP_DEFAULT;
|
||||
options->pb = LZMA_PB_DEFAULT;
|
||||
|
||||
options->dict_size = UINT32_C(1) << (uint8_t []){
|
||||
18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level];
|
||||
static const uint8_t dict_pow2[]
|
||||
= { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 };
|
||||
options->dict_size = UINT32_C(1) << dict_pow2[level];
|
||||
|
||||
if (level <= 3) {
|
||||
options->mode = LZMA_MODE_FAST;
|
||||
options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4;
|
||||
options->nice_len = level <= 1 ? 128 : 273;
|
||||
options->depth = (uint8_t []){ 4, 8, 24, 48 }[level];
|
||||
static const uint8_t depths[] = { 4, 8, 24, 48 };
|
||||
options->depth = depths[level];
|
||||
} else {
|
||||
options->mode = LZMA_MODE_NORMAL;
|
||||
options->mf = LZMA_MF_BT4;
|
||||
|
||||
@@ -147,7 +147,9 @@ if test $# -eq 0; then
|
||||
fi
|
||||
|
||||
exec 3>&1
|
||||
res=0
|
||||
|
||||
# res=1 means that no file matched yet
|
||||
res=1
|
||||
|
||||
for i; do
|
||||
case $i in
|
||||
@@ -194,8 +196,17 @@ for i; do
|
||||
fi >&3 5>&-
|
||||
)
|
||||
r=$?
|
||||
|
||||
# fail occured previously, nothing worse can happen
|
||||
test $res -gt 1 && continue
|
||||
|
||||
test "$xz_status" -eq 0 || test "$xz_status" -eq 2 \
|
||||
|| test "$(kill -l "$xz_status" 2> /dev/null)" = "PIPE" || r=2
|
||||
test $res -lt $r && res=$r
|
||||
|
||||
# still no match
|
||||
test $r -eq 1 && continue
|
||||
|
||||
# 0 == match, >=2 == fail
|
||||
res=$r
|
||||
done
|
||||
exit $res
|
||||
|
||||
@@ -200,9 +200,9 @@ coder_set_compression_settings(void)
|
||||
}
|
||||
|
||||
if (memory_usage > memory_limit) {
|
||||
// If --no-auto-adjust was used or we didn't find LZMA1 or
|
||||
// If --no-adjust was used or we didn't find LZMA1 or
|
||||
// LZMA2 as the last filter, give an error immediately.
|
||||
// --format=raw implies --no-auto-adjust.
|
||||
// --format=raw implies --no-adjust.
|
||||
if (!opt_auto_adjust || opt_format == FORMAT_RAW)
|
||||
memlimit_too_small(memory_usage);
|
||||
|
||||
|
||||
@@ -77,17 +77,19 @@ signals_init(void)
|
||||
sigaddset(&hooked_signals, message_progress_sigs[i]);
|
||||
#endif
|
||||
|
||||
struct sigaction sa;
|
||||
// Using "my_sa" because "sa" may conflict with a sockaddr variable
|
||||
// from system headers on Solaris.
|
||||
struct sigaction my_sa;
|
||||
|
||||
// All the signals that we handle we also blocked while the signal
|
||||
// handler runs.
|
||||
sa.sa_mask = hooked_signals;
|
||||
my_sa.sa_mask = hooked_signals;
|
||||
|
||||
// Don't set SA_RESTART, because we want EINTR so that we can check
|
||||
// for user_abort and cleanup before exiting. We block the signals
|
||||
// for which we have established a handler when we don't want EINTR.
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = &signal_handler;
|
||||
my_sa.sa_flags = 0;
|
||||
my_sa.sa_handler = &signal_handler;
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) {
|
||||
// If the parent process has left some signals ignored,
|
||||
@@ -98,7 +100,7 @@ signals_init(void)
|
||||
continue;
|
||||
|
||||
// Establish the signal handler.
|
||||
if (sigaction(sigs[i], &sa, NULL))
|
||||
if (sigaction(sigs[i], &my_sa, NULL))
|
||||
message_signal_handler();
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ suffix_set(const char *suffix)
|
||||
// Empty suffix and suffixes having a directory separator are
|
||||
// rejected. Such suffixes would break things later.
|
||||
if (suffix[0] == '\0' || has_dir_sep(suffix))
|
||||
message_fatal(_("%s: Invalid filename suffix"), optarg);
|
||||
message_fatal(_("%s: Invalid filename suffix"), suffix);
|
||||
|
||||
// Replace the old custom_suffix (if any) with the new suffix.
|
||||
free(custom_suffix);
|
||||
|
||||
@@ -59,7 +59,14 @@ endif
|
||||
if COND_LZMADEC
|
||||
bin_PROGRAMS += lzmadec
|
||||
|
||||
# FIXME: If xzdec is disabled, this will create a dangling symlink.
|
||||
# Create the symlink lzmadec.1->xzdec.1 only if xzdec.1 was installed.
|
||||
# This is better than creating a dangling symlink, especially
|
||||
# because creating the link may fail due to the directory being missing.
|
||||
#
|
||||
# FIXME: The correct solution would be to install xzdec.1 as lzmadec.1
|
||||
# but I don't know what is the sane way to do it and since this is a bit
|
||||
# unusual situation anyway, it's not that important.
|
||||
if COND_XZDEC
|
||||
install-data-hook:
|
||||
cd $(DESTDIR)$(mandir)/man1 && \
|
||||
target=`echo xzdec | sed '$(transform)'` && \
|
||||
@@ -72,3 +79,4 @@ uninstall-hook:
|
||||
link=`echo lzmadec | sed '$(transform)'` && \
|
||||
rm -f $$link.1
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -13,7 +13,8 @@ EXTRA_DIST = \
|
||||
test_scripts.sh \
|
||||
bcj_test.c \
|
||||
compress_prepared_bcj_sparc \
|
||||
compress_prepared_bcj_x86
|
||||
compress_prepared_bcj_x86 \
|
||||
xzgrep_expected_output
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/common \
|
||||
@@ -52,4 +53,5 @@ TESTS += test_scripts.sh
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
-rm -f compress_generated_*
|
||||
-rm -f compress_generated_* \
|
||||
xzgrep_test_output xzgrep_test_1.xz xzgrep_test_2.xz
|
||||
|
||||
@@ -12,16 +12,18 @@
|
||||
# If scripts weren't built, this test is skipped.
|
||||
XZ=../src/xz/xz
|
||||
XZDIFF=../src/scripts/xzdiff
|
||||
test -x "$XZ" || XZ=
|
||||
test -x "$XZDIFF" || XZDIFF=
|
||||
if test -z "$XZ" || test -z "$XZDIFF"; then
|
||||
XZGREP=../src/scripts/xzgrep
|
||||
|
||||
for i in XZ XZDIFF XZGREP; do
|
||||
eval test -x "\$$i" && continue
|
||||
(exit 77)
|
||||
exit 77
|
||||
fi
|
||||
done
|
||||
|
||||
PATH=`pwd`/../src/xz:$PATH
|
||||
export PATH
|
||||
|
||||
test -z "$srcdir" && srcdir=.
|
||||
preimage=$srcdir/files/good-1-check-crc32.xz
|
||||
samepostimage=$srcdir/files/good-1-check-crc64.xz
|
||||
otherpostimage=$srcdir/files/good-1-lzma2-1.xz
|
||||
@@ -50,5 +52,25 @@ if test "$status" != 2 ; then
|
||||
exit 1
|
||||
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
|
||||
echo "=> xzgrep $opts $pattern <="
|
||||
"$XZGREP" $opts $pattern xzgrep_test_1.xz xzgrep_test_2.xz
|
||||
echo retval $?
|
||||
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
|
||||
|
||||
39
tests/xzgrep_expected_output
Normal file
39
tests/xzgrep_expected_output
Normal file
@@ -0,0 +1,39 @@
|
||||
=> xzgrep el <=
|
||||
xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut
|
||||
xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu
|
||||
xzgrep_test_2.xz:Hello
|
||||
retval 0
|
||||
=> xzgrep -l el <=
|
||||
xzgrep_test_1.xz
|
||||
xzgrep_test_2.xz
|
||||
retval 0
|
||||
=> xzgrep -h el <=
|
||||
elit, sed do eiusmod tempor incididunt ut
|
||||
in voluptate velit esse cillum dolore eu
|
||||
Hello
|
||||
retval 0
|
||||
=> xzgrep -H el <=
|
||||
xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut
|
||||
xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu
|
||||
xzgrep_test_2.xz:Hello
|
||||
retval 0
|
||||
=> xzgrep Hello <=
|
||||
xzgrep_test_2.xz:Hello
|
||||
retval 0
|
||||
=> xzgrep -l Hello <=
|
||||
xzgrep_test_2.xz
|
||||
retval 0
|
||||
=> xzgrep -h Hello <=
|
||||
Hello
|
||||
retval 0
|
||||
=> xzgrep -H Hello <=
|
||||
xzgrep_test_2.xz:Hello
|
||||
retval 0
|
||||
=> xzgrep NOMATCH <=
|
||||
retval 1
|
||||
=> xzgrep -l NOMATCH <=
|
||||
retval 1
|
||||
=> xzgrep -h NOMATCH <=
|
||||
retval 1
|
||||
=> xzgrep -H NOMATCH <=
|
||||
retval 1
|
||||
Reference in New Issue
Block a user