summaryrefslogtreecommitdiff
path: root/Build/source/extra/xz-4.999.9beta/tests
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/extra/xz-4.999.9beta/tests')
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/Makefile.am51
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/Makefile.in687
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/bcj_test.c65
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_sparcbin0 -> 1240 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_x86bin0 -> 1388 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/create_compress_files.c157
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/README232
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0-backward_size.xzbin0 -> 32 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0-empty-truncated.xzbin0 -> 31 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0-footer_magic.xzbin0 -> 32 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0-header_magic.xzbin0 -> 32 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0-nonempty_index.xzbin0 -> 32 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-alone.xzbin0 -> 55 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-header_magic.xzbin0 -> 64 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0catpad-empty.xzbin0 -> 69 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-0pad-empty.xzbin0 -> 37 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-1.xzbin0 -> 64 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-2.xzbin0 -> 64 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-3.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-4.xzbin0 -> 76 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-5.xzbin0 -> 72 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc32.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc64.xzbin0 -> 72 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-sha256.xzbin0 -> 96 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-1.xzbin0 -> 64 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-2.xzbin0 -> 424 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-3.xzbin0 -> 424 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-4.xzbin0 -> 408 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-5.xzbin0 -> 408 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-6.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-7.xzbin0 -> 408 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-8.xzbin0 -> 464 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-1.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-2.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-3.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-1.xzbin0 -> 72 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-2.xzbin0 -> 76 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-2-compressed_data_padding.xzbin0 -> 92 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-1.xzbin0 -> 92 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-2.xzbin0 -> 92 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-3.xzbin0 -> 92 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-4.xzbin0 -> 92 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-5.xzbin0 -> 92 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-0-empty.xzbin0 -> 32 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-0cat-empty.xzbin0 -> 64 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-0catpad-empty.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-0pad-empty.xzbin0 -> 36 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-3delta-lzma2.xzbin0 -> 528 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-1.xzbin0 -> 72 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-2.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-3.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc32.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc64.xzbin0 -> 72 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-none.xzbin0 -> 64 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-sha256.xzbin0 -> 96 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-delta-lzma2.tiff.xzbin0 -> 51316 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-1.xzbin0 -> 424 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-2.xzbin0 -> 424 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-3.xzbin0 -> 408 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-4.xzbin0 -> 464 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-sparc-lzma2.xzbin0 -> 612 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-1-x86-lzma2.xzbin0 -> 716 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/good-2-lzma2.xzbin0 -> 92 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/unsupported-block_header.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/unsupported-check.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-1.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-2.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-3.xzbin0 -> 68 bytes
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/test_block_header.c240
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/test_check.c83
-rwxr-xr-xBuild/source/extra/xz-4.999.9beta/tests/test_compress.sh129
-rwxr-xr-xBuild/source/extra/xz-4.999.9beta/tests/test_files.sh33
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/test_filter_flags.c281
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/test_index.c532
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/test_stream_flags.c180
-rw-r--r--Build/source/extra/xz-4.999.9beta/tests/tests.h124
76 files changed, 2794 insertions, 0 deletions
diff --git a/Build/source/extra/xz-4.999.9beta/tests/Makefile.am b/Build/source/extra/xz-4.999.9beta/tests/Makefile.am
new file mode 100644
index 00000000000..d01787a37ad
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/Makefile.am
@@ -0,0 +1,51 @@
+##
+## Author: Lasse Collin
+##
+## This file has been put into the public domain.
+## You can do whatever you want with this file.
+##
+
+EXTRA_DIST = \
+ files \
+ tests.h \
+ test_files.sh \
+ test_compress.sh \
+ bcj_test.c \
+ compress_prepared_bcj_sparc \
+ compress_prepared_bcj_x86
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/common \
+ -I$(top_srcdir)/src/liblzma/api \
+ -I$(top_builddir)/lib \
+ $(STATIC_CPPFLAGS)
+
+AM_LDFLAGS = $(STATIC_LDFLAGS)
+
+LDADD = $(top_builddir)/src/liblzma/liblzma.la
+
+if COND_GNULIB
+LDADD += $(top_builddir)/lib/libgnu.a
+endif
+
+LDADD += $(LTLIBINTL)
+
+check_PROGRAMS = \
+ create_compress_files \
+ test_check \
+ test_stream_flags \
+ test_filter_flags \
+ test_block_header \
+ test_index
+
+TESTS = \
+ test_check \
+ test_stream_flags \
+ test_filter_flags \
+ test_block_header \
+ test_index \
+ test_files.sh \
+ test_compress.sh
+
+clean-local:
+ -rm -f compress_generated_*
diff --git a/Build/source/extra/xz-4.999.9beta/tests/Makefile.in b/Build/source/extra/xz-4.999.9beta/tests/Makefile.in
new file mode 100644
index 00000000000..d4a018ecac3
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/Makefile.in
@@ -0,0 +1,687 @@
+# Makefile.in generated by automake 1.11 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@COND_GNULIB_TRUE@am__append_1 = $(top_builddir)/lib/libgnu.a
+check_PROGRAMS = create_compress_files$(EXEEXT) test_check$(EXEEXT) \
+ test_stream_flags$(EXEEXT) test_filter_flags$(EXEEXT) \
+ test_block_header$(EXEEXT) test_index$(EXEEXT)
+TESTS = test_check$(EXEEXT) test_stream_flags$(EXEEXT) \
+ test_filter_flags$(EXEEXT) test_block_header$(EXEEXT) \
+ test_index$(EXEEXT) test_files.sh test_compress.sh
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
+ $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lc_cpucores.m4 \
+ $(top_srcdir)/m4/lc_physmem.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/posix-shell.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/visibility.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+create_compress_files_SOURCES = create_compress_files.c
+create_compress_files_OBJECTS = create_compress_files.$(OBJEXT)
+create_compress_files_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+create_compress_files_DEPENDENCIES = \
+ $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \
+ $(am__DEPENDENCIES_1)
+test_block_header_SOURCES = test_block_header.c
+test_block_header_OBJECTS = test_block_header.$(OBJEXT)
+test_block_header_LDADD = $(LDADD)
+test_block_header_DEPENDENCIES = \
+ $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \
+ $(am__DEPENDENCIES_1)
+test_check_SOURCES = test_check.c
+test_check_OBJECTS = test_check.$(OBJEXT)
+test_check_LDADD = $(LDADD)
+test_check_DEPENDENCIES = $(top_builddir)/src/liblzma/liblzma.la \
+ $(am__append_1) $(am__DEPENDENCIES_1)
+test_filter_flags_SOURCES = test_filter_flags.c
+test_filter_flags_OBJECTS = test_filter_flags.$(OBJEXT)
+test_filter_flags_LDADD = $(LDADD)
+test_filter_flags_DEPENDENCIES = \
+ $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \
+ $(am__DEPENDENCIES_1)
+test_index_SOURCES = test_index.c
+test_index_OBJECTS = test_index.$(OBJEXT)
+test_index_LDADD = $(LDADD)
+test_index_DEPENDENCIES = $(top_builddir)/src/liblzma/liblzma.la \
+ $(am__append_1) $(am__DEPENDENCIES_1)
+test_stream_flags_SOURCES = test_stream_flags.c
+test_stream_flags_OBJECTS = test_stream_flags.$(OBJEXT)
+test_stream_flags_LDADD = $(LDADD)
+test_stream_flags_DEPENDENCIES = \
+ $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \
+ $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = create_compress_files.c test_block_header.c test_check.c \
+ test_filter_flags.c test_index.c test_stream_flags.c
+DIST_SOURCES = create_compress_files.c test_block_header.c \
+ test_check.c test_filter_flags.c test_index.c \
+ test_stream_flags.c
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_CPPFLAGS = @DYNAMIC_CPPFLAGS@
+DYNAMIC_LDFLAGS = @DYNAMIC_LDFLAGS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETOPT_H = @GETOPT_H@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_HOMEPAGE = @PACKAGE_HOMEPAGE@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+POSUB = @POSUB@
+PREFERABLY_POSIX_SHELL = @PREFERABLY_POSIX_SHELL@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+RC = @RC@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STATIC_CPPFLAGS = @STATIC_CPPFLAGS@
+STATIC_LDFLAGS = @STATIC_LDFLAGS@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+acx_pthread_config = @acx_pthread_config@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xz = @xz@
+EXTRA_DIST = \
+ files \
+ tests.h \
+ test_files.sh \
+ test_compress.sh \
+ bcj_test.c \
+ compress_prepared_bcj_sparc \
+ compress_prepared_bcj_x86
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/common \
+ -I$(top_srcdir)/src/liblzma/api \
+ -I$(top_builddir)/lib \
+ $(STATIC_CPPFLAGS)
+
+AM_LDFLAGS = $(STATIC_LDFLAGS)
+LDADD = $(top_builddir)/src/liblzma/liblzma.la $(am__append_1) \
+ $(LTLIBINTL)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+create_compress_files$(EXEEXT): $(create_compress_files_OBJECTS) $(create_compress_files_DEPENDENCIES)
+ @rm -f create_compress_files$(EXEEXT)
+ $(LINK) $(create_compress_files_OBJECTS) $(create_compress_files_LDADD) $(LIBS)
+test_block_header$(EXEEXT): $(test_block_header_OBJECTS) $(test_block_header_DEPENDENCIES)
+ @rm -f test_block_header$(EXEEXT)
+ $(LINK) $(test_block_header_OBJECTS) $(test_block_header_LDADD) $(LIBS)
+test_check$(EXEEXT): $(test_check_OBJECTS) $(test_check_DEPENDENCIES)
+ @rm -f test_check$(EXEEXT)
+ $(LINK) $(test_check_OBJECTS) $(test_check_LDADD) $(LIBS)
+test_filter_flags$(EXEEXT): $(test_filter_flags_OBJECTS) $(test_filter_flags_DEPENDENCIES)
+ @rm -f test_filter_flags$(EXEEXT)
+ $(LINK) $(test_filter_flags_OBJECTS) $(test_filter_flags_LDADD) $(LIBS)
+test_index$(EXEEXT): $(test_index_OBJECTS) $(test_index_DEPENDENCIES)
+ @rm -f test_index$(EXEEXT)
+ $(LINK) $(test_index_OBJECTS) $(test_index_LDADD) $(LIBS)
+test_stream_flags$(EXEEXT): $(test_stream_flags_OBJECTS) $(test_stream_flags_DEPENDENCIES)
+ @rm -f test_stream_flags$(EXEEXT)
+ $(LINK) $(test_stream_flags_OBJECTS) $(test_stream_flags_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create_compress_files.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_block_header.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_check.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_filter_flags.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_index.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stream_flags.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ echo "$$grn$$dashes"; \
+ else \
+ echo "$$red$$dashes"; \
+ fi; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes$$std"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+clean-local:
+ -rm -f compress_generated_*
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/extra/xz-4.999.9beta/tests/bcj_test.c b/Build/source/extra/xz-4.999.9beta/tests/bcj_test.c
new file mode 100644
index 00000000000..05de38a28a3
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/bcj_test.c
@@ -0,0 +1,65 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file bcj_test.c
+/// \brief Source code of compress_prepared_bcj_*
+///
+/// This is a simple program that should make the compiler to generate
+/// PC-relative branches, jumps, and calls. The compiled files can then
+/// be used to test the branch conversion filters. Note that this program
+/// itself does nothing useful.
+///
+/// Compiling: gcc -std=c99 -fPIC -c bcj_test.c
+/// Don't optimize or strip.
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+extern int jump(int a, int b);
+
+
+extern int
+call(int a, int b)
+{
+ if (a < b)
+ a = jump(a, b);
+
+ return a;
+}
+
+
+extern int
+jump(int a, int b)
+{
+ // The loop generates conditional jump backwards.
+ while (1) {
+ if (a < b) {
+ a *= 2;
+ a += 3 * b;
+ break;
+ } else {
+ // Put enough code here to prevent JMP SHORT on x86.
+ a += b;
+ a /= 2;
+ b += b % 5;
+ a -= b / 3;
+ b = 2 * b + a - 1;
+ a *= b + a + 1;
+ b += a - 1;
+ a += b * 2 - a / 5;
+ }
+ }
+
+ return a;
+}
+
+
+int
+main(int argc, char **argv)
+{
+ int a = call(argc, argc + 1);
+ return a == 0;
+}
diff --git a/Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_sparc b/Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_sparc
new file mode 100644
index 00000000000..86ea7ddb11b
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_sparc
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_x86 b/Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_x86
new file mode 100644
index 00000000000..bcc546f04cb
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/compress_prepared_bcj_x86
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/create_compress_files.c b/Build/source/extra/xz-4.999.9beta/tests/create_compress_files.c
new file mode 100644
index 00000000000..44367d8f18e
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/create_compress_files.c
@@ -0,0 +1,157 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file create_compress_files.c
+/// \brief Creates bunch of test files to be compressed
+///
+/// Using a test file generator program saves space in the source code
+/// package considerably.
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "sysdefs.h"
+#include <stdio.h>
+
+
+// Avoid re-creating the test files every time the tests are run.
+#define create_test(name) \
+do { \
+ if (!file_exists("compress_generated_" #name)) { \
+ FILE *file = file_create("compress_generated_" #name); \
+ write_ ## name(file); \
+ file_finish(file, "compress_generated_" #name); \
+ } \
+} while (0)
+
+
+static bool
+file_exists(const char *filename)
+{
+ // Trying to be somewhat portable by avoiding stat().
+ FILE *file = fopen(filename, "rb");
+ bool ret;
+
+ if (file != NULL) {
+ fclose(file);
+ ret = true;
+ } else {
+ ret = false;
+ }
+
+ return ret;
+}
+
+
+static FILE *
+file_create(const char *filename)
+{
+ FILE *file = fopen(filename, "wb");
+
+ if (file == NULL) {
+ perror(filename);
+ exit(1);
+ }
+
+ return file;
+}
+
+
+static void
+file_finish(FILE *file, const char *filename)
+{
+ const bool ferror_fail = ferror(file);
+ const bool fclose_fail = fclose(file);
+
+ if (ferror_fail || fclose_fail) {
+ perror(filename);
+ exit(1);
+ }
+}
+
+
+// File that repeats "abc\n" a few thousand times. This is targeted
+// especially at Subblock filter's run-length encoder.
+static void
+write_abc(FILE *file)
+{
+ for (size_t i = 0; i < 12345; ++i)
+ fwrite("abc\n", 4, 1, file);
+}
+
+
+// File that doesn't compress. We always use the same random seed to
+// generate identical files on all systems.
+static void
+write_random(FILE *file)
+{
+ uint32_t n = 5;
+
+ for (size_t i = 0; i < 123456; ++i) {
+ n = 101771 * n + 71777;
+
+ putc(n & 0xFF, file);
+ putc((n >> 8) & 0xFF, file);
+ putc((n >> 16) & 0xFF, file);
+ putc(n >> 24, file);
+ }
+}
+
+
+// Text file
+static void
+write_text(FILE *file)
+{
+ static const char *lorem[] = {
+ "Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur",
+ "adipisicing", "elit,", "sed", "do", "eiusmod", "tempor",
+ "incididunt", "ut", "labore", "et", "dolore", "magna",
+ "aliqua.", "Ut", "enim", "ad", "minim", "veniam,", "quis",
+ "nostrud", "exercitation", "ullamco", "laboris", "nisi",
+ "ut", "aliquip", "ex", "ea", "commodo", "consequat.",
+ "Duis", "aute", "irure", "dolor", "in", "reprehenderit",
+ "in", "voluptate", "velit", "esse", "cillum", "dolore",
+ "eu", "fugiat", "nulla", "pariatur.", "Excepteur", "sint",
+ "occaecat", "cupidatat", "non", "proident,", "sunt", "in",
+ "culpa", "qui", "officia", "deserunt", "mollit", "anim",
+ "id", "est", "laborum."
+ };
+
+ // Let the first paragraph be the original text.
+ for (size_t w = 0; w < ARRAY_SIZE(lorem); ++w) {
+ fprintf(file, "%s ", lorem[w]);
+
+ if (w % 7 == 6)
+ fprintf(file, "\n");
+ }
+
+ // The rest shall be (hopefully) meaningless combinations of
+ // the same words.
+ uint32_t n = 29;
+
+ for (size_t p = 0; p < 500; ++p) {
+ fprintf(file, "\n\n");
+
+ for (size_t w = 0; w < ARRAY_SIZE(lorem); ++w) {
+ n = 101771 * n + 71777;
+
+ fprintf(file, "%s ", lorem[n % ARRAY_SIZE(lorem)]);
+
+ if (w % 7 == 6)
+ fprintf(file, "\n");
+ }
+ }
+}
+
+
+int
+main(void)
+{
+ create_test(abc);
+ create_test(random);
+ create_test(text);
+ return 0;
+}
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/README b/Build/source/extra/xz-4.999.9beta/tests/files/README
new file mode 100644
index 00000000000..392ff768a90
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/README
@@ -0,0 +1,232 @@
+
+.xz Test Files
+----------------
+
+0. Introduction
+
+ This directory contains bunch of files to test handling of .xz files
+ in .xz decoder implementations. Many of the files have been created
+ by hand with a hex editor, thus there is no better "source code" than
+ the files themselves. All the test files (*.xz) and this README have
+ been put into the public domain.
+
+
+1. File Types
+
+ Good files (good-*.xz) must decode successfully without requiring
+ a lot of CPU time or RAM.
+
+ Unsupported files (unsupported-*.xz) are good files, but headers
+ indicate features not supported by the current file format
+ specification.
+
+ Bad files (bad-*.xz) must cause the decoder to give an error. Like
+ with the good files, these files must not require a lot of CPU time
+ or RAM before they get detected to be broken.
+
+
+2. Descriptions of Individual Files
+
+2.1. Good Files
+
+ good-0-empty.xz has one Stream with no Blocks.
+
+ good-0pad-empty.xz has one Stream with no Blocks followed by
+ four-byte Stream Padding.
+
+ good-0cat-empty.xz has two zero-Block Streams concatenated without
+ Stream Padding.
+
+ good-0catpad-empty.xz has two zero-Block Streams concatenated with
+ four-byte Stream Padding between the Streams.
+
+ good-1-check-none.xz has one Stream with one Block with two
+ uncompressed LZMA2 chunks and no integrity check.
+
+ good-1-check-crc32.xz has one Stream with one Block with two
+ uncompressed LZMA2 chunks and CRC32 check.
+
+ good-1-check-crc64.xz is like good-1-check-crc32.xz but with CRC64.
+
+ good-1-check-sha256.xz is like good-1-check-crc32.xz but with
+ SHA256.
+
+ good-2-lzma2.xz has one Stream with two Blocks with one uncompressed
+ LZMA2 chunk in each Block.
+
+ good-1-block_header-1.xz has both Compressed Size and Uncompressed
+ Size in the Block Header. This has also four extra bytes of Header
+ Padding.
+
+ good-1-block_header-2.xz has known Compressed Size.
+
+ good-1-block_header-3.xz has known Uncompressed Size.
+
+ good-1-delta-lzma2.tiff.xz is an image file that compresses
+ better with Delta+LZMA2 than with plain LZMA2.
+
+ good-1-x86-lzma2.xz uses the x86 filter (BCJ) and LZMA2. The
+ uncompressed file is compress_prepared_bcj_x86 found from the tests
+ directory.
+
+ good-1-sparc-lzma2.xz uses the SPARC filter and LZMA. The
+ uncompressed file is compress_prepared_bcj_sparc found from the tests
+ directory.
+
+ good-1-lzma2-1.xz has two LZMA2 chunks, of which the second sets
+ new properties.
+
+ good-1-lzma2-2.xz has two LZMA2 chunks, of which the second resets
+ the state without specifying new properties.
+
+ good-1-lzma2-3.xz has two LZMA2 chunks, of which the first is
+ uncompressed and the second is LZMA. The first chunk resets dictionary
+ and the second sets new properties.
+
+ good-1-lzma2-4.xz has three LZMA2 chunks: First is LZMA, second is
+ uncompressed with dictionary reset, and third is LZMA with new
+ properties but without dictionary reset.
+
+ good-1-3delta-lzma2.xz has three Delta filters and LZMA2.
+
+
+2.2. Unsupported Files
+
+ unsupported-check.xz uses Check ID 0x02 which isn't supported by
+ the current version of the file format. It is implementation-defined
+ how this file handled (it may reject it, or decode it possibly with
+ a warning).
+
+ unsupported-block_header.xz has a non-null byte in Header Padding,
+ which may indicate presence of a new unsupported field.
+
+ unsupported-filter_flags-1.xz has unsupported Filter ID 0x7F.
+
+ unsupported-filter_flags-2.xz specifies only Delta filter in the
+ List of Filter Flags, but Delta isn't allowed as the last filter in
+ the chain. It could be a little more correct to detect this file as
+ corrupt instead of unsupported, but saying it is unsupported is
+ simpler in case of liblzma.
+
+ unsupported-filter_flags-3.xz specifies two LZMA2 filters in the
+ List of Filter Flags. LZMA2 is allowed only as the last filter in the
+ chain. It could be a little more correct to detect this file as
+ corrupt instead of unsupported, but saying it is unsupported is
+ simpler in case of liblzma.
+
+
+2.3. Bad Files
+
+ bad-0pad-empty.xz has one Stream with no Blocks followed by
+ five-byte Stream Padding. Stream Padding must be a multiple of four
+ bytes, thus this file is corrupt.
+
+ bad-0catpad-empty.xz has two zero-Block Streams concatenated with
+ five-byte Stream Padding between the Streams.
+
+ bad-0cat-alone.xz is good-0-empty.xz concatenated with an empty
+ LZMA_Alone file.
+
+ bad-0cat-header_magic.xz is good-0cat-empty.xz but with one byte
+ wrong in the Header Magic Bytes field of the second Stream. liblzma
+ gives LZMA_DATA_ERROR for this. (LZMA_FORMAT_ERROR is used only if
+ the first Stream of a file has invalid Header Magic Bytes.)
+
+ bad-0-header_magic.xz is good-0-empty.xz but with one byte wrong
+ in the Header Magic Bytes field. liblzma gives LZMA_FORMAT_ERROR for
+ this.
+
+ bad-0-footer_magic.xz is good-0-empty.xz but with one byte wrong
+ in the Footer Magic Bytes field. liblzma gives LZMA_DATA_ERROR for
+ this.
+
+ bad-0-empty-truncated.xz is good-0-empty.xz without the last byte
+ of the file.
+
+ bad-0-nonempty_index.xz has no Blocks but Index claims that there is
+ one Block.
+
+ bad-0-backward_size.xz has wrong Backward Size in Stream Footer.
+
+ bad-1-stream_flags-1.xz has different Stream Flags in Stream Header
+ and Stream Footer.
+
+ bad-1-stream_flags-2.xz has wrong CRC32 in Stream Header.
+
+ bad-1-stream_flags-3.xz has wrong CRC32 in Stream Footer.
+
+ bad-1-vli-1.xz has two-byte variable-length integer in the
+ Uncompressed Size field in Block Header while one-byte would be enough
+ for that value. It's important that the file gets rejected due to too
+ big integer encoding instead of due to Uncompressed Size not matching
+ the value stored in the Block Header. That is, the decoder must not
+ try to decode the Compressed Data field.
+
+ bad-1-vli-2.xz has ten-byte variable-length integer as Uncompressed
+ Size in Block Header. It's important that the file gets rejected due
+ to too big integer encoding instead of due to Uncompressed Size not
+ matching the value stored in the Block Header. That is, the decoder
+ must not try to decode the Compressed Data field.
+
+ bad-1-block_header-1.xz has Block Header that ends in the middle of
+ the Filter Flags field.
+
+ bad-1-block_header-2.xz has Block Header that has Compressed Size and
+ Uncompressed Size but no List of Filter Flags field.
+
+ bad-1-block_header-3.xz has wrong CRC32 in Block Header.
+
+ bad-1-block_header-4.xz has too big Compressed Size in Block Header
+ (2^63 - 1 bytes while maximum is a little less, because the whole
+ Block must stay smaller than 2^63). It's important that the file
+ gets rejected due to invalid Compressed Size value; the decoder
+ must not try decoding the Compressed Data field.
+
+ bad-1-block_header-5.xz has zero as Compressed Size in Block Header.
+
+ bad-2-index-1.xz has wrong Unpadded Sizes in Index.
+
+ bad-2-index-2.xz has wrong Uncompressed Sizes in Index.
+
+ bad-2-index-3.xz has non-null byte in Index Padding.
+
+ bad-2-index-4.xz wrong CRC32 in Index.
+
+ bad-2-index-5.xz has zero as Unpadded Size. It is important that the
+ file gets rejected specifically due to Unpadded Size having an invalid
+ value.
+
+ bad-2-compressed_data_padding.xz has non-null byte in the padding of
+ the Compressed Data field of the first Block.
+
+ bad-1-check-crc32.xz has wrong Check (CRC32).
+
+ bad-1-check-crc64.xz has wrong Check (CRC64).
+
+ bad-1-check-sha256.xz has wrong Check (SHA-256).
+
+ bad-1-lzma2-1.xz has LZMA2 stream whose first chunk (uncompressed)
+ doesn't reset the dictionary.
+
+ bad-1-lzma2-2.xz has two LZMA2 chunks, of which the second chunk
+ indicates dictionary reset, but the LZMA compressed data tries to
+ repeat data from the previous chunk.
+
+ bad-1-lzma2-3.xz sets new invalid properties (lc=8, lp=0, pb=0) in
+ the middle of Block.
+
+ bad-1-lzma2-4.xz has two LZMA2 chunks, of which the first is
+ uncompressed and the second is LZMA. The first chunk resets dictionary
+ as it should, but the second chunk tries to reset state without
+ specifying properties for LZMA.
+
+ bad-1-lzma2-5.xz is like bad-1-lzma2-4.xz but doesn't try to reset
+ anything in the header of the second chunk.
+
+ bad-1-lzma2-6.xz has reserved LZMA2 control byte value (0x03).
+
+ bad-1-lzma2-7.xz has EOPM at LZMA level.
+
+ bad-1-lzma2-8.xz is like good-1-lzma2-4.xz but doesn't set new
+ properties in the third LZMA2 chunk.
+
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-backward_size.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-backward_size.xz
new file mode 100644
index 00000000000..2b46fa937b3
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-backward_size.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-empty-truncated.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-empty-truncated.xz
new file mode 100644
index 00000000000..f879af84ac4
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-empty-truncated.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-footer_magic.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-footer_magic.xz
new file mode 100644
index 00000000000..5d9e3894bc2
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-footer_magic.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-header_magic.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-header_magic.xz
new file mode 100644
index 00000000000..5984a453bf8
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-header_magic.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-nonempty_index.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-nonempty_index.xz
new file mode 100644
index 00000000000..ed6e81fa046
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0-nonempty_index.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-alone.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-alone.xz
new file mode 100644
index 00000000000..a915a3a1e2b
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-alone.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-header_magic.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-header_magic.xz
new file mode 100644
index 00000000000..426bf2d4218
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0cat-header_magic.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0catpad-empty.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0catpad-empty.xz
new file mode 100644
index 00000000000..97c13302006
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0catpad-empty.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-0pad-empty.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0pad-empty.xz
new file mode 100644
index 00000000000..45e00b74a3f
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-0pad-empty.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-1.xz
new file mode 100644
index 00000000000..d991536aed8
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-2.xz
new file mode 100644
index 00000000000..ae42ecf0f9b
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-3.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-3.xz
new file mode 100644
index 00000000000..606cbd20e25
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-3.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-4.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-4.xz
new file mode 100644
index 00000000000..e72dfbfc394
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-4.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-5.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-5.xz
new file mode 100644
index 00000000000..96521129267
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-block_header-5.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc32.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc32.xz
new file mode 100644
index 00000000000..1ebe1310b5a
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc32.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc64.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc64.xz
new file mode 100644
index 00000000000..cdb77093db1
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-crc64.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-sha256.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-sha256.xz
new file mode 100644
index 00000000000..def7bff174f
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-check-sha256.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-1.xz
new file mode 100644
index 00000000000..640f592e803
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-2.xz
new file mode 100644
index 00000000000..69ab07d4577
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-3.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-3.xz
new file mode 100644
index 00000000000..66f48c5d535
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-3.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-4.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-4.xz
new file mode 100644
index 00000000000..ac970419399
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-4.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-5.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-5.xz
new file mode 100644
index 00000000000..700464d51ef
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-5.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-6.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-6.xz
new file mode 100644
index 00000000000..2bda0c4b8b8
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-6.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-7.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-7.xz
new file mode 100644
index 00000000000..8cc711c19ed
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-7.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-8.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-8.xz
new file mode 100644
index 00000000000..f21a71b63f3
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-lzma2-8.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-1.xz
new file mode 100644
index 00000000000..6511773ec69
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-2.xz
new file mode 100644
index 00000000000..0c66b364b0e
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-3.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-3.xz
new file mode 100644
index 00000000000..a9b1f98365f
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-stream_flags-3.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-1.xz
new file mode 100644
index 00000000000..6514ab12946
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-2.xz
new file mode 100644
index 00000000000..c16941b4083
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-1-vli-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-compressed_data_padding.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-compressed_data_padding.xz
new file mode 100644
index 00000000000..382d0476700
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-compressed_data_padding.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-1.xz
new file mode 100644
index 00000000000..f51ed214d16
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-2.xz
new file mode 100644
index 00000000000..d7d00ff343f
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-3.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-3.xz
new file mode 100644
index 00000000000..62428b87223
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-3.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-4.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-4.xz
new file mode 100644
index 00000000000..9cf2df65da5
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-4.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-5.xz b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-5.xz
new file mode 100644
index 00000000000..0a79270900a
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/bad-2-index-5.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-0-empty.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-0-empty.xz
new file mode 100644
index 00000000000..83b95e05bc8
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-0-empty.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-0cat-empty.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-0cat-empty.xz
new file mode 100644
index 00000000000..e6fc31461db
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-0cat-empty.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-0catpad-empty.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-0catpad-empty.xz
new file mode 100644
index 00000000000..4f86b7d152d
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-0catpad-empty.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-0pad-empty.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-0pad-empty.xz
new file mode 100644
index 00000000000..c51e3a69c0d
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-0pad-empty.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-3delta-lzma2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-3delta-lzma2.xz
new file mode 100644
index 00000000000..a0be1d007a2
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-3delta-lzma2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-1.xz
new file mode 100644
index 00000000000..fea5ad2f998
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-2.xz
new file mode 100644
index 00000000000..6b5dcb347b2
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-3.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-3.xz
new file mode 100644
index 00000000000..15653120634
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-block_header-3.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc32.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc32.xz
new file mode 100644
index 00000000000..6c89593d447
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc32.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc64.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc64.xz
new file mode 100644
index 00000000000..5a9915d2f9f
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-crc64.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-none.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-none.xz
new file mode 100644
index 00000000000..1e85faf3d06
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-none.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-sha256.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-sha256.xz
new file mode 100644
index 00000000000..fdc556b602c
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-check-sha256.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-delta-lzma2.tiff.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-delta-lzma2.tiff.xz
new file mode 100644
index 00000000000..1f033bc52b5
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-delta-lzma2.tiff.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-1.xz
new file mode 100644
index 00000000000..d8d6489c872
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-2.xz
new file mode 100644
index 00000000000..7e8cdf1b7d0
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-3.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-3.xz
new file mode 100644
index 00000000000..c4c72be6561
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-3.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-4.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-4.xz
new file mode 100644
index 00000000000..e0d623a001c
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-lzma2-4.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-sparc-lzma2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-sparc-lzma2.xz
new file mode 100644
index 00000000000..4532bc61c1a
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-sparc-lzma2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-1-x86-lzma2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-x86-lzma2.xz
new file mode 100644
index 00000000000..8053917bad7
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-1-x86-lzma2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/good-2-lzma2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/good-2-lzma2.xz
new file mode 100644
index 00000000000..bed5085c1f6
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/good-2-lzma2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-block_header.xz b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-block_header.xz
new file mode 100644
index 00000000000..38304429d91
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-block_header.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-check.xz b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-check.xz
new file mode 100644
index 00000000000..c28355e7474
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-check.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-1.xz b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-1.xz
new file mode 100644
index 00000000000..48b93731c52
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-1.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-2.xz b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-2.xz
new file mode 100644
index 00000000000..c283359d562
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-2.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-3.xz b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-3.xz
new file mode 100644
index 00000000000..26084984f97
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/files/unsupported-filter_flags-3.xz
Binary files differ
diff --git a/Build/source/extra/xz-4.999.9beta/tests/test_block_header.c b/Build/source/extra/xz-4.999.9beta/tests/test_block_header.c
new file mode 100644
index 00000000000..a95792eb9dd
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/test_block_header.c
@@ -0,0 +1,240 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file test_block_header.c
+/// \brief Tests Block Header coders
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "tests.h"
+
+
+static uint8_t buf[LZMA_BLOCK_HEADER_SIZE_MAX];
+static lzma_block known_options;
+static lzma_block decoded_options;
+
+static lzma_options_lzma opt_lzma;
+
+static lzma_filter filters_none[1] = {
+ {
+ .id = LZMA_VLI_UNKNOWN,
+ },
+};
+
+
+static lzma_filter filters_one[2] = {
+ {
+ .id = LZMA_FILTER_LZMA2,
+ .options = &opt_lzma,
+ }, {
+ .id = LZMA_VLI_UNKNOWN,
+ }
+};
+
+
+static lzma_filter filters_four[5] = {
+ {
+ .id = LZMA_FILTER_X86,
+ .options = NULL,
+ }, {
+ .id = LZMA_FILTER_X86,
+ .options = NULL,
+ }, {
+ .id = LZMA_FILTER_X86,
+ .options = NULL,
+ }, {
+ .id = LZMA_FILTER_LZMA2,
+ .options = &opt_lzma,
+ }, {
+ .id = LZMA_VLI_UNKNOWN,
+ }
+};
+
+
+static lzma_filter filters_five[6] = {
+ {
+ .id = LZMA_FILTER_X86,
+ .options = NULL,
+ }, {
+ .id = LZMA_FILTER_X86,
+ .options = NULL,
+ }, {
+ .id = LZMA_FILTER_X86,
+ .options = NULL,
+ }, {
+ .id = LZMA_FILTER_X86,
+ .options = NULL,
+ }, {
+ .id = LZMA_FILTER_LZMA2,
+ .options = &opt_lzma,
+ }, {
+ .id = LZMA_VLI_UNKNOWN,
+ }
+};
+
+
+static void
+code(void)
+{
+ expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
+
+ lzma_filter filters[LZMA_FILTERS_MAX + 1];
+ memcrap(filters, sizeof(filters));
+ memcrap(&decoded_options, sizeof(decoded_options));
+
+ decoded_options.header_size = known_options.header_size;
+ decoded_options.check = known_options.check;
+ decoded_options.filters = filters;
+ expect(lzma_block_header_decode(&decoded_options, NULL, buf)
+ == LZMA_OK);
+
+ expect(known_options.compressed_size
+ == decoded_options.compressed_size);
+ expect(known_options.uncompressed_size
+ == decoded_options.uncompressed_size);
+
+ for (size_t i = 0; known_options.filters[i].id
+ != LZMA_VLI_UNKNOWN; ++i)
+ expect(known_options.filters[i].id == filters[i].id);
+
+ for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i)
+ free(decoded_options.filters[i].options);
+}
+
+
+static void
+test1(void)
+{
+ known_options = (lzma_block){
+ .check = LZMA_CHECK_NONE,
+ .compressed_size = LZMA_VLI_UNKNOWN,
+ .uncompressed_size = LZMA_VLI_UNKNOWN,
+ .filters = NULL,
+ };
+
+ expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
+
+ known_options.filters = filters_none;
+ expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
+
+ known_options.filters = filters_five;
+ expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
+
+ known_options.filters = filters_one;
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+
+ known_options.check = 999; // Some invalid value, which gets ignored.
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+
+ known_options.compressed_size = 5;
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+
+ known_options.compressed_size = 0; // Cannot be zero.
+ expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
+
+ // LZMA_VLI_MAX is too big to keep the total size of the Block
+ // a valid VLI, but lzma_block_header_size() is not meant
+ // to validate it. (lzma_block_header_encode() must validate it.)
+ known_options.compressed_size = LZMA_VLI_MAX;
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+
+ known_options.compressed_size = LZMA_VLI_UNKNOWN;
+ known_options.uncompressed_size = 0;
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+
+ known_options.uncompressed_size = LZMA_VLI_MAX + 1;
+ expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
+}
+
+
+static void
+test2(void)
+{
+ known_options = (lzma_block){
+ .check = LZMA_CHECK_CRC32,
+ .compressed_size = LZMA_VLI_UNKNOWN,
+ .uncompressed_size = LZMA_VLI_UNKNOWN,
+ .filters = filters_four,
+ };
+
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+ code();
+
+ known_options.compressed_size = 123456;
+ known_options.uncompressed_size = 234567;
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+ code();
+
+ // We can make the sizes smaller while keeping the header size
+ // the same.
+ known_options.compressed_size = 12;
+ known_options.uncompressed_size = 23;
+ code();
+}
+
+
+static void
+test3(void)
+{
+ known_options = (lzma_block){
+ .check = LZMA_CHECK_CRC32,
+ .compressed_size = LZMA_VLI_UNKNOWN,
+ .uncompressed_size = LZMA_VLI_UNKNOWN,
+ .filters = filters_one,
+ };
+
+ expect(lzma_block_header_size(&known_options) == LZMA_OK);
+ known_options.header_size += 4;
+ expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
+
+ lzma_filter filters[LZMA_FILTERS_MAX + 1];
+ decoded_options.header_size = known_options.header_size;
+ decoded_options.check = known_options.check;
+ decoded_options.filters = filters;
+
+ // Wrong size
+ ++buf[0];
+ expect(lzma_block_header_decode(&decoded_options, NULL, buf)
+ == LZMA_PROG_ERROR);
+ --buf[0];
+
+ // Wrong CRC32
+ buf[known_options.header_size - 1] ^= 1;
+ expect(lzma_block_header_decode(&decoded_options, NULL, buf)
+ == LZMA_DATA_ERROR);
+ buf[known_options.header_size - 1] ^= 1;
+
+ // Unsupported filter
+ // NOTE: This may need updating when new IDs become supported.
+ buf[2] ^= 0x1F;
+ integer_write_32(buf + known_options.header_size - 4,
+ lzma_crc32(buf, known_options.header_size - 4, 0));
+ expect(lzma_block_header_decode(&decoded_options, NULL, buf)
+ == LZMA_OPTIONS_ERROR);
+ buf[2] ^= 0x1F;
+
+ // Non-nul Padding
+ buf[known_options.header_size - 4 - 1] ^= 1;
+ integer_write_32(buf + known_options.header_size - 4,
+ lzma_crc32(buf, known_options.header_size - 4, 0));
+ expect(lzma_block_header_decode(&decoded_options, NULL, buf)
+ == LZMA_OPTIONS_ERROR);
+ buf[known_options.header_size - 4 - 1] ^= 1;
+}
+
+
+int
+main(void)
+{
+ succeed(lzma_lzma_preset(&opt_lzma, 1));
+
+ test1();
+ test2();
+ test3();
+
+ return 0;
+}
diff --git a/Build/source/extra/xz-4.999.9beta/tests/test_check.c b/Build/source/extra/xz-4.999.9beta/tests/test_check.c
new file mode 100644
index 00000000000..7d4a36078cf
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/test_check.c
@@ -0,0 +1,83 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file test_check.c
+/// \brief Tests integrity checks
+///
+/// \todo Add SHA256
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "tests.h"
+
+
+static const uint8_t test_string[9] = "123456789";
+static const uint8_t test_unaligned[12] = "xxx123456789";
+
+
+static bool
+test_crc32(void)
+{
+ static const uint32_t test_vector = 0xCBF43926;
+
+ // Test 1
+ uint32_t crc = lzma_crc32(test_string, sizeof(test_string), 0);
+ if (crc != test_vector)
+ return true;
+
+ // Test 2
+ crc = lzma_crc32(test_unaligned + 3, sizeof(test_string), 0);
+ if (crc != test_vector)
+ return true;
+
+ // Test 3
+ crc = 0;
+ for (size_t i = 0; i < sizeof(test_string); ++i)
+ crc = lzma_crc32(test_string + i, 1, crc);
+ if (crc != test_vector)
+ return true;
+
+ return false;
+}
+
+
+static bool
+test_crc64(void)
+{
+ static const uint64_t test_vector = 0x995DC9BBDF1939FA;
+
+ // Test 1
+ uint64_t crc = lzma_crc64(test_string, sizeof(test_string), 0);
+ if (crc != test_vector)
+ return true;
+
+ // Test 2
+ crc = lzma_crc64(test_unaligned + 3, sizeof(test_string), 0);
+ if (crc != test_vector)
+ return true;
+
+ // Test 3
+ crc = 0;
+ for (size_t i = 0; i < sizeof(test_string); ++i)
+ crc = lzma_crc64(test_string + i, 1, crc);
+ if (crc != test_vector)
+ return true;
+
+ return false;
+}
+
+
+int
+main(void)
+{
+ bool error = false;
+
+ error |= test_crc32();
+ error |= test_crc64();
+
+ return error ? 1 : 0;
+}
diff --git a/Build/source/extra/xz-4.999.9beta/tests/test_compress.sh b/Build/source/extra/xz-4.999.9beta/tests/test_compress.sh
new file mode 100755
index 00000000000..ff0cb304df4
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/test_compress.sh
@@ -0,0 +1,129 @@
+#!/bin/sh
+
+###############################################################################
+#
+# Author: Lasse Collin
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+#
+###############################################################################
+
+# Find out if our shell supports functions.
+eval 'unset foo ; foo() { return 42; } ; foo'
+if test $? != 42 ; then
+ echo "/bin/sh doesn't support functions, skipping this test."
+ (exit 77)
+ exit 77
+fi
+
+test_xz() {
+ if $XZ -c "$@" "$FILE" > tmp_compressed; then
+ :
+ else
+ echo "Compressing failed: $* $FILE"
+ (exit 1)
+ exit 1
+ fi
+
+ if $XZ -cd tmp_compressed > tmp_uncompressed ; then
+ :
+ else
+ echo "Decoding failed: $* $FILE"
+ (exit 1)
+ exit 1
+ fi
+
+ if cmp tmp_uncompressed "$FILE" ; then
+ :
+ else
+ echo "Decoded file does not match the original: $* $FILE"
+ (exit 1)
+ exit 1
+ fi
+
+ if $XZDEC tmp_compressed > tmp_uncompressed ; then
+ :
+ else
+ echo "Decoding failed: $* $FILE"
+ (exit 1)
+ exit 1
+ fi
+
+ if cmp tmp_uncompressed "$FILE" ; then
+ :
+ else
+ echo "Decoded file does not match the original: $* $FILE"
+ (exit 1)
+ exit 1
+ fi
+
+ # Show progress:
+ echo . | tr -d '\n\r'
+}
+
+XZ="../src/xz/xz --memory=28MiB --threads=1"
+XZDEC="../src/xzdec/xzdec --memory=4MiB"
+unset XZ_OPT
+
+# Create the required input files.
+if ./create_compress_files ; then
+ :
+else
+ rm -f compress_*
+ echo "Failed to create files to test compression."
+ (exit 1)
+ exit 1
+fi
+
+# Remove temporary now (in case they are something weird), and on exit.
+rm -f tmp_compressed tmp_uncompressed
+trap 'rm -f tmp_compressed tmp_uncompressed' 0
+
+# Encode and decode each file with various filter configurations.
+# This takes quite a bit of time.
+echo "test_compress.sh:"
+for FILE in compress_generated_* "$srcdir"/compress_prepared_*
+do
+ MSG=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'`
+ echo " $MSG" | tr -d '\n\r'
+
+ # Don't test with empty arguments; it breaks some ancient
+ # proprietary /bin/sh versions due to $@ used in test_xz().
+ test_xz -1
+ test_xz -2
+ test_xz -3
+ test_xz -4
+
+ # Disabled until Subblock format is stable.
+# --subblock \
+# --subblock=size=1 \
+# --subblock=size=1,rle=1 \
+# --subblock=size=1,rle=4 \
+# --subblock=size=4,rle=4 \
+# --subblock=size=8,rle=4 \
+# --subblock=size=8,rle=8 \
+# --subblock=size=4096,rle=12 \
+#
+ for ARGS in \
+ --delta=dist=1 \
+ --delta=dist=4 \
+ --delta=dist=256 \
+ --x86 \
+ --powerpc \
+ --ia64 \
+ --arm \
+ --armthumb \
+ --sparc
+ do
+ test_xz $ARGS --lzma2=dict=64KiB,nice=32,mode=fast
+
+ # Disabled until Subblock format is stable.
+ # test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast
+ done
+
+ echo
+done
+
+(exit 0)
+exit 0
diff --git a/Build/source/extra/xz-4.999.9beta/tests/test_files.sh b/Build/source/extra/xz-4.999.9beta/tests/test_files.sh
new file mode 100755
index 00000000000..7dd9a3901bf
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/test_files.sh
@@ -0,0 +1,33 @@
+#/bin/sh
+
+###############################################################################
+#
+# Author: Lasse Collin
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+#
+###############################################################################
+
+for I in "$srcdir"/files/good-*.xz
+do
+ if ../src/xzdec/xzdec "$I" > /dev/null 2> /dev/null ; then
+ :
+ else
+ echo "Good file failed: $I"
+ (exit 1)
+ exit 1
+ fi
+done
+
+for I in "$srcdir"/files/bad-*.xz
+do
+ if ../src/xzdec/xzdec "$I" > /dev/null 2> /dev/null ; then
+ echo "Bad file succeeded: $I"
+ (exit 1)
+ exit 1
+ fi
+done
+
+(exit 0)
+exit 0
diff --git a/Build/source/extra/xz-4.999.9beta/tests/test_filter_flags.c b/Build/source/extra/xz-4.999.9beta/tests/test_filter_flags.c
new file mode 100644
index 00000000000..808682b57e0
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/test_filter_flags.c
@@ -0,0 +1,281 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file test_filter_flags.c
+/// \brief Tests Filter Flags coders
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "tests.h"
+
+
+static uint8_t buffer[4096];
+static lzma_filter known_flags;
+static lzma_filter decoded_flags;
+static lzma_stream strm = LZMA_STREAM_INIT;
+
+
+static bool
+encode(uint32_t known_size)
+{
+ memcrap(buffer, sizeof(buffer));
+
+ uint32_t tmp;
+ if (lzma_filter_flags_size(&tmp, &known_flags) != LZMA_OK)
+ return true;
+
+ if (tmp != known_size)
+ return true;
+
+ size_t out_pos = 0;
+ if (lzma_filter_flags_encode(&known_flags,
+ buffer, &out_pos, known_size) != LZMA_OK)
+ return true;
+
+ if (out_pos != known_size)
+ return true;
+
+ return false;
+}
+
+
+static bool
+decode_ret(uint32_t known_size, lzma_ret expected_ret)
+{
+ memcrap(&decoded_flags, sizeof(decoded_flags));
+
+ size_t pos = 0;
+ if (lzma_filter_flags_decode(&decoded_flags, NULL,
+ buffer, &pos, known_size) != expected_ret
+ || pos != known_size)
+ return true;
+
+ return false;
+}
+
+
+static bool
+decode(uint32_t known_size)
+{
+ if (decode_ret(known_size, LZMA_OK))
+ return true;
+
+ if (known_flags.id != decoded_flags.id)
+ return true;
+
+ return false;
+}
+
+
+#if defined(HAVE_ENCODER_SUBBLOCK) && defined(HAVE_DECODER_SUBBLOCK)
+static void
+test_subblock(void)
+{
+ // Test 1
+ known_flags.id = LZMA_FILTER_SUBBLOCK;
+ known_flags.options = NULL;
+ expect(!encode(2));
+ expect(!decode(2));
+ expect(decoded_flags.options == NULL);
+
+ // Test 2
+ buffer[0] = LZMA_FILTER_SUBBLOCK;
+ buffer[1] = 1;
+ buffer[2] = 0;
+ expect(!decode_ret(3, LZMA_OPTIONS_ERROR));
+}
+#endif
+
+
+#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86)
+static void
+test_bcj(void)
+{
+ // Test 1
+ known_flags.id = LZMA_FILTER_X86;
+ known_flags.options = NULL;
+
+ expect(!encode(2));
+ expect(!decode(2));
+ expect(decoded_flags.options == NULL);
+
+ // Test 2
+ lzma_options_bcj options;
+ options.start_offset = 0;
+ known_flags.options = &options;
+ expect(!encode(2));
+ expect(!decode(2));
+ expect(decoded_flags.options == NULL);
+
+ // Test 3
+ options.start_offset = 123456;
+ known_flags.options = &options;
+ expect(!encode(6));
+ expect(!decode(6));
+ expect(decoded_flags.options != NULL);
+
+ lzma_options_bcj *decoded = decoded_flags.options;
+ expect(decoded->start_offset == options.start_offset);
+
+ free(decoded);
+}
+#endif
+
+
+#if defined(HAVE_ENCODER_DELTA) && defined(HAVE_DECODER_DELTA)
+static void
+test_delta(void)
+{
+ // Test 1
+ known_flags.id = LZMA_FILTER_DELTA;
+ known_flags.options = NULL;
+ expect(encode(99));
+
+ // Test 2
+ lzma_options_delta options = {
+ .type = LZMA_DELTA_TYPE_BYTE,
+ .dist = 0
+ };
+ known_flags.options = &options;
+ expect(encode(99));
+
+ // Test 3
+ options.dist = LZMA_DELTA_DIST_MIN;
+ expect(!encode(3));
+ expect(!decode(3));
+ expect(((lzma_options_delta *)(decoded_flags.options))->dist
+ == options.dist);
+
+ free(decoded_flags.options);
+
+ // Test 4
+ options.dist = LZMA_DELTA_DIST_MAX;
+ expect(!encode(3));
+ expect(!decode(3));
+ expect(((lzma_options_delta *)(decoded_flags.options))->dist
+ == options.dist);
+
+ free(decoded_flags.options);
+
+ // Test 5
+ options.dist = LZMA_DELTA_DIST_MAX + 1;
+ expect(encode(99));
+}
+#endif
+
+/*
+#ifdef HAVE_FILTER_LZMA
+static void
+validate_lzma(void)
+{
+ const lzma_options_lzma *known = known_flags.options;
+ const lzma_options_lzma *decoded = decoded_flags.options;
+
+ expect(known->dictionary_size <= decoded->dictionary_size);
+
+ if (known->dictionary_size == 1)
+ expect(decoded->dictionary_size == 1);
+ else
+ expect(known->dictionary_size + known->dictionary_size / 2
+ > decoded->dictionary_size);
+
+ expect(known->literal_context_bits == decoded->literal_context_bits);
+ expect(known->literal_pos_bits == decoded->literal_pos_bits);
+ expect(known->pos_bits == decoded->pos_bits);
+}
+
+
+static void
+test_lzma(void)
+{
+ // Test 1
+ known_flags.id = LZMA_FILTER_LZMA1;
+ known_flags.options = NULL;
+ expect(encode(99));
+
+ // Test 2
+ lzma_options_lzma options = {
+ .dictionary_size = 0,
+ .literal_context_bits = 0,
+ .literal_pos_bits = 0,
+ .pos_bits = 0,
+ .preset_dictionary = NULL,
+ .preset_dictionary_size = 0,
+ .mode = LZMA_MODE_INVALID,
+ .fast_bytes = 0,
+ .match_finder = LZMA_MF_INVALID,
+ .match_finder_cycles = 0,
+ };
+
+ // Test 3 (empty dictionary not allowed)
+ known_flags.options = &options;
+ expect(encode(99));
+
+ // Test 4 (brute-force test some valid dictionary sizes)
+ options.dictionary_size = LZMA_DICTIONARY_SIZE_MIN;
+ while (options.dictionary_size != LZMA_DICTIONARY_SIZE_MAX) {
+ if (++options.dictionary_size == 5000)
+ options.dictionary_size = LZMA_DICTIONARY_SIZE_MAX - 5;
+
+ expect(!encode(4));
+ expect(!decode(4));
+ validate_lzma();
+
+ free(decoded_flags.options);
+ }
+
+ // Test 5 (too big dictionary size)
+ options.dictionary_size = LZMA_DICTIONARY_SIZE_MAX + 1;
+ expect(encode(99));
+
+ // Test 6 (brute-force test lc/lp/pb)
+ options.dictionary_size = LZMA_DICTIONARY_SIZE_MIN;
+ for (uint32_t lc = LZMA_LITERAL_CONTEXT_BITS_MIN;
+ lc <= LZMA_LITERAL_CONTEXT_BITS_MAX; ++lc) {
+ for (uint32_t lp = LZMA_LITERAL_POS_BITS_MIN;
+ lp <= LZMA_LITERAL_POS_BITS_MAX; ++lp) {
+ for (uint32_t pb = LZMA_POS_BITS_MIN;
+ pb <= LZMA_POS_BITS_MAX; ++pb) {
+ if (lc + lp > LZMA_LITERAL_BITS_MAX)
+ continue;
+
+ options.literal_context_bits = lc;
+ options.literal_pos_bits = lp;
+ options.pos_bits = pb;
+
+ expect(!encode(4));
+ expect(!decode(4));
+ validate_lzma();
+
+ free(decoded_flags.options);
+ }
+ }
+ }
+}
+#endif
+*/
+
+int
+main(void)
+{
+#if defined(HAVE_ENCODER_SUBBLOCK) && defined(HAVE_DECODER_SUBBLOCK)
+ test_subblock();
+#endif
+#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86)
+ test_bcj();
+#endif
+#if defined(HAVE_ENCODER_DELTA) && defined(HAVE_DECODER_DELTA)
+ test_delta();
+#endif
+// #ifdef HAVE_FILTER_LZMA
+// test_lzma();
+// #endif
+
+ lzma_end(&strm);
+
+ return 0;
+}
diff --git a/Build/source/extra/xz-4.999.9beta/tests/test_index.c b/Build/source/extra/xz-4.999.9beta/tests/test_index.c
new file mode 100644
index 00000000000..5ce2c524735
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/test_index.c
@@ -0,0 +1,532 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file test_index.c
+/// \brief Tests functions handling the lzma_index structure
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "tests.h"
+
+#define MEMLIMIT (LZMA_VLI_C(1) << 20)
+
+
+static lzma_index *
+create_empty(void)
+{
+ lzma_index *i = lzma_index_init(NULL, NULL);
+ expect(i != NULL);
+ return i;
+}
+
+
+static lzma_index *
+create_small(void)
+{
+ lzma_index *i = lzma_index_init(NULL, NULL);
+ expect(i != NULL);
+ expect(lzma_index_append(i, NULL, 101, 555) == LZMA_OK);
+ expect(lzma_index_append(i, NULL, 602, 777) == LZMA_OK);
+ expect(lzma_index_append(i, NULL, 804, 999) == LZMA_OK);
+ return i;
+}
+
+
+static lzma_index *
+create_big(void)
+{
+ lzma_index *i = lzma_index_init(NULL, NULL);
+ expect(i != NULL);
+
+ lzma_vli total_size = 0;
+ lzma_vli uncompressed_size = 0;
+
+ // Add pseudo-random sizes (but always the same size values).
+ const size_t count = 5555;
+ uint32_t n = 11;
+ for (size_t j = 0; j < count; ++j) {
+ n = 7019 * n + 7607;
+ const uint32_t t = n * 3011;
+ expect(lzma_index_append(i, NULL, t, n) == LZMA_OK);
+ total_size += (t + 3) & ~LZMA_VLI_C(3);
+ uncompressed_size += n;
+ }
+
+ expect(lzma_index_count(i) == count);
+ expect(lzma_index_total_size(i) == total_size);
+ expect(lzma_index_uncompressed_size(i) == uncompressed_size);
+ expect(lzma_index_total_size(i) + lzma_index_size(i)
+ + 2 * LZMA_STREAM_HEADER_SIZE
+ == lzma_index_stream_size(i));
+
+ return i;
+}
+
+
+static void
+test_equal(void)
+{
+ lzma_index *a = create_empty();
+ lzma_index *b = create_small();
+ lzma_index *c = create_big();
+ expect(a && b && c);
+
+ expect(lzma_index_equal(a, a));
+ expect(lzma_index_equal(b, b));
+ expect(lzma_index_equal(c, c));
+
+ expect(!lzma_index_equal(a, b));
+ expect(!lzma_index_equal(a, c));
+ expect(!lzma_index_equal(b, c));
+
+ lzma_index_end(a, NULL);
+ lzma_index_end(b, NULL);
+ lzma_index_end(c, NULL);
+}
+
+
+static void
+test_overflow(void)
+{
+ // Integer overflow tests
+ lzma_index *i = create_empty();
+
+ expect(lzma_index_append(i, NULL, LZMA_VLI_MAX - 5, 1234)
+ == LZMA_DATA_ERROR);
+
+ // TODO
+
+ lzma_index_end(i, NULL);
+}
+
+
+static void
+test_copy(const lzma_index *i)
+{
+ lzma_index *d = lzma_index_dup(i, NULL);
+ expect(d != NULL);
+ lzma_index_end(d, NULL);
+}
+
+
+static void
+test_read(lzma_index *i)
+{
+ lzma_index_record record;
+
+ // Try twice so we see that rewinding works.
+ for (size_t j = 0; j < 2; ++j) {
+ lzma_vli total_size = 0;
+ lzma_vli uncompressed_size = 0;
+ lzma_vli stream_offset = LZMA_STREAM_HEADER_SIZE;
+ lzma_vli uncompressed_offset = 0;
+ uint32_t count = 0;
+
+ while (!lzma_index_read(i, &record)) {
+ ++count;
+
+ total_size += record.total_size;
+ uncompressed_size += record.uncompressed_size;
+
+ expect(record.stream_offset == stream_offset);
+ expect(record.uncompressed_offset
+ == uncompressed_offset);
+
+ stream_offset += record.total_size;
+ uncompressed_offset += record.uncompressed_size;
+ }
+
+ expect(lzma_index_total_size(i) == total_size);
+ expect(lzma_index_uncompressed_size(i) == uncompressed_size);
+ expect(lzma_index_count(i) == count);
+
+ lzma_index_rewind(i);
+ }
+}
+
+
+static void
+test_code(lzma_index *i)
+{
+ const size_t alloc_size = 128 * 1024;
+ uint8_t *buf = malloc(alloc_size);
+ expect(buf != NULL);
+
+ // Encode
+ lzma_stream strm = LZMA_STREAM_INIT;
+ expect(lzma_index_encoder(&strm, i) == LZMA_OK);
+ const lzma_vli index_size = lzma_index_size(i);
+ succeed(coder_loop(&strm, NULL, 0, buf, index_size,
+ LZMA_STREAM_END, LZMA_RUN));
+
+ // Decode
+ lzma_index *d;
+ expect(lzma_index_decoder(&strm, &d, MEMLIMIT) == LZMA_OK);
+ succeed(decoder_loop(&strm, buf, index_size));
+
+ expect(lzma_index_equal(i, d));
+
+ lzma_index_end(d, NULL);
+ lzma_end(&strm);
+
+ // Decode with hashing
+ lzma_index_hash *h = lzma_index_hash_init(NULL, NULL);
+ expect(h != NULL);
+ lzma_index_rewind(i);
+ lzma_index_record r;
+ while (!lzma_index_read(i, &r))
+ expect(lzma_index_hash_append(h, r.unpadded_size,
+ r.uncompressed_size) == LZMA_OK);
+ size_t pos = 0;
+ while (pos < index_size - 1)
+ expect(lzma_index_hash_decode(h, buf, &pos, pos + 1)
+ == LZMA_OK);
+ expect(lzma_index_hash_decode(h, buf, &pos, pos + 1)
+ == LZMA_STREAM_END);
+
+ lzma_index_hash_end(h, NULL);
+
+ // Encode buffer
+ size_t buf_pos = 1;
+ expect(lzma_index_buffer_encode(i, buf, &buf_pos, index_size)
+ == LZMA_BUF_ERROR);
+ expect(buf_pos == 1);
+
+ succeed(lzma_index_buffer_encode(i, buf, &buf_pos, index_size + 1));
+ expect(buf_pos == index_size + 1);
+
+ // Decode buffer
+ buf_pos = 1;
+ uint64_t memlimit = MEMLIMIT;
+ expect(lzma_index_buffer_decode(&d, &memlimit, NULL, buf, &buf_pos,
+ index_size) == LZMA_DATA_ERROR);
+ expect(buf_pos == 1);
+ expect(d == NULL);
+
+ succeed(lzma_index_buffer_decode(&d, &memlimit, NULL, buf, &buf_pos,
+ index_size + 1));
+ expect(buf_pos == index_size + 1);
+ expect(lzma_index_equal(i, d));
+
+ lzma_index_end(d, NULL);
+
+ free(buf);
+}
+
+
+static void
+test_many(lzma_index *i)
+{
+ test_copy(i);
+ test_read(i);
+ test_code(i);
+}
+
+
+static void
+test_cat(void)
+{
+ lzma_index *a, *b, *c;
+
+ // Empty Indexes
+ a = create_empty();
+ b = create_empty();
+ expect(lzma_index_cat(a, b, NULL, 0) == LZMA_OK);
+ expect(lzma_index_count(a) == 0);
+ expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
+ expect(lzma_index_file_size(a)
+ == 2 * (2 * LZMA_STREAM_HEADER_SIZE + 8));
+
+ b = create_empty();
+ expect(lzma_index_cat(a, b, NULL, 0) == LZMA_OK);
+ expect(lzma_index_count(a) == 0);
+ expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
+ expect(lzma_index_file_size(a)
+ == 3 * (2 * LZMA_STREAM_HEADER_SIZE + 8));
+
+ b = create_empty();
+ c = create_empty();
+ expect(lzma_index_cat(b, c, NULL, 4) == LZMA_OK);
+ expect(lzma_index_count(b) == 0);
+ expect(lzma_index_stream_size(b) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
+ expect(lzma_index_file_size(b)
+ == 2 * (2 * LZMA_STREAM_HEADER_SIZE + 8) + 4);
+
+ expect(lzma_index_cat(a, b, NULL, 8) == LZMA_OK);
+ expect(lzma_index_count(a) == 0);
+ expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
+ expect(lzma_index_file_size(a)
+ == 5 * (2 * LZMA_STREAM_HEADER_SIZE + 8) + 4 + 8);
+
+ lzma_index_end(a, NULL);
+
+ // Small Indexes
+ a = create_small();
+ lzma_vli stream_size = lzma_index_stream_size(a);
+ b = create_small();
+ expect(lzma_index_cat(a, b, NULL, 4) == LZMA_OK);
+ expect(lzma_index_file_size(a) == stream_size * 2 + 4);
+ expect(lzma_index_stream_size(a) > stream_size);
+ expect(lzma_index_stream_size(a) < stream_size * 2);
+
+ b = create_small();
+ c = create_small();
+ expect(lzma_index_cat(b, c, NULL, 8) == LZMA_OK);
+ expect(lzma_index_cat(a, b, NULL, 12) == LZMA_OK);
+ expect(lzma_index_file_size(a) == stream_size * 4 + 4 + 8 + 12);
+
+ lzma_index_end(a, NULL);
+
+ // Big Indexes
+ a = create_big();
+ stream_size = lzma_index_stream_size(a);
+ b = create_big();
+ expect(lzma_index_cat(a, b, NULL, 4) == LZMA_OK);
+ expect(lzma_index_file_size(a) == stream_size * 2 + 4);
+ expect(lzma_index_stream_size(a) > stream_size);
+ expect(lzma_index_stream_size(a) < stream_size * 2);
+
+ b = create_big();
+ c = create_big();
+ expect(lzma_index_cat(b, c, NULL, 8) == LZMA_OK);
+ expect(lzma_index_cat(a, b, NULL, 12) == LZMA_OK);
+ expect(lzma_index_file_size(a) == stream_size * 4 + 4 + 8 + 12);
+
+ lzma_index_end(a, NULL);
+}
+
+
+static void
+test_locate(void)
+{
+ lzma_index_record r;
+ lzma_index *i = lzma_index_init(NULL, NULL);
+ expect(i != NULL);
+
+ // Cannot locate anything from an empty Index.
+ expect(lzma_index_locate(i, &r, 0));
+ expect(lzma_index_locate(i, &r, 555));
+
+ // One empty Record: nothing is found since there's no uncompressed
+ // data.
+ expect(lzma_index_append(i, NULL, 16, 0) == LZMA_OK);
+ expect(lzma_index_locate(i, &r, 0));
+
+ // Non-empty Record and we can find something.
+ expect(lzma_index_append(i, NULL, 32, 5) == LZMA_OK);
+ expect(!lzma_index_locate(i, &r, 0));
+ expect(r.total_size == 32);
+ expect(r.uncompressed_size == 5);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE + 16);
+ expect(r.uncompressed_offset == 0);
+
+ // Still cannot find anything past the end.
+ expect(lzma_index_locate(i, &r, 5));
+
+ // Add the third Record.
+ expect(lzma_index_append(i, NULL, 40, 11) == LZMA_OK);
+
+ expect(!lzma_index_locate(i, &r, 0));
+ expect(r.total_size == 32);
+ expect(r.uncompressed_size == 5);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE + 16);
+ expect(r.uncompressed_offset == 0);
+
+ expect(!lzma_index_read(i, &r));
+ expect(r.total_size == 40);
+ expect(r.uncompressed_size == 11);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE + 16 + 32);
+ expect(r.uncompressed_offset == 5);
+
+ expect(!lzma_index_locate(i, &r, 2));
+ expect(r.total_size == 32);
+ expect(r.uncompressed_size == 5);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE + 16);
+ expect(r.uncompressed_offset == 0);
+
+ expect(!lzma_index_locate(i, &r, 5));
+ expect(r.total_size == 40);
+ expect(r.uncompressed_size == 11);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE + 16 + 32);
+ expect(r.uncompressed_offset == 5);
+
+ expect(!lzma_index_locate(i, &r, 5 + 11 - 1));
+ expect(r.total_size == 40);
+ expect(r.uncompressed_size == 11);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE + 16 + 32);
+ expect(r.uncompressed_offset == 5);
+
+ expect(lzma_index_locate(i, &r, 5 + 11));
+ expect(lzma_index_locate(i, &r, 5 + 15));
+
+ // Large Index
+ i = lzma_index_init(i, NULL);
+ expect(i != NULL);
+
+ for (size_t n = 4; n <= 4 * 5555; n += 4)
+ expect(lzma_index_append(i, NULL, n + 8, n) == LZMA_OK);
+
+ expect(lzma_index_count(i) == 5555);
+
+ // First Record
+ expect(!lzma_index_locate(i, &r, 0));
+ expect(r.total_size == 4 + 8);
+ expect(r.uncompressed_size == 4);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE);
+ expect(r.uncompressed_offset == 0);
+
+ expect(!lzma_index_locate(i, &r, 3));
+ expect(r.total_size == 4 + 8);
+ expect(r.uncompressed_size == 4);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE);
+ expect(r.uncompressed_offset == 0);
+
+ // Second Record
+ expect(!lzma_index_locate(i, &r, 4));
+ expect(r.total_size == 2 * 4 + 8);
+ expect(r.uncompressed_size == 2 * 4);
+ expect(r.stream_offset == LZMA_STREAM_HEADER_SIZE + 4 + 8);
+ expect(r.uncompressed_offset == 4);
+
+ // Last Record
+ expect(!lzma_index_locate(i, &r, lzma_index_uncompressed_size(i) - 1));
+ expect(r.total_size == 4 * 5555 + 8);
+ expect(r.uncompressed_size == 4 * 5555);
+ expect(r.stream_offset == lzma_index_total_size(i)
+ + LZMA_STREAM_HEADER_SIZE - 4 * 5555 - 8);
+ expect(r.uncompressed_offset
+ == lzma_index_uncompressed_size(i) - 4 * 5555);
+
+ // Allocation chunk boundaries. See INDEX_GROUP_SIZE in
+ // liblzma/common/index.c.
+ const size_t group_multiple = 256 * 4;
+ const size_t radius = 8;
+ const size_t start = group_multiple - radius;
+ lzma_vli ubase = 0;
+ lzma_vli tbase = 0;
+ size_t n;
+ for (n = 1; n < start; ++n) {
+ ubase += n * 4;
+ tbase += n * 4 + 8;
+ }
+
+ while (n < start + 2 * radius) {
+ expect(!lzma_index_locate(i, &r, ubase + n * 4));
+
+ expect(r.stream_offset == tbase + n * 4 + 8
+ + LZMA_STREAM_HEADER_SIZE);
+ expect(r.uncompressed_offset == ubase + n * 4);
+
+ tbase += n * 4 + 8;
+ ubase += n * 4;
+ ++n;
+
+ expect(r.total_size == n * 4 + 8);
+ expect(r.uncompressed_size == n * 4);
+ }
+
+ // Do it also backwards since lzma_index_locate() uses relative search.
+ while (n > start) {
+ expect(!lzma_index_locate(i, &r, ubase + (n - 1) * 4));
+
+ expect(r.total_size == n * 4 + 8);
+ expect(r.uncompressed_size == n * 4);
+
+ --n;
+ tbase -= n * 4 + 8;
+ ubase -= n * 4;
+
+ expect(r.stream_offset == tbase + n * 4 + 8
+ + LZMA_STREAM_HEADER_SIZE);
+ expect(r.uncompressed_offset == ubase + n * 4);
+ }
+
+ // Test locating in concatend Index.
+ i = lzma_index_init(i, NULL);
+ expect(i != NULL);
+ for (n = 0; n < group_multiple; ++n)
+ expect(lzma_index_append(i, NULL, 8, 0) == LZMA_OK);
+ expect(lzma_index_append(i, NULL, 16, 1) == LZMA_OK);
+ expect(!lzma_index_locate(i, &r, 0));
+ expect(r.total_size == 16);
+ expect(r.uncompressed_size == 1);
+ expect(r.stream_offset
+ == LZMA_STREAM_HEADER_SIZE + group_multiple * 8);
+ expect(r.uncompressed_offset == 0);
+
+ lzma_index_end(i, NULL);
+}
+
+
+static void
+test_corrupt(void)
+{
+ const size_t alloc_size = 128 * 1024;
+ uint8_t *buf = malloc(alloc_size);
+ expect(buf != NULL);
+ lzma_stream strm = LZMA_STREAM_INIT;
+
+ lzma_index *i = create_empty();
+ expect(lzma_index_append(i, NULL, 0, 1) == LZMA_PROG_ERROR);
+ lzma_index_end(i, NULL);
+
+ // Create a valid Index and corrupt it in different ways.
+ i = create_small();
+ expect(lzma_index_encoder(&strm, i) == LZMA_OK);
+ succeed(coder_loop(&strm, NULL, 0, buf, 20,
+ LZMA_STREAM_END, LZMA_RUN));
+ lzma_index_end(i, NULL);
+
+ // Wrong Index Indicator
+ buf[0] ^= 1;
+ expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK);
+ succeed(decoder_loop_ret(&strm, buf, 1, LZMA_DATA_ERROR));
+ buf[0] ^= 1;
+
+ // Wrong Number of Records and thus CRC32 fails.
+ --buf[1];
+ expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK);
+ succeed(decoder_loop_ret(&strm, buf, 10, LZMA_DATA_ERROR));
+ ++buf[1];
+
+ // Padding not NULs
+ buf[15] ^= 1;
+ expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK);
+ succeed(decoder_loop_ret(&strm, buf, 16, LZMA_DATA_ERROR));
+
+ lzma_end(&strm);
+ free(buf);
+}
+
+
+int
+main(void)
+{
+ test_equal();
+
+ test_overflow();
+
+ lzma_index *i = create_empty();
+ test_many(i);
+ lzma_index_end(i, NULL);
+
+ i = create_small();
+ test_many(i);
+ lzma_index_end(i, NULL);
+
+ i = create_big();
+ test_many(i);
+ lzma_index_end(i, NULL);
+
+ test_cat();
+
+ test_locate();
+
+ test_corrupt();
+
+ return 0;
+}
diff --git a/Build/source/extra/xz-4.999.9beta/tests/test_stream_flags.c b/Build/source/extra/xz-4.999.9beta/tests/test_stream_flags.c
new file mode 100644
index 00000000000..9c86c6b860a
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/test_stream_flags.c
@@ -0,0 +1,180 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file test_stream_flags.c
+/// \brief Tests Stream Header and Stream Footer coders
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "tests.h"
+
+
+static lzma_stream_flags known_flags;
+static lzma_stream_flags decoded_flags;
+static uint8_t buffer[LZMA_STREAM_HEADER_SIZE];
+
+
+static bool
+validate(void)
+{
+ // TODO: This could require the specific error type as an argument.
+ // We could also test that lzma_stream_flags_compare() gives
+ // the correct return values in different situations.
+ return lzma_stream_flags_compare(&known_flags, &decoded_flags)
+ != LZMA_OK;
+}
+
+
+static bool
+test_header_decoder(lzma_ret expected_ret)
+{
+ memcrap(&decoded_flags, sizeof(decoded_flags));
+
+ if (lzma_stream_header_decode(&decoded_flags, buffer) != expected_ret)
+ return true;
+
+ if (expected_ret != LZMA_OK)
+ return false;
+
+ // Header doesn't have Backward Size, so make
+ // lzma_stream_flags_compare() ignore it.
+ decoded_flags.backward_size = LZMA_VLI_UNKNOWN;
+ return validate();
+}
+
+
+static void
+test_header(void)
+{
+ memcrap(buffer, sizeof(buffer));
+ expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
+ succeed(test_header_decoder(LZMA_OK));
+}
+
+
+static bool
+test_footer_decoder(lzma_ret expected_ret)
+{
+ memcrap(&decoded_flags, sizeof(decoded_flags));
+
+ if (lzma_stream_footer_decode(&decoded_flags, buffer) != expected_ret)
+ return true;
+
+ if (expected_ret != LZMA_OK)
+ return false;
+
+ return validate();
+}
+
+
+static void
+test_footer(void)
+{
+ memcrap(buffer, sizeof(buffer));
+ expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK);
+ succeed(test_footer_decoder(LZMA_OK));
+}
+
+
+static void
+test_encode_invalid(void)
+{
+ known_flags.check = LZMA_CHECK_ID_MAX + 1;
+ known_flags.backward_size = 1024;
+
+ expect(lzma_stream_header_encode(&known_flags, buffer)
+ == LZMA_PROG_ERROR);
+
+ expect(lzma_stream_footer_encode(&known_flags, buffer)
+ == LZMA_PROG_ERROR);
+
+ known_flags.check = (lzma_check)(-1);
+
+ expect(lzma_stream_header_encode(&known_flags, buffer)
+ == LZMA_PROG_ERROR);
+
+ expect(lzma_stream_footer_encode(&known_flags, buffer)
+ == LZMA_PROG_ERROR);
+
+ known_flags.check = LZMA_CHECK_NONE;
+ known_flags.backward_size = 0;
+
+ // Header encoder ignores backward_size.
+ expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
+
+ expect(lzma_stream_footer_encode(&known_flags, buffer)
+ == LZMA_PROG_ERROR);
+
+ known_flags.backward_size = LZMA_VLI_MAX;
+
+ expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
+
+ expect(lzma_stream_footer_encode(&known_flags, buffer)
+ == LZMA_PROG_ERROR);
+}
+
+
+static void
+test_decode_invalid(void)
+{
+ known_flags.check = LZMA_CHECK_NONE;
+ known_flags.backward_size = 1024;
+
+ expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
+
+ // Test 1 (invalid Magic Bytes)
+ buffer[5] ^= 1;
+ succeed(test_header_decoder(LZMA_FORMAT_ERROR));
+ buffer[5] ^= 1;
+
+ // Test 2a (valid CRC32)
+ uint32_t crc = lzma_crc32(buffer + 6, 2, 0);
+ integer_write_32(buffer + 8, crc);
+ succeed(test_header_decoder(LZMA_OK));
+
+ // Test 2b (invalid Stream Flags with valid CRC32)
+ buffer[6] ^= 0x20;
+ crc = lzma_crc32(buffer + 6, 2, 0);
+ integer_write_32(buffer + 8, crc);
+ succeed(test_header_decoder(LZMA_OPTIONS_ERROR));
+
+ // Test 3 (invalid CRC32)
+ expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
+ buffer[9] ^= 1;
+ succeed(test_header_decoder(LZMA_DATA_ERROR));
+
+ // Test 4 (invalid Stream Flags with valid CRC32)
+ expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK);
+ buffer[9] ^= 0x40;
+ crc = lzma_crc32(buffer + 4, 6, 0);
+ integer_write_32(buffer, crc);
+ succeed(test_footer_decoder(LZMA_OPTIONS_ERROR));
+
+ // Test 5 (invalid Magic Bytes)
+ expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK);
+ buffer[11] ^= 1;
+ succeed(test_footer_decoder(LZMA_FORMAT_ERROR));
+}
+
+
+int
+main(void)
+{
+ // Valid headers
+ known_flags.backward_size = 1024;
+ for (lzma_check check = LZMA_CHECK_NONE;
+ check <= LZMA_CHECK_ID_MAX; ++check) {
+ test_header();
+ test_footer();
+ }
+
+ // Invalid headers
+ test_encode_invalid();
+ test_decode_invalid();
+
+ return 0;
+}
diff --git a/Build/source/extra/xz-4.999.9beta/tests/tests.h b/Build/source/extra/xz-4.999.9beta/tests/tests.h
new file mode 100644
index 00000000000..185a6820058
--- /dev/null
+++ b/Build/source/extra/xz-4.999.9beta/tests/tests.h
@@ -0,0 +1,124 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+/// \file tests.h
+/// \brief Common definitions for test applications
+//
+// Author: Lasse Collin
+//
+// This file has been put into the public domain.
+// You can do whatever you want with this file.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef LZMA_TESTS_H
+#define LZMA_TESTS_H
+
+#include "sysdefs.h"
+#include "integer.h"
+#include "lzma.h"
+
+#include <stdio.h>
+
+#define memcrap(buf, size) memset(buf, 0xFD, size)
+
+#define expect(test) ((test) ? 0 : (fprintf(stderr, "%s:%u: %s\n", \
+ __FILE__, __LINE__, #test), abort(), 0))
+
+#define succeed(test) expect(!(test))
+
+#define fail(test) expect(test)
+
+
+static inline const char *
+lzma_ret_sym(lzma_ret ret)
+{
+ if ((unsigned int)(ret) > LZMA_PROG_ERROR)
+ return "UNKNOWN_ERROR";
+
+ static const char *msgs[] = {
+ "LZMA_OK",
+ "LZMA_STREAM_END",
+ "LZMA_NO_CHECK",
+ "LZMA_UNSUPPORTED_CHECK",
+ "LZMA_GET_CHECK",
+ "LZMA_MEM_ERROR",
+ "LZMA_MEMLIMIT_ERROR",
+ "LZMA_FORMAT_ERROR",
+ "LZMA_OPTIONS_ERROR",
+ "LZMA_DATA_ERROR",
+ "LZMA_BUF_ERROR",
+ "LZMA_PROG_ERROR"
+ };
+
+ return msgs[ret];
+}
+
+
+static inline bool
+coder_loop(lzma_stream *strm, uint8_t *in, size_t in_size,
+ uint8_t *out, size_t out_size,
+ lzma_ret expected_ret, lzma_action finishing_action)
+{
+ size_t in_left = in_size;
+ size_t out_left = out_size > 0 ? out_size + 1 : 0;
+ lzma_action action = LZMA_RUN;
+ lzma_ret ret;
+
+ strm->next_in = NULL;
+ strm->avail_in = 0;
+ strm->next_out = NULL;
+ strm->avail_out = 0;
+
+ while (true) {
+ if (in_left > 0) {
+ if (--in_left == 0)
+ action = finishing_action;
+
+ strm->next_in = in++;
+ strm->avail_in = 1;
+ }
+
+ if (out_left > 0) {
+ --out_left;
+ strm->next_out = out++;
+ strm->avail_out = 1;
+ }
+
+ ret = lzma_code(strm, action);
+ if (ret != LZMA_OK)
+ break;
+ }
+
+ bool error = false;
+
+ if (ret != expected_ret)
+ error = true;
+
+ if (expected_ret == LZMA_STREAM_END) {
+ if (strm->total_in != in_size || strm->total_out != out_size)
+ error = true;
+ } else {
+ if (strm->total_in != in_size || strm->total_out != out_size)
+ error = true;
+ }
+
+ return error;
+}
+
+
+static inline bool
+decoder_loop_ret(lzma_stream *strm, uint8_t *in, size_t in_size,
+ lzma_ret expected_ret)
+{
+ return coder_loop(strm, in, in_size, NULL, 0, expected_ret, LZMA_RUN);
+}
+
+
+static inline bool
+decoder_loop(lzma_stream *strm, uint8_t *in, size_t in_size)
+{
+ return coder_loop(strm, in, in_size, NULL, 0,
+ LZMA_STREAM_END, LZMA_RUN);
+}
+
+#endif