diff options
-rw-r--r-- | bin/sqfs2tar/Makemodule.am | 2 | ||||
-rw-r--r-- | bin/sqfs2tar/src/sqfs2tar.h | 2 | ||||
-rw-r--r-- | bin/tar2sqfs/Makemodule.am | 2 | ||||
-rw-r--r-- | include/xfrm/wrap.h (renamed from include/io/xfrm.h) | 8 | ||||
-rw-r--r-- | lib/io/Makemodule.am | 43 | ||||
-rw-r--r-- | lib/io/src/internal.h | 28 | ||||
-rw-r--r-- | lib/tar/Makemodule.am | 68 | ||||
-rw-r--r-- | lib/tar/src/iterator.c | 2 | ||||
-rw-r--r-- | lib/xfrm/Makemodule.am | 38 | ||||
-rw-r--r-- | lib/xfrm/src/istream.c (renamed from lib/io/src/xfrm/istream.c) | 13 | ||||
-rw-r--r-- | lib/xfrm/src/ostream.c (renamed from lib/io/src/xfrm/ostream.c) | 13 | ||||
-rw-r--r-- | lib/xfrm/test/blob.h (renamed from lib/io/test/xfrm.c) | 172 | ||||
-rw-r--r-- | lib/xfrm/test/unpack.c | 339 | ||||
-rw-r--r-- | lib/xfrm/test/wrap.c | 175 |
14 files changed, 277 insertions, 628 deletions
diff --git a/bin/sqfs2tar/Makemodule.am b/bin/sqfs2tar/Makemodule.am index abd1c3b..943a058 100644 --- a/bin/sqfs2tar/Makemodule.am +++ b/bin/sqfs2tar/Makemodule.am @@ -1,7 +1,7 @@ sqfs2tar_SOURCES = bin/sqfs2tar/src/sqfs2tar.c bin/sqfs2tar/src/sqfs2tar.h \ bin/sqfs2tar/src/options.c bin/sqfs2tar/src/iterator.c sqfs2tar_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -sqfs2tar_LDADD = libcommon.a libutil.a libtar.a libio.a libsquashfs.la +sqfs2tar_LDADD = libcommon.a libutil.a libtar.a libsquashfs.la sqfs2tar_LDADD += libxfrm.a libcompat.a libfstree.a sqfs2tar_LDADD += $(ZLIB_LIBS) $(XZ_LIBS) $(LZO_LIBS) $(ZSTD_LIBS) $(BZIP2_LIBS) sqfs2tar_LDADD += $(PTHREAD_LIBS) diff --git a/bin/sqfs2tar/src/sqfs2tar.h b/bin/sqfs2tar/src/sqfs2tar.h index 4c9a8f2..edd29ab 100644 --- a/bin/sqfs2tar/src/sqfs2tar.h +++ b/bin/sqfs2tar/src/sqfs2tar.h @@ -14,7 +14,7 @@ #include "util/strlist.h" #include "tar/tar.h" #include "xfrm/compress.h" -#include "io/xfrm.h" +#include "xfrm/wrap.h" #include <getopt.h> #include <string.h> diff --git a/bin/tar2sqfs/Makemodule.am b/bin/tar2sqfs/Makemodule.am index 49cfb7d..8201b45 100644 --- a/bin/tar2sqfs/Makemodule.am +++ b/bin/tar2sqfs/Makemodule.am @@ -1,7 +1,7 @@ tar2sqfs_SOURCES = bin/tar2sqfs/src/tar2sqfs.c bin/tar2sqfs/src/tar2sqfs.h \ bin/tar2sqfs/src/options.c bin/tar2sqfs/src/process_tarball.c tar2sqfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -tar2sqfs_LDADD = libcommon.a libtar.a libio.a libsquashfs.la libxfrm.a +tar2sqfs_LDADD = libcommon.a libtar.a libsquashfs.la libxfrm.a tar2sqfs_LDADD += libfstree.a libcompat.a libfstree.a libutil.a $(LZO_LIBS) tar2sqfs_LDADD += $(ZLIB_LIBS) $(XZ_LIBS) $(ZSTD_LIBS) $(BZIP2_LIBS) tar2sqfs_LDADD += $(PTHREAD_LIBS) diff --git a/include/io/xfrm.h b/include/xfrm/wrap.h index 21ffa57..48ae112 100644 --- a/include/io/xfrm.h +++ b/include/xfrm/wrap.h @@ -1,11 +1,11 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ /* - * xfrm.h + * wrap.h * * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ -#ifndef IO_XFRM_H -#define IO_XFRM_H +#ifndef XFRM_WRAP_H +#define XFRM_WRAP_H #include "sqfs/predef.h" #include "xfrm/stream.h" @@ -52,4 +52,4 @@ SQFS_INTERNAL sqfs_ostream_t *ostream_xfrm_create(sqfs_ostream_t *strm, } #endif -#endif /* IO_XFRM_H */ +#endif /* XFRM_WRAP_H */ diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am index 2f6fb1c..75a3e59 100644 --- a/lib/io/Makemodule.am +++ b/lib/io/Makemodule.am @@ -1,6 +1,5 @@ -libio_a_SOURCES = include/io/xfrm.h include/io/dir_iterator.h \ - lib/io/src/internal.h lib/io/src/xfrm/ostream.c \ - lib/io/src/xfrm/istream.c lib/io/src/dir_tree_iterator.c +libio_a_SOURCES = include/io/dir_iterator.h \ + lib/io/src/dir_tree_iterator.c libio_a_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) $(XZ_CFLAGS) libio_a_CFLAGS += $(ZSTD_CFLAGS) $(BZIP2_CFLAGS) @@ -29,44 +28,6 @@ test_dir_tree_iterator3_LDADD = libio.a libsquashfs.la libutil.a libcompat.a test_dir_tree_iterator3_CPPFLAGS = $(AM_CPPFLAGS) test_dir_tree_iterator3_CPPFLAGS += -DTESTPATH=$(top_srcdir)/lib/io/test/testdir -if WITH_XZ -test_io_xfrm_xz_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_xz_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \ - libcompat.a $(XZ_LIBS) -test_io_xfrm_xz_CPPFLAGS = $(AM_CPPFLAGS) -DDO_XZ=1 - -LIBIO_TESTS += test_io_xfrm_xz -endif - -if WITH_BZIP2 -test_io_xfrm_bzip2_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_bzip2_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \ - libcompat.a $(BZIP2_LIBS) -test_io_xfrm_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DDO_BZIP2=1 - -LIBIO_TESTS += test_io_xfrm_bzip2 -endif - -if WITH_GZIP -test_io_xfrm_gzip_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_gzip_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \ - libcompat.a $(ZLIB_LIBS) -test_io_xfrm_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DDO_GZIP=1 - -LIBIO_TESTS += test_io_xfrm_gzip -endif - -if WITH_ZSTD -if HAVE_ZSTD_STREAM -test_io_xfrm_zstd_SOURCES = lib/io/test/xfrm.c -test_io_xfrm_zstd_LDADD = libcommon.a libsquashfs.la libio.a libxfrm.a \ - libcompat.a $(ZSTD_LIBS) -test_io_xfrm_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DDO_ZSTD=1 - -LIBIO_TESTS += test_io_xfrm_zstd -endif -endif - check_PROGRAMS += $(LIBIO_TESTS) TESTS += $(LIBIO_TESTS) diff --git a/lib/io/src/internal.h b/lib/io/src/internal.h deleted file mode 100644 index 7c2b1df..0000000 --- a/lib/io/src/internal.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * internal.h - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#ifndef INTERNAL_H -#define INTERNAL_H - -#include "config.h" -#include "compat.h" -#include "io/xfrm.h" -#include "xfrm/compress.h" - -#include <string.h> -#include <stdlib.h> -#include <stdarg.h> -#include <stdlib.h> -#include <unistd.h> -#include <assert.h> -#include <ctype.h> -#include <fcntl.h> -#include <errno.h> -#include <stdio.h> - -#define BUFSZ (262144) - -#endif /* INTERNAL_H */ diff --git a/lib/tar/Makemodule.am b/lib/tar/Makemodule.am index b66d071..1afedcf 100644 --- a/lib/tar/Makemodule.am +++ b/lib/tar/Makemodule.am @@ -11,193 +11,193 @@ noinst_LIBRARIES += libtar.a TARDATADIR=$(top_srcdir)/lib/tar/test/data test_tar_gnu0_SOURCES = lib/tar/test/tar_simple.c -test_tar_gnu0_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_gnu0_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_gnu0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_gnu0_CPPFLAGS += -DTESTFILE=format-acceptance/gnu.tar test_tar_gnu1_SOURCES = lib/tar/test/tar_simple.c -test_tar_gnu1_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_gnu1_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_gnu1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_gnu1_CPPFLAGS += -DTESTFILE=format-acceptance/gnu-g.tar test_tar_gnu2_SOURCES = lib/tar/test/tar_simple.c -test_tar_gnu2_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_gnu2_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_gnu2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_gnu2_CPPFLAGS += -DTESTFILE=user-group-largenum/gnu.tar test_tar_gnu2_CPPFLAGS += -DTESTUID=0x80000000 -DTESTGID=0x80000000 test_tar_gnu2_CPPFLAGS += -DTESTTS=1542995392 test_tar_gnu3_SOURCES = lib/tar/test/tar_simple.c -test_tar_gnu3_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_gnu3_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_gnu3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_gnu3_CPPFLAGS += -DTESTFILE=negative-mtime/gnu.tar -DTESTTS=-315622800 test_tar_gnu4_SOURCES = lib/tar/test/tar_simple.c -test_tar_gnu4_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_gnu4_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_gnu4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_gnu4_CPPFLAGS += -DTESTFILE=long-paths/gnu.tar -DLONG_NAME_TEST test_tar_gnu4_CPPFLAGS += -DTESTTS=1542909670 test_tar_gnu5_SOURCES = lib/tar/test/tar_simple.c -test_tar_gnu5_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_gnu5_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_gnu5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_gnu5_CPPFLAGS += -DTESTFILE=large-mtime/gnu.tar -DTESTTS=8589934592L test_tar_gnu6_SOURCES = lib/tar/test/tar_big_file.c -test_tar_gnu6_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_gnu6_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_gnu6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_gnu6_CPPFLAGS += -DTESTFILE=file-size/gnu.tar test_tar_pax0_SOURCES = lib/tar/test/tar_simple.c -test_tar_pax0_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_pax0_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_pax0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_pax0_CPPFLAGS += -DTESTFILE=format-acceptance/pax.tar test_tar_pax1_SOURCES = lib/tar/test/tar_simple.c -test_tar_pax1_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_pax1_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_pax1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_pax1_CPPFLAGS += -DTESTFILE=user-group-largenum/pax.tar test_tar_pax1_CPPFLAGS += -DTESTUID=2147483648UL -DTESTGID=2147483648UL test_tar_pax1_CPPFLAGS += -DTESTTS=1542995392 test_tar_pax2_SOURCES = lib/tar/test/tar_simple.c -test_tar_pax2_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_pax2_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_pax2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_pax2_CPPFLAGS += -DTESTFILE=large-mtime/pax.tar -DTESTTS=8589934592L test_tar_pax3_SOURCES = lib/tar/test/tar_simple.c -test_tar_pax3_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_pax3_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_pax3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_pax3_CPPFLAGS += -DTESTFILE=negative-mtime/pax.tar -DTESTTS=-315622800 test_tar_pax4_SOURCES = lib/tar/test/tar_simple.c -test_tar_pax4_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_pax4_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_pax4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_pax4_CPPFLAGS += -DTESTFILE=long-paths/pax.tar test_tar_pax4_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670 test_tar_pax5_SOURCES = lib/tar/test/tar_big_file.c -test_tar_pax5_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_pax5_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_pax5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_pax5_CPPFLAGS += -DTESTFILE=file-size/pax.tar test_tar_ustar0_SOURCES = lib/tar/test/tar_simple.c -test_tar_ustar0_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_ustar0_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_ustar0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_ustar0_CPPFLAGS += -DTESTFILE=format-acceptance/ustar.tar test_tar_ustar1_SOURCES = lib/tar/test/tar_simple.c -test_tar_ustar1_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_ustar1_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_ustar1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_ustar1_CPPFLAGS += -DTESTFILE=format-acceptance/ustar-pre-posix.tar test_tar_ustar2_SOURCES = lib/tar/test/tar_simple.c -test_tar_ustar2_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_ustar2_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_ustar2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_ustar2_CPPFLAGS += -DTESTFILE=format-acceptance/v7.tar test_tar_ustar3_SOURCES = lib/tar/test/tar_simple.c -test_tar_ustar3_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_ustar3_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_ustar3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_ustar3_CPPFLAGS += -DTESTFILE=user-group-largenum/8-digit.tar test_tar_ustar3_CPPFLAGS += -DTESTUID=8388608 -DTESTGID=8388608 test_tar_ustar3_CPPFLAGS += -DTESTTS=1542995392 test_tar_ustar4_SOURCES = lib/tar/test/tar_simple.c -test_tar_ustar4_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_ustar4_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_ustar4_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_ustar4_CPPFLAGS += -DTESTFILE=large-mtime/12-digit.tar test_tar_ustar4_CPPFLAGS += -DTESTTS=8589934592L test_tar_ustar5_SOURCES = lib/tar/test/tar_simple.c -test_tar_ustar5_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_ustar5_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_ustar5_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_ustar5_CPPFLAGS += -DTESTFILE=long-paths/ustar.tar test_tar_ustar5_CPPFLAGS += -DLONG_NAME_TEST -DTESTTS=1542909670 test_tar_ustar6_SOURCES = lib/tar/test/tar_big_file.c -test_tar_ustar6_LDADD = libtar.a libio.a libcommon.a libsquashfs.la libutil.a libcompat.a +test_tar_ustar6_LDADD = libtar.a libcommon.a libsquashfs.la libutil.a libcompat.a test_tar_ustar6_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_ustar6_CPPFLAGS += -DTESTFILE=file-size/12-digit.tar test_tar_target_filled_SOURCES = lib/tar/test/tar_target_filled.c -test_tar_target_filled_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_target_filled_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_target_filled_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_sparse_gnu_SOURCES = lib/tar/test/tar_sparse_gnu.c -test_tar_sparse_gnu_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_sparse_gnu_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_sparse_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_sparse_gnu0_SOURCES = lib/tar/test/tar_sparse.c -test_tar_sparse_gnu0_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_sparse_gnu0_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_sparse_gnu0_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_sparse_gnu0_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-0.tar test_tar_sparse_gnu1_SOURCES = lib/tar/test/tar_sparse.c -test_tar_sparse_gnu1_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_sparse_gnu1_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_sparse_gnu1_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_sparse_gnu1_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu0-1.tar test_tar_sparse_gnu2_SOURCES = lib/tar/test/tar_sparse.c -test_tar_sparse_gnu2_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_sparse_gnu2_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_sparse_gnu2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_sparse_gnu2_CPPFLAGS += -DTESTFILE=sparse-files/pax-gnu1-0.tar test_tar_sparse_gnu3_SOURCES = lib/tar/test/tar_sparse.c -test_tar_sparse_gnu3_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_sparse_gnu3_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_sparse_gnu3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_sparse_gnu3_CPPFLAGS += -DTESTFILE=sparse-files/gnu.tar test_tar_xattr_bsd_SOURCES = lib/tar/test/tar_xattr.c -test_tar_xattr_bsd_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_xattr_bsd_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_xattr_bsd_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_xattr_bsd_CPPFLAGS += -DTESTFILE=xattr/xattr-libarchive.tar test_tar_xattr_schily_SOURCES = lib/tar/test/tar_xattr.c -test_tar_xattr_schily_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_xattr_schily_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_xattr_schily_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_xattr_schily_CPPFLAGS += -DTESTFILE=xattr/xattr-schily.tar test_tar_xattr_schily_bin_SOURCES = lib/tar/test/tar_xattr_bin.c -test_tar_xattr_schily_bin_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_xattr_schily_bin_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_xattr_schily_bin_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_xattr_schily_bin_CPPFLAGS += -DTESTFILE=xattr/xattr-schily-binary.tar test_tar_iterator_SOURCES = lib/tar/test/tar_iterator.c -test_tar_iterator_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_iterator_LDADD = libtar.a libcommon.a libsquashfs.la \ libxfrm.a libutil.a libcompat.a $(XZ_LIBS) $(BZIP2_LIBS) \ $(ZLIB_LIBS) $(ZSTD_LIBS) test_tar_iterator_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_iterator_CPPFLAGS += -DTESTFILE=format-acceptance/gnu.tar test_tar_iterator2_SOURCES = lib/tar/test/tar_iterator2.c -test_tar_iterator2_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_iterator2_LDADD = libtar.a libcommon.a libsquashfs.la \ libxfrm.a libutil.a libcompat.a $(XZ_LIBS) $(BZIP2_LIBS) \ $(ZLIB_LIBS) $(ZSTD_LIBS) test_tar_iterator2_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_iterator2_CPPFLAGS += -DTESTFILE=iterator/sparse.tar test_tar_iterator3_SOURCES = lib/tar/test/tar_iterator3.c -test_tar_iterator3_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_iterator3_LDADD = libtar.a libcommon.a libsquashfs.la \ libxfrm.a libutil.a libcompat.a $(XZ_LIBS) $(BZIP2_LIBS) \ $(ZLIB_LIBS) $(ZSTD_LIBS) test_tar_iterator3_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) tar_fuzz_SOURCES = lib/tar/test/tar_fuzz.c -tar_fuzz_LDADD = libtar.a libio.a libcommon.a libcommon.a libsquashfs.la \ +tar_fuzz_LDADD = libtar.a libcommon.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_write_simple_SOURCES = lib/tar/test/tar_write_simple.c -test_tar_write_simple_LDADD = libtar.a libio.a libcommon.a libsquashfs.la \ +test_tar_write_simple_LDADD = libtar.a libcommon.a libsquashfs.la \ libutil.a libcompat.a test_tar_write_simple_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(TARDATADIR) test_tar_write_simple_CPPFLAGS += -DTESTFILE=write/simple.tar diff --git a/lib/tar/src/iterator.c b/lib/tar/src/iterator.c index 46748f7..8f3353e 100644 --- a/lib/tar/src/iterator.c +++ b/lib/tar/src/iterator.c @@ -10,7 +10,7 @@ #include "sqfs/error.h" #include "sqfs/xattr.h" #include "util/util.h" -#include "io/xfrm.h" +#include "xfrm/wrap.h" #include "compat.h" #include <stdlib.h> diff --git a/lib/xfrm/Makemodule.am b/lib/xfrm/Makemodule.am index 518344c..4f5ed8e 100644 --- a/lib/xfrm/Makemodule.am +++ b/lib/xfrm/Makemodule.am @@ -2,14 +2,15 @@ LIBXFRM_LIBS = $(ZLIB_LIBS) $(XZ_LIBS) $(BZIP2_LIBS) $(ZSTD_LIBS) LIBXFRM_TESTS = libxfrm_a_SOURCES = include/xfrm/stream.h include/xfrm/compress.h \ - lib/xfrm/src/compress.c + include/xfrm/wrap.h lib/xfrm/src/compress.c lib/xfrm/src/istream.c \ + lib/xfrm/src/ostream.c libxfrm_a_CFLAGS = $(AM_CFLAGS) if WITH_XZ libxfrm_a_SOURCES += lib/xfrm/src/xz.c libxfrm_a_CFLAGS += $(XZ_CFLAGS) -DWITH_XZ -test_unpack_xz_SOURCES = lib/xfrm/test/unpack.c +test_unpack_xz_SOURCES = lib/xfrm/test/unpack.c lib/xfrm/test/blob.h test_unpack_xz_LDADD = libxfrm.a $(XZ_LIBS) test_unpack_xz_CPPFLAGS = $(AM_CPPFLAGS) -DDO_XZ=1 @@ -17,14 +18,18 @@ test_pack_xz_SOURCES = lib/xfrm/test/pack.c test_pack_xz_LDADD = libxfrm.a $(LIBXFRM_LIBS) test_pack_xz_CPPFLAGS = $(AM_CPPFLAGS) -DDO_XZ=1 -LIBXFRM_TESTS += test_pack_xz test_unpack_xz +test_wrap_xz_SOURCES = lib/xfrm/test/wrap.c lib/xfrm/test/blob.h +test_wrap_xz_LDADD = libcommon.a libsquashfs.la libxfrm.a libcompat.a $(XZ_LIBS) +test_wrap_xz_CPPFLAGS = $(AM_CPPFLAGS) -DDO_XZ=1 + +LIBXFRM_TESTS += test_pack_xz test_unpack_xz test_wrap_xz endif if WITH_BZIP2 libxfrm_a_SOURCES += lib/xfrm/src/bzip2.c libxfrm_a_CFLAGS += $(BZIP2_CFLAGS) -DWITH_BZIP2 -test_unpack_bzip2_SOURCES = lib/xfrm/test/unpack.c +test_unpack_bzip2_SOURCES = lib/xfrm/test/unpack.c lib/xfrm/test/blob.h test_unpack_bzip2_LDADD = libxfrm.a $(BZIP2_LIBS) test_unpack_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DDO_BZIP2=1 @@ -32,14 +37,19 @@ test_pack_bzip2_SOURCES = lib/xfrm/test/pack.c test_pack_bzip2_LDADD = libxfrm.a $(LIBXFRM_LIBS) test_pack_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DDO_BZIP2=1 -LIBXFRM_TESTS += test_unpack_bzip2 test_pack_bzip2 +test_wrap_bzip2_SOURCES = lib/xfrm/test/wrap.c lib/xfrm/test/blob.h +test_wrap_bzip2_LDADD = libcommon.a libsquashfs.la libxfrm.a \ + libcompat.a $(BZIP2_LIBS) +test_wrap_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DDO_BZIP2=1 + +LIBXFRM_TESTS += test_unpack_bzip2 test_pack_bzip2 test_wrap_bzip2 endif if WITH_GZIP libxfrm_a_SOURCES += lib/xfrm/src/gzip.c libxfrm_a_CFLAGS += $(ZLIB_CFLAGS) -DWITH_GZIP -test_unpack_gzip_SOURCES = lib/xfrm/test/unpack.c +test_unpack_gzip_SOURCES = lib/xfrm/test/unpack.c lib/xfrm/test/blob.h test_unpack_gzip_LDADD = libxfrm.a $(ZLIB_LIBS) test_unpack_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DDO_GZIP=1 @@ -47,7 +57,12 @@ test_pack_gzip_SOURCES = lib/xfrm/test/pack.c test_pack_gzip_LDADD = libxfrm.a $(LIBXFRM_LIBS) test_pack_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DDO_GZIP=1 -LIBXFRM_TESTS += test_pack_gzip test_unpack_gzip +test_wrap_gzip_SOURCES = lib/xfrm/test/wrap.c lib/xfrm/test/blob.h +test_wrap_gzip_LDADD = libcommon.a libsquashfs.la libxfrm.a \ + libcompat.a $(ZLIB_LIBS) +test_wrap_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DDO_GZIP=1 + +LIBXFRM_TESTS += test_pack_gzip test_unpack_gzip test_wrap_gzip endif if WITH_ZSTD @@ -59,11 +74,16 @@ test_pack_zstd_SOURCES = lib/xfrm/test/pack.c test_pack_zstd_LDADD = libxfrm.a $(LIBXFRM_LIBS) test_pack_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DDO_ZSTD=1 -test_unpack_zstd_SOURCES = lib/xfrm/test/unpack.c +test_unpack_zstd_SOURCES = lib/xfrm/test/unpack.c lib/xfrm/test/blob.h test_unpack_zstd_LDADD = libxfrm.a $(ZSTD_LIBS) test_unpack_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DDO_ZSTD=1 -LIBXFRM_TESTS += test_pack_zstd test_unpack_zstd +test_wrap_zstd_SOURCES = lib/xfrm/test/wrap.c lib/xfrm/test/blob.h +test_wrap_zstd_LDADD = libcommon.a libsquashfs.la libxfrm.a \ + libcompat.a $(ZSTD_LIBS) +test_wrap_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DDO_ZSTD=1 + +LIBXFRM_TESTS += test_pack_zstd test_unpack_zstd test_wrap_zstd endif endif diff --git a/lib/io/src/xfrm/istream.c b/lib/xfrm/src/istream.c index ee4b5bd..ecf0887 100644 --- a/lib/io/src/xfrm/istream.c +++ b/lib/xfrm/src/istream.c @@ -4,9 +4,20 @@ * * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ -#include "../internal.h" +#include "config.h" +#include "compat.h" #include "sqfs/io.h" #include "sqfs/error.h" +#include "xfrm/compress.h" +#include "xfrm/wrap.h" + +#include <string.h> +#include <stdlib.h> +#include <assert.h> +#include <ctype.h> +#include <errno.h> + +#define BUFSZ (262144) typedef struct istream_xfrm_t { sqfs_istream_t base; diff --git a/lib/io/src/xfrm/ostream.c b/lib/xfrm/src/ostream.c index 2b42084..8e33a91 100644 --- a/lib/io/src/xfrm/ostream.c +++ b/lib/xfrm/src/ostream.c @@ -4,9 +4,20 @@ * * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ -#include "../internal.h" +#include "config.h" +#include "compat.h" #include "sqfs/io.h" #include "sqfs/error.h" +#include "xfrm/compress.h" +#include "xfrm/wrap.h" + +#include <string.h> +#include <stdlib.h> +#include <assert.h> +#include <ctype.h> +#include <errno.h> + +#define BUFSZ (262144) typedef struct ostream_xfrm_t { sqfs_ostream_t base; diff --git a/lib/io/test/xfrm.c b/lib/xfrm/test/blob.h index 26eee87..13e232e 100644 --- a/lib/io/test/xfrm.c +++ b/lib/xfrm/test/blob.h @@ -1,15 +1,11 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ /* - * xfrm.c + * blob.h * * Copyright (C) 2022 David Oberhollenzer <goliath@infraroot.at> */ -#include "xfrm/compress.h" -#include "xfrm/stream.h" -#include "util/test.h" -#include "sqfs/io.h" -#include "io/xfrm.h" -#include "common.h" +#ifndef BLOB_H +#define BLOB_H static const sqfs_u8 blob_in[] = { #if defined(DO_XZ) @@ -349,164 +345,4 @@ static const char orig[] = "cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\n" "proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n"; -#if defined(DO_XZ) -#define mkdecompressor decompressor_stream_xz_create -#define mkcompressor compressor_stream_xz_create -#elif defined(DO_BZIP2) -#define mkdecompressor decompressor_stream_bzip2_create -#define mkcompressor compressor_stream_bzip2_create -#elif defined(DO_ZSTD) -#define mkdecompressor decompressor_stream_zstd_create -#define mkcompressor compressor_stream_zstd_create -#elif defined(DO_GZIP) -#define mkdecompressor decompressor_stream_gzip_create -#define mkcompressor compressor_stream_gzip_create -#endif - -/*****************************************************************************/ - -static size_t mo_written = 0; -static sqfs_u8 mo_buffer[1024]; -static bool mo_flushed = false; - -static int mem_append(sqfs_ostream_t *strm, const void *data, size_t size); -static int mem_flush(sqfs_ostream_t *strm); - -static sqfs_ostream_t mem_ostream = { - { 1, NULL, NULL, }, - mem_append, - mem_flush, - NULL, -}; - -static int mem_append(sqfs_ostream_t *strm, const void *data, size_t size) -{ - TEST_ASSERT(strm == &mem_ostream); - TEST_ASSERT(size > 0); - - TEST_ASSERT(mo_written <= sizeof(mo_buffer)); - TEST_ASSERT(size <= (sizeof(mo_buffer) - mo_written)); - - if (data == NULL) { - memset(mo_buffer + mo_written, 0, size); - } else { - memcpy(mo_buffer + mo_written, data, size); - } - - mo_written += size; - return 0; -} - -static int mem_flush(sqfs_ostream_t *strm) -{ - TEST_ASSERT(strm == &mem_ostream); - TEST_ASSERT(!mo_flushed); - mo_flushed = true; - return 0; -} - -/*****************************************************************************/ - -static void run_unpack_test(const void *blob, size_t size) -{ - sqfs_istream_t *istream, *mem_istream; - xfrm_stream_t *xfrm; - sqfs_s32 ret; - size_t i; - char c; - - mem_istream = istream_memory_create("memstream", 7, blob, size); - TEST_NOT_NULL(mem_istream); - - xfrm = mkdecompressor(); - TEST_NOT_NULL(xfrm); - TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); - TEST_EQUAL_UI(((sqfs_object_t *)mem_istream)->refcount, 1); - - istream = istream_xfrm_create(mem_istream, xfrm); - - TEST_NOT_NULL(istream); - TEST_EQUAL_UI(((sqfs_object_t *)istream)->refcount, 1); - TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 2); - TEST_EQUAL_UI(((sqfs_object_t *)mem_istream)->refcount, 2); - - for (i = 0; i < (sizeof(orig) - 1); ++i) { - ret = sqfs_istream_read(istream, &c, 1); - TEST_EQUAL_I(ret, 1); - TEST_EQUAL_I(c, orig[i]); - } - - ret = sqfs_istream_read(istream, &c, 1); - TEST_EQUAL_I(ret, 0); - - ret = sqfs_istream_read(istream, &c, 1); - TEST_EQUAL_I(ret, 0); - - sqfs_drop(istream); - TEST_EQUAL_UI(((sqfs_object_t *)mem_istream)->refcount, 1); - TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); - sqfs_drop(xfrm); - sqfs_drop(mem_istream); -} - -static void run_pack_test(void) -{ - sqfs_ostream_t *ostream; - xfrm_stream_t *xfrm; - size_t i; - int ret; - - mo_written = 0; - mo_flushed = false; - - xfrm = mkcompressor(NULL); - TEST_NOT_NULL(xfrm); - TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); - TEST_EQUAL_UI(((sqfs_object_t *)&mem_ostream)->refcount, 1); - - ostream = ostream_xfrm_create(&mem_ostream, xfrm); - - TEST_NOT_NULL(ostream); - TEST_EQUAL_UI(((sqfs_object_t *)ostream)->refcount, 1); - TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 2); - TEST_EQUAL_UI(((sqfs_object_t *)&mem_ostream)->refcount, 2); - - for (i = 0; i < (sizeof(orig) - 1); ++i) { - ret = ostream->append(ostream, orig + i, 1); - TEST_EQUAL_I(ret, 0); - } - - ret = ostream->flush(ostream); - TEST_EQUAL_I(ret, 0); - - TEST_ASSERT(mo_flushed); - TEST_ASSERT(mo_written < sizeof(orig)); - ret = memcmp(mo_buffer, orig, mo_written); - TEST_ASSERT(ret != 0); - - sqfs_drop(ostream); - TEST_EQUAL_UI(((sqfs_object_t *)&mem_ostream)->refcount, 1); - TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); - sqfs_drop(xfrm); -} - -int main(int argc, char **argv) -{ - (void)argc; (void)argv; - - /* normal stream */ - run_unpack_test(blob_in, sizeof(blob_in)); - - /* concatenated streams */ -#if !defined(DO_GZIP) - run_unpack_test(blob_in_concat, sizeof(blob_in_concat)); -#else - (void)blob_in_concat; -#endif - /* compress */ - run_pack_test(); - - /* restore from compressed */ - run_unpack_test(mo_buffer, mo_written); - return EXIT_SUCCESS; -} +#endif /* BLOB_H */ diff --git a/lib/xfrm/test/unpack.c b/lib/xfrm/test/unpack.c index ca51f10..feb296c 100644 --- a/lib/xfrm/test/unpack.c +++ b/lib/xfrm/test/unpack.c @@ -7,336 +7,7 @@ #include "xfrm/compress.h" #include "xfrm/stream.h" #include "util/test.h" - -static const sqfs_u8 blob_in[] = { -#if defined(DO_XZ) - 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x00, - 0xff, 0x12, 0xd9, 0x41, 0x02, 0x00, 0x21, 0x01, - 0x1c, 0x00, 0x00, 0x00, 0x10, 0xcf, 0x58, 0xcc, - 0xe0, 0x01, 0xbd, 0x01, 0x43, 0x5d, 0x00, 0x26, - 0x1b, 0xca, 0x46, 0x67, 0x5a, 0xf2, 0x77, 0xb8, - 0x7d, 0x86, 0xd8, 0x41, 0xdb, 0x05, 0x35, 0xcd, - 0x83, 0xa5, 0x7c, 0x12, 0xa5, 0x05, 0xdb, 0x90, - 0xbd, 0x2f, 0x14, 0xd3, 0x71, 0x72, 0x96, 0xa8, - 0x8a, 0x7d, 0x84, 0x56, 0x71, 0x8d, 0x6a, 0x22, - 0x98, 0xab, 0x9e, 0x3d, 0xc3, 0x55, 0xef, 0xcc, - 0xa5, 0xc3, 0xdd, 0x5b, 0x8e, 0xbf, 0x03, 0x81, - 0x21, 0x40, 0xd6, 0x26, 0x91, 0x02, 0x45, 0x4e, - 0x20, 0x91, 0xcf, 0x8c, 0x51, 0x22, 0x02, 0x70, - 0xba, 0x05, 0x6b, 0x83, 0xef, 0x3f, 0x8e, 0x09, - 0xef, 0x88, 0xf5, 0x37, 0x1b, 0x89, 0x8d, 0xff, - 0x1e, 0xee, 0xe8, 0xb0, 0xac, 0xf2, 0x6e, 0xd4, - 0x3e, 0x25, 0xaf, 0xa0, 0x6d, 0x2e, 0xc0, 0x7f, - 0xb5, 0xa0, 0xcb, 0x90, 0x1f, 0x08, 0x1a, 0xe2, - 0x90, 0x20, 0x19, 0x71, 0x0c, 0xe8, 0x3f, 0xe5, - 0x39, 0xeb, 0x9a, 0x62, 0x4f, 0x06, 0xda, 0x3c, - 0x32, 0x59, 0xcc, 0x83, 0xe3, 0x83, 0x0f, 0x38, - 0x7d, 0x43, 0x37, 0x6c, 0x0b, 0x05, 0x65, 0x98, - 0x25, 0xdb, 0xf2, 0xc0, 0x2d, 0x39, 0x36, 0x5d, - 0xd4, 0xb6, 0xc2, 0x79, 0x73, 0x3e, 0xc2, 0x6e, - 0x54, 0xec, 0x78, 0x2b, 0x5d, 0xf1, 0xd1, 0xb4, - 0xb3, 0xcd, 0xf3, 0x89, 0xf5, 0x81, 0x3e, 0x2c, - 0x65, 0xd6, 0x73, 0xd3, 0x1b, 0x20, 0x68, 0x0c, - 0x93, 0xd4, 0xfc, 0x9f, 0xf8, 0xa7, 0xd4, 0xfa, - 0x3a, 0xb1, 0x13, 0x93, 0x4b, 0xec, 0x78, 0x7d, - 0x5c, 0x81, 0x80, 0xe5, 0x14, 0x78, 0xfe, 0x7e, - 0xde, 0xf7, 0xad, 0x9e, 0x84, 0xba, 0xf1, 0x00, - 0xe9, 0xbd, 0x2c, 0xf4, 0x70, 0x7d, 0xbe, 0x29, - 0xb9, 0xf0, 0x10, 0xb9, 0x01, 0xf1, 0x76, 0x8a, - 0x5a, 0xad, 0x02, 0xa1, 0x32, 0xc8, 0x53, 0x59, - 0x11, 0x4c, 0xe2, 0x98, 0x34, 0xd9, 0x23, 0x51, - 0x4a, 0x40, 0x2b, 0x87, 0x41, 0xdd, 0x50, 0xcd, - 0x98, 0x1e, 0x29, 0x86, 0x23, 0x93, 0x3e, 0x9b, - 0x6b, 0x16, 0xa1, 0x40, 0xac, 0xe7, 0x40, 0xfe, - 0xa9, 0x87, 0x48, 0x25, 0x52, 0x02, 0x8b, 0xc4, - 0x68, 0x08, 0x5a, 0x62, 0xc1, 0xb2, 0x07, 0x3b, - 0x26, 0x1e, 0x59, 0x5c, 0x47, 0x24, 0xae, 0x8e, - 0xe5, 0xf7, 0xe6, 0x4b, 0x13, 0xb4, 0x6d, 0x46, - 0x65, 0x4f, 0xd0, 0x48, 0xcc, 0x51, 0x4b, 0x80, - 0xcb, 0xf1, 0xd4, 0x6c, 0x45, 0x98, 0x92, 0x47, - 0xeb, 0x60, 0x00, 0x00, 0x00, 0x01, 0xd7, 0x02, - 0xbe, 0x03, 0x00, 0x00, 0xda, 0x2c, 0x45, 0x49, - 0xa8, 0x00, 0x0a, 0xfc, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x59, 0x5a -#elif defined(DO_BZIP2) - 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, - 0x53, 0x59, 0x05, 0x24, 0x28, 0x04, 0x00, 0x00, - 0x27, 0xd7, 0x80, 0x00, 0x10, 0x40, 0x05, 0x06, - 0x04, 0x02, 0x00, 0x3f, 0xe7, 0xff, 0x40, 0x30, - 0x01, 0x2d, 0x23, 0x62, 0x26, 0x05, 0x3d, 0x03, - 0x54, 0xfd, 0x53, 0x4c, 0x86, 0x9e, 0x90, 0x6a, - 0x9e, 0x9e, 0x85, 0x3c, 0xa0, 0x00, 0x00, 0x1a, - 0x9e, 0x41, 0x13, 0x13, 0x28, 0x69, 0x03, 0xd4, - 0x0f, 0x1c, 0x70, 0xd0, 0xb4, 0xe3, 0xe4, 0x75, - 0x4e, 0x8b, 0x67, 0x43, 0x7b, 0x38, 0x27, 0x77, - 0xe4, 0xc1, 0x98, 0x3a, 0x2d, 0x3a, 0xe4, 0x44, - 0x98, 0xdc, 0x49, 0x8b, 0x22, 0x48, 0xfc, 0xc8, - 0xe7, 0x57, 0x05, 0x3c, 0x5a, 0xee, 0x5a, 0x84, - 0xcd, 0x7c, 0x8f, 0x26, 0x6b, 0x6e, 0xf7, 0xb5, - 0x49, 0x1f, 0x79, 0x42, 0x5d, 0x09, 0x8c, 0xc6, - 0xde, 0x0c, 0x0d, 0xb1, 0x46, 0xb4, 0xee, 0xd9, - 0x8f, 0x33, 0x37, 0x04, 0xa9, 0x05, 0x49, 0xe3, - 0x04, 0x16, 0x62, 0x36, 0x3a, 0x01, 0xda, 0xd4, - 0xc8, 0x8a, 0x32, 0x02, 0x1f, 0x62, 0x4b, 0xa4, - 0x49, 0x59, 0xda, 0x50, 0x85, 0x69, 0x35, 0x21, - 0x10, 0xc6, 0x8a, 0x3c, 0x44, 0x95, 0xb0, 0xbc, - 0xc5, 0x6b, 0xea, 0xfb, 0x40, 0xbd, 0x14, 0x01, - 0x6a, 0xfa, 0xcd, 0x67, 0xd8, 0x2d, 0x93, 0x8b, - 0xda, 0x44, 0x1b, 0xe9, 0x5a, 0x87, 0x60, 0xb0, - 0xe0, 0x73, 0xd1, 0x01, 0x3a, 0x66, 0x05, 0xcc, - 0x34, 0xa0, 0x63, 0x8d, 0x35, 0x5e, 0xa0, 0x9f, - 0x05, 0x89, 0x15, 0x51, 0x48, 0x16, 0x0c, 0x61, - 0xf4, 0x30, 0xb8, 0x07, 0x29, 0xc0, 0xf5, 0x1a, - 0xe1, 0x0d, 0x6c, 0xfe, 0x91, 0xda, 0x13, 0x2f, - 0x8e, 0x5b, 0x1c, 0xfc, 0xb3, 0xb2, 0x30, 0x9d, - 0xf6, 0x09, 0x30, 0x55, 0x30, 0x67, 0xc2, 0x87, - 0xe9, 0x9a, 0xd4, 0x1d, 0x66, 0x11, 0x54, 0x89, - 0x21, 0xe1, 0x55, 0x84, 0xbf, 0xa6, 0x11, 0xa4, - 0xb8, 0x40, 0xed, 0x42, 0x20, 0xb9, 0xb7, 0x26, - 0x31, 0x14, 0x4f, 0x86, 0xdc, 0x50, 0x34, 0x38, - 0x8b, 0x57, 0x77, 0x21, 0xf6, 0x89, 0xbd, 0xc5, - 0x65, 0xc3, 0x23, 0x45, 0xec, 0x7f, 0x8b, 0xb9, - 0x22, 0x9c, 0x28, 0x48, 0x02, 0x92, 0x14, 0x02, - 0x00, -#elif defined(DO_GZIP) - 0x1f, 0x8b, 0x08, 0x08, 0xdb, 0xa1, 0x97, 0x63, - 0x00, 0x03, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, - 0x78, 0x74, 0x00, 0x35, 0x90, 0xc1, 0x71, 0x43, - 0x31, 0x08, 0x44, 0xef, 0xbf, 0x8a, 0x2d, 0x20, - 0xf3, 0xab, 0x48, 0x6e, 0xb9, 0xa6, 0x00, 0x82, - 0xb0, 0xc3, 0x8c, 0x24, 0x64, 0x09, 0x3c, 0x2e, - 0x3f, 0xc8, 0x4e, 0x6e, 0x42, 0xc0, 0xb2, 0xfb, - 0x3e, 0x6d, 0x4a, 0x83, 0x8e, 0x15, 0x0d, 0xc5, - 0xaa, 0x4d, 0x2c, 0x75, 0x50, 0x13, 0x7f, 0x03, - 0x5b, 0x5f, 0xc2, 0x2e, 0x1e, 0x13, 0x54, 0x74, - 0xe8, 0x62, 0xed, 0x57, 0x48, 0xd5, 0x6c, 0x2e, - 0x29, 0xb9, 0x00, 0xd1, 0x58, 0xcd, 0xca, 0xe1, - 0xd2, 0x46, 0x2e, 0x6b, 0x67, 0x2d, 0x5a, 0xa2, - 0x3b, 0xc2, 0x51, 0xe9, 0x3b, 0xe5, 0x21, 0xfe, - 0x92, 0x16, 0x34, 0xba, 0x76, 0x02, 0x55, 0xbd, - 0x05, 0x9d, 0xf8, 0x72, 0x48, 0xd7, 0x96, 0xda, - 0x68, 0xba, 0x1f, 0xf7, 0x2c, 0xa9, 0xbd, 0x1d, - 0xb7, 0xd0, 0x85, 0x6e, 0xcb, 0x67, 0x14, 0xc8, - 0x43, 0x26, 0xab, 0x93, 0xab, 0x75, 0x44, 0xad, - 0xd4, 0xd8, 0x5e, 0xca, 0x7b, 0x48, 0x97, 0xee, - 0x4b, 0x4f, 0x49, 0x1d, 0x39, 0x0c, 0xa1, 0x34, - 0xde, 0xd2, 0x93, 0x1d, 0xcf, 0x00, 0x79, 0xca, - 0x4f, 0xbc, 0x6f, 0x49, 0x0a, 0x17, 0xe8, 0x8c, - 0x74, 0xf2, 0xca, 0xaa, 0x1d, 0x53, 0xc6, 0x94, - 0x1f, 0xe9, 0x45, 0x66, 0x06, 0xcf, 0x8f, 0xbb, - 0xd5, 0x18, 0x79, 0x4e, 0xd2, 0x4e, 0x26, 0x85, - 0xac, 0x25, 0x07, 0x6b, 0xad, 0xff, 0x84, 0x32, - 0x50, 0xe0, 0x12, 0x57, 0x25, 0x47, 0xdf, 0x86, - 0x30, 0x68, 0x66, 0x11, 0xf3, 0xc4, 0xc7, 0x83, - 0x65, 0xb8, 0xc4, 0xc6, 0x98, 0x0c, 0x8c, 0x99, - 0x84, 0x73, 0x8e, 0x63, 0x68, 0x21, 0xdf, 0x1b, - 0xd6, 0x8f, 0x31, 0x4d, 0x8b, 0xf4, 0x4d, 0x71, - 0x93, 0xca, 0xa3, 0x1c, 0x75, 0x10, 0x32, 0x02, - 0xec, 0x72, 0x51, 0x56, 0x42, 0x91, 0x25, 0x73, - 0x77, 0x9b, 0xd5, 0x6d, 0x83, 0x36, 0x20, 0x4d, - 0x1c, 0xeb, 0x8f, 0x6b, 0xb4, 0xf3, 0xf8, 0x05, - 0x6b, 0x8b, 0x8b, 0x20, 0xbe, 0x01, 0x00, 0x00, -#elif defined(DO_ZSTD) - 0x28, 0xb5, 0x2f, 0xfd, 0x04, 0x88, 0xa5, 0x08, - 0x00, 0x46, 0x97, 0x3a, 0x1a, 0x80, 0x37, 0xcd, - 0x01, 0xc0, 0x8a, 0xec, 0xfe, 0x2d, 0xf2, 0xb9, - 0x44, 0x6b, 0xb9, 0x24, 0x77, 0x56, 0x5a, 0x33, - 0x17, 0x0b, 0x67, 0x83, 0x2e, 0x47, 0x07, 0x31, - 0x00, 0x32, 0x00, 0x33, 0x00, 0xc5, 0x2c, 0x5a, - 0x92, 0x93, 0x0f, 0x7b, 0xd1, 0x1d, 0x63, 0x2c, - 0xc8, 0x99, 0x94, 0x77, 0x8f, 0x94, 0x38, 0x75, - 0x80, 0x2f, 0xae, 0xc1, 0x3e, 0xd2, 0xcf, 0x49, - 0x15, 0x25, 0x1a, 0x87, 0x93, 0xdd, 0xe8, 0x00, - 0x6d, 0xaa, 0xf8, 0x54, 0x74, 0xe5, 0x48, 0x4d, - 0xa6, 0xf3, 0x1a, 0xa3, 0x13, 0x08, 0xe5, 0x26, - 0xdc, 0x73, 0xcc, 0x3e, 0xfd, 0x86, 0xa9, 0x52, - 0xb2, 0x76, 0xc7, 0xc2, 0x0f, 0xe4, 0x84, 0x4b, - 0x12, 0x61, 0x3a, 0x6b, 0x7a, 0x1e, 0x8a, 0x81, - 0xa9, 0x9b, 0x11, 0x37, 0x25, 0x55, 0x73, 0x73, - 0x71, 0xa0, 0x84, 0xca, 0xc3, 0x4b, 0xb5, 0xcc, - 0x50, 0xa6, 0x46, 0xd7, 0xe8, 0x08, 0xaa, 0x04, - 0x28, 0xb1, 0x8e, 0xea, 0xb4, 0x4a, 0x49, 0x2b, - 0xd6, 0x0d, 0x59, 0x68, 0xda, 0x64, 0x29, 0x1f, - 0x85, 0x53, 0x72, 0xf1, 0xc5, 0x88, 0x1a, 0x0b, - 0x4f, 0x96, 0x43, 0xe0, 0x91, 0x89, 0xb9, 0xc0, - 0xe8, 0x18, 0xd5, 0x6e, 0x94, 0xe8, 0x35, 0x66, - 0x01, 0x94, 0x80, 0x95, 0x87, 0xe2, 0xc8, 0x19, - 0x73, 0xa3, 0x01, 0x05, 0xc1, 0x64, 0x72, 0xc9, - 0x6b, 0x6e, 0x55, 0x7c, 0x29, 0x67, 0x90, 0x93, - 0x49, 0xeb, 0xe3, 0x85, 0xc2, 0xf5, 0x79, 0x68, - 0x9d, 0x92, 0xc3, 0x32, 0x75, 0x80, 0x66, 0xf2, - 0x43, 0xa7, 0xb0, 0xc3, 0x22, 0x3f, 0x39, 0x8a, - 0x35, 0x5c, 0x63, 0x5c, 0xd1, 0x9e, 0x8a, 0xd2, - 0x78, 0x3c, 0x12, 0x01, 0x25, 0x04, 0x0e, 0x08, - 0x10, 0x88, 0xb6, 0x1b, 0xb7, 0x96, 0x35, 0xa8, - 0x0d, 0x1e, 0xae, 0xac, 0x4a, 0x70, 0xa5, 0x31, - 0xd0, 0x0c, 0x78, 0xbf, 0xdd, 0xc5, 0x24, 0x3e, - 0xcb, 0x0a, 0x0a, 0x69, 0x40, 0xba, 0xb0, 0xc4, - 0x2a, 0x9b, 0x1e, 0x0a, 0x51, 0xa6, 0x16, 0x98, - 0x76, -#endif -}; - -static const sqfs_u8 blob_in_concat[] = { -#if defined(DO_XZ) - 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04, - 0xe6, 0xd6, 0xb4, 0x46, 0x02, 0x00, 0x21, 0x01, - 0x16, 0x00, 0x00, 0x00, 0x74, 0x2f, 0xe5, 0xa3, - 0xe0, 0x00, 0xdc, 0x00, 0xb3, 0x5d, 0x00, 0x26, - 0x1b, 0xca, 0x46, 0x67, 0x5a, 0xf2, 0x77, 0xb8, - 0x7d, 0x86, 0xd8, 0x41, 0xdb, 0x05, 0x35, 0xcd, - 0x83, 0xa5, 0x7c, 0x12, 0xa5, 0x05, 0xdb, 0x90, - 0xbd, 0x2f, 0x14, 0xd3, 0x71, 0x72, 0x96, 0xa8, - 0x8a, 0x7d, 0x84, 0x56, 0x71, 0x8d, 0x6a, 0x22, - 0x98, 0xab, 0x9e, 0x3d, 0xc3, 0x55, 0xef, 0xcc, - 0xa5, 0xc3, 0xdd, 0x5b, 0x8e, 0xbf, 0x03, 0x81, - 0x21, 0x40, 0xd6, 0x26, 0x91, 0x02, 0x45, 0x4e, - 0x20, 0x91, 0xcf, 0x8c, 0x51, 0x22, 0x02, 0x70, - 0xba, 0x05, 0x6b, 0x83, 0xef, 0x3f, 0x8e, 0x09, - 0xef, 0x88, 0xf5, 0x37, 0x1b, 0x89, 0x8d, 0xff, - 0x1e, 0xee, 0xe8, 0xb0, 0xac, 0xf2, 0x6e, 0xd4, - 0x3e, 0x25, 0xaf, 0xa0, 0x6d, 0x2e, 0xc0, 0x7f, - 0xb5, 0xa0, 0xcb, 0x90, 0x1f, 0x08, 0x1a, 0xe2, - 0x90, 0x20, 0x19, 0x71, 0x0c, 0xe8, 0x3f, 0xe5, - 0x39, 0xeb, 0x9a, 0x62, 0x4f, 0x06, 0xda, 0x3c, - 0x32, 0x59, 0xcc, 0x83, 0xe3, 0x83, 0x0f, 0x38, - 0x7d, 0x43, 0x37, 0x6c, 0x0b, 0x05, 0x65, 0x98, - 0x25, 0xdb, 0xf2, 0xc0, 0x2d, 0x39, 0x36, 0x5d, - 0xd4, 0xb6, 0xc2, 0x79, 0x73, 0x3e, 0xc2, 0x6e, - 0x54, 0xec, 0x78, 0x2b, 0x5d, 0xf1, 0xd1, 0xb4, - 0xb3, 0xcd, 0xf3, 0x89, 0xf5, 0x80, 0x79, 0x46, - 0xc0, 0x00, 0x00, 0x00, 0xc4, 0xf5, 0x1d, 0x08, - 0xf0, 0x34, 0x3a, 0x59, 0x00, 0x01, 0xcf, 0x01, - 0xdd, 0x01, 0x00, 0x00, 0x7f, 0x5a, 0x77, 0xcb, - 0xb1, 0xc4, 0x67, 0xfb, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x59, 0x5a, - 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00, 0x00, 0x04, - 0xe6, 0xd6, 0xb4, 0x46, 0x02, 0x00, 0x21, 0x01, - 0x16, 0x00, 0x00, 0x00, 0x74, 0x2f, 0xe5, 0xa3, - 0xe0, 0x00, 0xe0, 0x00, 0xb7, 0x5d, 0x00, 0x31, - 0x9b, 0xca, 0x19, 0xc5, 0x54, 0xec, 0xb6, 0x54, - 0xe7, 0xb1, 0x7d, 0xc4, 0x57, 0x9e, 0x6c, 0x89, - 0xad, 0x4a, 0x6d, 0x16, 0xd8, 0x3c, 0x05, 0x94, - 0x10, 0x16, 0x99, 0x38, 0x21, 0xa3, 0xb9, 0xc5, - 0x80, 0xff, 0xfc, 0xee, 0xd4, 0xd5, 0x3f, 0xdd, - 0x8c, 0xd7, 0x3d, 0x8f, 0x76, 0xec, 0x96, 0x9d, - 0x20, 0xac, 0xcb, 0x18, 0xf5, 0xb2, 0x9c, 0x12, - 0xf6, 0x7c, 0x33, 0xdc, 0x4f, 0x9a, 0xe5, 0x2d, - 0x63, 0x68, 0xa4, 0x2b, 0x1d, 0x0a, 0x1e, 0xf0, - 0xfe, 0x73, 0xf2, 0x5f, 0x7b, 0xb4, 0xea, 0x54, - 0xad, 0x27, 0xd1, 0xff, 0xb6, 0x50, 0x06, 0x7b, - 0x51, 0x3f, 0x25, 0x8a, 0xcf, 0x4c, 0x03, 0x3e, - 0xc3, 0xad, 0x47, 0x34, 0xcf, 0xba, 0x45, 0x79, - 0xd0, 0x7b, 0xf6, 0x66, 0x63, 0xc0, 0xc6, 0x69, - 0xa7, 0x51, 0x84, 0xa8, 0xa0, 0x0b, 0xbc, 0x6f, - 0x13, 0x89, 0xd6, 0x5e, 0xac, 0xca, 0x2f, 0xd2, - 0xe7, 0xe1, 0x1e, 0x78, 0x22, 0x3a, 0x59, 0x6c, - 0x9c, 0x8c, 0x65, 0xf1, 0x5b, 0xf4, 0xbf, 0xd5, - 0xdc, 0x05, 0xeb, 0x70, 0x10, 0xb8, 0x6c, 0xf2, - 0x13, 0x20, 0xb0, 0xdd, 0x3e, 0xb2, 0x92, 0x5b, - 0xa3, 0xf7, 0x94, 0xa1, 0xa1, 0x74, 0x36, 0x9a, - 0xf1, 0xd8, 0xc2, 0xf0, 0xc6, 0x29, 0x7e, 0x85, - 0x28, 0xf5, 0xf2, 0x21, 0x00, 0x00, 0x00, 0x00, - 0xc8, 0x80, 0x67, 0x40, 0xc3, 0xaa, 0x17, 0x57, - 0x00, 0x01, 0xd3, 0x01, 0xe1, 0x01, 0x00, 0x00, - 0x86, 0xdf, 0x9e, 0x05, 0xb1, 0xc4, 0x67, 0xfb, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5a -#elif defined(DO_BZIP2) - 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, - 0x53, 0x59, 0x5d, 0x09, 0x24, 0x1d, 0x00, 0x00, - 0x13, 0xd7, 0x80, 0x00, 0x10, 0x40, 0x05, 0x00, - 0x04, 0x02, 0x00, 0x3e, 0xa7, 0xff, 0x40, 0x30, - 0x00, 0xac, 0x43, 0x54, 0xf5, 0x36, 0x4c, 0xa7, - 0xa8, 0xd3, 0x6a, 0x60, 0x81, 0x40, 0x00, 0xd0, - 0x32, 0x64, 0x0d, 0x53, 0xda, 0x02, 0x09, 0xa2, - 0x68, 0x34, 0xd1, 0x27, 0x4a, 0xdd, 0xf2, 0x0a, - 0x73, 0x43, 0xf9, 0xa2, 0x51, 0x85, 0x76, 0x45, - 0x9a, 0x68, 0x3a, 0xe7, 0x0d, 0xc0, 0x21, 0x4a, - 0xc4, 0xf9, 0xf7, 0x40, 0xc3, 0x10, 0xb2, 0x9b, - 0x58, 0x56, 0x71, 0x50, 0x2f, 0xa4, 0xc5, 0x61, - 0x19, 0xf6, 0x59, 0x06, 0x82, 0x03, 0x7f, 0xeb, - 0xd2, 0x61, 0x88, 0xcd, 0xe8, 0xf7, 0xe8, 0x87, - 0x59, 0x9d, 0xe1, 0xf8, 0x19, 0x6e, 0xad, 0x77, - 0xbf, 0x34, 0x17, 0x21, 0x6b, 0x91, 0xc9, 0x52, - 0xd0, 0x81, 0x1e, 0xb5, 0x0b, 0xee, 0x42, 0x84, - 0x80, 0xd5, 0xa1, 0x8a, 0x04, 0x18, 0x4d, 0xf3, - 0xda, 0x7e, 0x3c, 0x40, 0xa4, 0xdb, 0xe5, 0xf0, - 0x37, 0x40, 0x3a, 0x7d, 0xa7, 0x45, 0x21, 0xf2, - 0x5a, 0x7b, 0x59, 0x56, 0x16, 0xd5, 0xac, 0x9f, - 0x60, 0x85, 0x0e, 0xf5, 0x73, 0xd9, 0x47, 0xe2, - 0xee, 0x48, 0xa7, 0x0a, 0x12, 0x0b, 0xa1, 0x24, - 0x83, 0xa0, - 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, - 0x53, 0x59, 0x2c, 0x24, 0x39, 0xa0, 0x00, 0x00, - 0x1f, 0x55, 0x80, 0x00, 0x10, 0x40, 0x05, 0x06, - 0x00, 0x3f, 0xe7, 0xff, 0x40, 0x30, 0x00, 0xb5, - 0x91, 0x13, 0x4f, 0x54, 0x7a, 0x6a, 0x6d, 0x4d, - 0xa2, 0x68, 0x0c, 0x84, 0x53, 0xf5, 0x30, 0x89, - 0xa3, 0xd4, 0x0d, 0x0f, 0x49, 0xa0, 0xd4, 0xf4, - 0xd1, 0x53, 0xf4, 0x93, 0x69, 0x3c, 0x81, 0x1a, - 0x65, 0x53, 0x90, 0x51, 0x07, 0x2a, 0xad, 0x8f, - 0x63, 0xba, 0x25, 0xc2, 0x0c, 0x8b, 0xb9, 0x95, - 0x15, 0xd8, 0xda, 0x61, 0x5c, 0xa9, 0xe4, 0x0b, - 0x21, 0xc9, 0x97, 0x57, 0x01, 0x28, 0x9b, 0xfb, - 0x94, 0xb9, 0x48, 0xa3, 0x0a, 0xc6, 0x1c, 0x54, - 0x98, 0x9a, 0x39, 0xc3, 0x87, 0x90, 0x33, 0x58, - 0x2d, 0x3e, 0x16, 0xb1, 0xae, 0x26, 0x89, 0x75, - 0xf5, 0x77, 0xa5, 0x8e, 0x5b, 0x8c, 0x8a, 0x39, - 0xbd, 0x75, 0x21, 0x9d, 0x99, 0x18, 0x4a, 0x91, - 0xab, 0xbc, 0x08, 0x87, 0xa4, 0xf1, 0x81, 0xb5, - 0xb4, 0xb0, 0xfe, 0x6b, 0x9f, 0xbe, 0x19, 0x82, - 0xd1, 0x50, 0xe1, 0x5e, 0x13, 0xb5, 0xc6, 0x2c, - 0xa4, 0x82, 0xf2, 0x5c, 0xc3, 0x20, 0x41, 0x13, - 0x56, 0x63, 0x3d, 0xec, 0x71, 0x2a, 0xbf, 0x2c, - 0x60, 0x2f, 0x7a, 0x4d, 0xcb, 0x3f, 0x8b, 0xb9, - 0x22, 0x9c, 0x28, 0x48, 0x16, 0x12, 0x1c, 0xd0, - 0x00, -#elif defined(DO_ZSTD) - 0x28, 0xb5, 0x2f, 0xfd, 0x04, 0x58, 0x75, 0x04, - 0x00, 0xb2, 0x4c, 0x20, 0x17, 0xa0, 0x25, 0x69, - 0x03, 0xf0, 0xb2, 0x37, 0xb1, 0x5e, 0xb9, 0x24, - 0x56, 0x5b, 0x52, 0x22, 0x39, 0x01, 0x44, 0x2b, - 0x03, 0x55, 0xe3, 0x47, 0x03, 0x12, 0x9a, 0xe1, - 0xf0, 0x94, 0x0b, 0xe5, 0xe2, 0xba, 0x7e, 0xfe, - 0x9c, 0xc7, 0x61, 0x43, 0xc8, 0xfa, 0xf0, 0x3a, - 0xfa, 0x51, 0xaa, 0x50, 0xa6, 0x2d, 0x9a, 0x78, - 0xce, 0x2f, 0x61, 0x20, 0x6c, 0x7e, 0x35, 0x60, - 0xfb, 0xdd, 0x4c, 0x63, 0xfb, 0x95, 0x35, 0xc0, - 0x82, 0x59, 0xc2, 0xc9, 0x78, 0x6e, 0x30, 0xe6, - 0xd2, 0x72, 0x15, 0x14, 0x18, 0x62, 0x5d, 0xeb, - 0x2d, 0x9d, 0x3e, 0xee, 0x2e, 0x58, 0x58, 0xe9, - 0x40, 0x68, 0xb9, 0x2f, 0x23, 0x99, 0x2a, 0x4d, - 0xe8, 0x49, 0x79, 0x70, 0x1f, 0xf9, 0xe2, 0x34, - 0x2e, 0xab, 0xa5, 0xa3, 0xf2, 0x70, 0x98, 0xd0, - 0xb2, 0xb1, 0x3e, 0x5d, 0x90, 0x20, 0xd9, 0x36, - 0x8b, 0xdb, 0xaa, 0x20, 0x40, 0x03, 0x14, 0x06, - 0x03, 0x16, 0x2a, 0x9d, 0x31, 0xbd, 0x28, 0x3b, - 0x0c, 0xac, 0x41, - 0x28, 0xb5, 0x2f, 0xfd, 0x04, 0x58, 0xbd, 0x04, - 0x00, 0x62, 0xcd, 0x22, 0x19, 0xa0, 0x25, 0x69, - 0x03, 0x60, 0x72, 0xc9, 0x36, 0xda, 0xd2, 0x8b, - 0xfc, 0xbf, 0x25, 0x42, 0xa9, 0x82, 0x38, 0x70, - 0x1a, 0x2e, 0x54, 0x95, 0x33, 0x02, 0x03, 0x51, - 0x36, 0x51, 0x80, 0xcc, 0x7a, 0x6e, 0x52, 0x2e, - 0x75, 0x64, 0x2d, 0x33, 0x2c, 0xd6, 0xdb, 0xfc, - 0x39, 0x31, 0xd5, 0xa8, 0xa2, 0x40, 0xd7, 0x12, - 0x4c, 0xc6, 0x76, 0xdc, 0x1e, 0x0f, 0xf4, 0x4e, - 0x0a, 0xd3, 0x0c, 0x87, 0x67, 0x25, 0x25, 0x52, - 0x66, 0x87, 0x95, 0xc6, 0x69, 0x0c, 0xb4, 0x5e, - 0x1d, 0xe7, 0x5e, 0xcd, 0x47, 0x41, 0x80, 0x89, - 0x5c, 0xa5, 0x4a, 0x32, 0x26, 0xb3, 0x3d, 0x2b, - 0xd5, 0xc0, 0x16, 0xde, 0xfb, 0x65, 0xcd, 0x6a, - 0x0c, 0x3f, 0xe7, 0xd6, 0xb2, 0x17, 0x7c, 0x25, - 0x35, 0x6b, 0x58, 0xf0, 0x95, 0xb5, 0xf2, 0xe4, - 0x4e, 0xf0, 0x34, 0x4f, 0x5f, 0x39, 0xd1, 0x90, - 0xf8, 0xb9, 0x59, 0xbe, 0x2e, 0xf9, 0xd4, 0x02, - 0x98, 0x50, 0x5a, 0xc2, 0xcf, 0xe1, 0x08, 0x02, - 0x00, 0x0f, 0x1e, 0x44, 0x40, 0x79, 0x50, 0x67, - 0x3d, 0xd3, 0x35, 0x8f, -#elif defined(DO_GZIP) - 0, -#endif -}; +#include "blob.h" #if defined(DO_XZ) static size_t in_stop = 244; @@ -357,14 +28,6 @@ static size_t out_stop = 446; #define mkdecompressor decompressor_stream_gzip_create #endif -static const char orig[] = -"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n" -"tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n" -"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n" -"consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n" -"cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\n" -"proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n"; - int main(int argc, char **argv) { sqfs_u32 in_diff = 0, out_diff = 0; diff --git a/lib/xfrm/test/wrap.c b/lib/xfrm/test/wrap.c new file mode 100644 index 0000000..70ed317 --- /dev/null +++ b/lib/xfrm/test/wrap.c @@ -0,0 +1,175 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * wrap.c + * + * Copyright (C) 2022 David Oberhollenzer <goliath@infraroot.at> + */ +#include "xfrm/compress.h" +#include "xfrm/stream.h" +#include "xfrm/wrap.h" +#include "util/test.h" +#include "sqfs/io.h" +#include "common.h" +#include "blob.h" + +#if defined(DO_XZ) +#define mkdecompressor decompressor_stream_xz_create +#define mkcompressor compressor_stream_xz_create +#elif defined(DO_BZIP2) +#define mkdecompressor decompressor_stream_bzip2_create +#define mkcompressor compressor_stream_bzip2_create +#elif defined(DO_ZSTD) +#define mkdecompressor decompressor_stream_zstd_create +#define mkcompressor compressor_stream_zstd_create +#elif defined(DO_GZIP) +#define mkdecompressor decompressor_stream_gzip_create +#define mkcompressor compressor_stream_gzip_create +#endif + +/*****************************************************************************/ + +static size_t mo_written = 0; +static sqfs_u8 mo_buffer[1024]; +static bool mo_flushed = false; + +static int mem_append(sqfs_ostream_t *strm, const void *data, size_t size); +static int mem_flush(sqfs_ostream_t *strm); + +static sqfs_ostream_t mem_ostream = { + { 1, NULL, NULL, }, + mem_append, + mem_flush, + NULL, +}; + +static int mem_append(sqfs_ostream_t *strm, const void *data, size_t size) +{ + TEST_ASSERT(strm == &mem_ostream); + TEST_ASSERT(size > 0); + + TEST_ASSERT(mo_written <= sizeof(mo_buffer)); + TEST_ASSERT(size <= (sizeof(mo_buffer) - mo_written)); + + if (data == NULL) { + memset(mo_buffer + mo_written, 0, size); + } else { + memcpy(mo_buffer + mo_written, data, size); + } + + mo_written += size; + return 0; +} + +static int mem_flush(sqfs_ostream_t *strm) +{ + TEST_ASSERT(strm == &mem_ostream); + TEST_ASSERT(!mo_flushed); + mo_flushed = true; + return 0; +} + +/*****************************************************************************/ + +static void run_unpack_test(const void *blob, size_t size) +{ + sqfs_istream_t *istream, *mem_istream; + xfrm_stream_t *xfrm; + sqfs_s32 ret; + size_t i; + char c; + + mem_istream = istream_memory_create("memstream", 7, blob, size); + TEST_NOT_NULL(mem_istream); + + xfrm = mkdecompressor(); + TEST_NOT_NULL(xfrm); + TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); + TEST_EQUAL_UI(((sqfs_object_t *)mem_istream)->refcount, 1); + + istream = istream_xfrm_create(mem_istream, xfrm); + + TEST_NOT_NULL(istream); + TEST_EQUAL_UI(((sqfs_object_t *)istream)->refcount, 1); + TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 2); + TEST_EQUAL_UI(((sqfs_object_t *)mem_istream)->refcount, 2); + + for (i = 0; i < (sizeof(orig) - 1); ++i) { + ret = sqfs_istream_read(istream, &c, 1); + TEST_EQUAL_I(ret, 1); + TEST_EQUAL_I(c, orig[i]); + } + + ret = sqfs_istream_read(istream, &c, 1); + TEST_EQUAL_I(ret, 0); + + ret = sqfs_istream_read(istream, &c, 1); + TEST_EQUAL_I(ret, 0); + + sqfs_drop(istream); + TEST_EQUAL_UI(((sqfs_object_t *)mem_istream)->refcount, 1); + TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); + sqfs_drop(xfrm); + sqfs_drop(mem_istream); +} + +static void run_pack_test(void) +{ + sqfs_ostream_t *ostream; + xfrm_stream_t *xfrm; + size_t i; + int ret; + + mo_written = 0; + mo_flushed = false; + + xfrm = mkcompressor(NULL); + TEST_NOT_NULL(xfrm); + TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); + TEST_EQUAL_UI(((sqfs_object_t *)&mem_ostream)->refcount, 1); + + ostream = ostream_xfrm_create(&mem_ostream, xfrm); + + TEST_NOT_NULL(ostream); + TEST_EQUAL_UI(((sqfs_object_t *)ostream)->refcount, 1); + TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 2); + TEST_EQUAL_UI(((sqfs_object_t *)&mem_ostream)->refcount, 2); + + for (i = 0; i < (sizeof(orig) - 1); ++i) { + ret = ostream->append(ostream, orig + i, 1); + TEST_EQUAL_I(ret, 0); + } + + ret = ostream->flush(ostream); + TEST_EQUAL_I(ret, 0); + + TEST_ASSERT(mo_flushed); + TEST_ASSERT(mo_written < sizeof(orig)); + ret = memcmp(mo_buffer, orig, mo_written); + TEST_ASSERT(ret != 0); + + sqfs_drop(ostream); + TEST_EQUAL_UI(((sqfs_object_t *)&mem_ostream)->refcount, 1); + TEST_EQUAL_UI(((sqfs_object_t *)xfrm)->refcount, 1); + sqfs_drop(xfrm); +} + +int main(int argc, char **argv) +{ + (void)argc; (void)argv; + + /* normal stream */ + run_unpack_test(blob_in, sizeof(blob_in)); + + /* concatenated streams */ +#if !defined(DO_GZIP) + run_unpack_test(blob_in_concat, sizeof(blob_in_concat)); +#else + (void)blob_in_concat; +#endif + /* compress */ + run_pack_test(); + + /* restore from compressed */ + run_unpack_test(mo_buffer, mo_written); + return EXIT_SUCCESS; +} |